Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// createDeferredAssets.js

(function () {
  /*global adventurejs A*/
  "use strict";

  var p = adventurejs.Game.prototype;

  /**
   * Create objects - mainly exits - that were defined
   * within other unclassed generic objects.
   * <br><br>
   * Objects created here also need to be validated,
   * since they were added to the deferred list during
   * the initial validation pass and therefore missed validation.
   * @method adventurejs.Game#createDeferredAssets
   * @memberOf adventurejs.Game
   */
  p.createDeferredAssets = function Game_createDeferredAssets() {
    for (var i = 0; i < this.deferredObjects.length; i++) {
      var newObject = this.game.createAsset(this.deferredObjects[i]);

      if (false === newObject) {
        return false;
      }

      if (false === newObject.validate(this)) {
        return false;
      }

      newObject.is.validated = true;
    }
    return true;
  };
})();