Skip to content

Commit

Permalink
Version 2.1.1. of Phaser is an emergency point release. It addresses …
Browse files Browse the repository at this point in the history
…a potential race condition that could happen in States that tried to change state from the `create` method but had an empty preloader or pre-cached assets.
  • Loading branch information
photonstorm committed Sep 11, 2014
1 parent a1a0861 commit 5b922be
Show file tree
Hide file tree
Showing 22 changed files with 439 additions and 176 deletions.
183 changes: 175 additions & 8 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phaser",
"version": "2.1.0",
"version": "2.1.1",
"homepage": "http://phaser.io",
"authors": [
"photonstorm <rich@photonstorm.com>"
Expand Down
2 changes: 1 addition & 1 deletion build/custom/ninja.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/custom/p2.min.js

Large diffs are not rendered by default.

48 changes: 32 additions & 16 deletions build/custom/phaser-arcade-physics.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.1.0 "Cairhien" - Built: Tue Sep 09 2014 15:35:44
* v2.1.1 "Eianrod" - Built: Thu Sep 11 2014 10:37:16
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
Expand Down Expand Up @@ -11382,7 +11382,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
*
* Phaser - http://phaser.io
*
* v2.1.0 "Cairhien" - Built: Tue Sep 09 2014 15:35:44
* v2.1.1 "Eianrod" - Built: Thu Sep 11 2014 10:37:16
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
Expand Down Expand Up @@ -11425,7 +11425,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
*/
var Phaser = Phaser || {

VERSION: '2.1.0',
VERSION: '2.1.1',
GAMES: [],

AUTO: 0,
Expand Down Expand Up @@ -16240,6 +16240,8 @@ Phaser.StateManager.prototype = {

this.setCurrentState(this._pendingState);

this._pendingState = null;

if (this.onPreloadCallback)
{
this.game.load.reset();
Expand All @@ -16261,8 +16263,6 @@ Phaser.StateManager.prototype = {
// No init? Then there was nothing to load either
this.loadComplete();
}

this._pendingState = null;
}

},
Expand Down Expand Up @@ -20772,15 +20772,20 @@ Phaser.FlexGrid.prototype = {
* @param {array} [children] - An array of children that are used to populate the FlexLayer.
* @return {Phaser.FlexLayer} The Layer object.
*/
createFluidLayer: function (children) {
createFluidLayer: function (children, addToWorld) {

if (typeof addToWorld === 'undefined') { addToWorld = true; }

var layer = new Phaser.FlexLayer(this, this.positionFluid, this.boundsFluid, this.scaleFluid);

this.game.world.add(layer);
if (addToWorld)
{
this.game.world.add(layer);
}

this.layers.push(layer);

if (typeof children !== 'undefined')
if (typeof children !== 'undefined' && typeof children !== null)
{
layer.addMultiple(children);
}
Expand Down Expand Up @@ -20844,15 +20849,19 @@ Phaser.FlexGrid.prototype = {
*/
reset: function () {

for (var i = 0; i < this.layers.length; i++)
var i = this.layers.length;

while (i--)
{
// Remove references to this class
this.layers[i].position = null;
this.layers[i].scale = null;
if (!this.layers[i].persist)
{
// Remove references to this class
this.layers[i].position = null;
this.layers[i].scale = null;
this.layers.slice(i, 1);
}
}

this.layers.length = 0;

},

/**
Expand Down Expand Up @@ -20951,12 +20960,19 @@ Phaser.FlexLayer = function (manager, position, bounds, scale) {
/**
* @property {Phaser.ScaleManager} scale - A reference to the ScaleManager.
*/
this.manager = manager;
this.manager = manager.manager;

/**
* @property {Phaser.FlexGrid} grid - A reference to the FlexGrid that owns this layer.
*/
this.grid = manager.grid;
this.grid = manager;

/**
* Should the FlexLayer remain through a State swap?
*
* @type {boolean}
*/
this.persist = false;

// Bound to the grid
this.position = position;
Expand Down
30 changes: 15 additions & 15 deletions build/custom/phaser-arcade-physics.min.js

Large diffs are not rendered by default.

48 changes: 32 additions & 16 deletions build/custom/phaser-ninja-physics.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.1.0 "Cairhien" - Built: Tue Sep 09 2014 15:35:44
* v2.1.1 "Eianrod" - Built: Thu Sep 11 2014 10:37:16
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
Expand Down Expand Up @@ -11382,7 +11382,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
*
* Phaser - http://phaser.io
*
* v2.1.0 "Cairhien" - Built: Tue Sep 09 2014 15:35:44
* v2.1.1 "Eianrod" - Built: Thu Sep 11 2014 10:37:16
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
Expand Down Expand Up @@ -11425,7 +11425,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
*/
var Phaser = Phaser || {

VERSION: '2.1.0',
VERSION: '2.1.1',
GAMES: [],

AUTO: 0,
Expand Down Expand Up @@ -16240,6 +16240,8 @@ Phaser.StateManager.prototype = {

this.setCurrentState(this._pendingState);

this._pendingState = null;

if (this.onPreloadCallback)
{
this.game.load.reset();
Expand All @@ -16261,8 +16263,6 @@ Phaser.StateManager.prototype = {
// No init? Then there was nothing to load either
this.loadComplete();
}

this._pendingState = null;
}

},
Expand Down Expand Up @@ -20772,15 +20772,20 @@ Phaser.FlexGrid.prototype = {
* @param {array} [children] - An array of children that are used to populate the FlexLayer.
* @return {Phaser.FlexLayer} The Layer object.
*/
createFluidLayer: function (children) {
createFluidLayer: function (children, addToWorld) {

if (typeof addToWorld === 'undefined') { addToWorld = true; }

var layer = new Phaser.FlexLayer(this, this.positionFluid, this.boundsFluid, this.scaleFluid);

this.game.world.add(layer);
if (addToWorld)
{
this.game.world.add(layer);
}

this.layers.push(layer);

if (typeof children !== 'undefined')
if (typeof children !== 'undefined' && typeof children !== null)
{
layer.addMultiple(children);
}
Expand Down Expand Up @@ -20844,15 +20849,19 @@ Phaser.FlexGrid.prototype = {
*/
reset: function () {

for (var i = 0; i < this.layers.length; i++)
var i = this.layers.length;

while (i--)
{
// Remove references to this class
this.layers[i].position = null;
this.layers[i].scale = null;
if (!this.layers[i].persist)
{
// Remove references to this class
this.layers[i].position = null;
this.layers[i].scale = null;
this.layers.slice(i, 1);
}
}

this.layers.length = 0;

},

/**
Expand Down Expand Up @@ -20951,12 +20960,19 @@ Phaser.FlexLayer = function (manager, position, bounds, scale) {
/**
* @property {Phaser.ScaleManager} scale - A reference to the ScaleManager.
*/
this.manager = manager;
this.manager = manager.manager;

/**
* @property {Phaser.FlexGrid} grid - A reference to the FlexGrid that owns this layer.
*/
this.grid = manager.grid;
this.grid = manager;

/**
* Should the FlexLayer remain through a State swap?
*
* @type {boolean}
*/
this.persist = false;

// Bound to the grid
this.position = position;
Expand Down
32 changes: 16 additions & 16 deletions build/custom/phaser-ninja-physics.min.js

Large diffs are not rendered by default.

46 changes: 31 additions & 15 deletions build/custom/phaser-no-libs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.1.0 "Cairhien" - Built: Tue Sep 09 2014 15:35:44
* v2.1.1 "Eianrod" - Built: Thu Sep 11 2014 10:37:16
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
Expand Down Expand Up @@ -50,7 +50,7 @@
*/
var Phaser = Phaser || {

VERSION: '2.1.0',
VERSION: '2.1.1',
GAMES: [],

AUTO: 0,
Expand Down Expand Up @@ -4865,6 +4865,8 @@ Phaser.StateManager.prototype = {

this.setCurrentState(this._pendingState);

this._pendingState = null;

if (this.onPreloadCallback)
{
this.game.load.reset();
Expand All @@ -4886,8 +4888,6 @@ Phaser.StateManager.prototype = {
// No init? Then there was nothing to load either
this.loadComplete();
}

this._pendingState = null;
}

},
Expand Down Expand Up @@ -9397,15 +9397,20 @@ Phaser.FlexGrid.prototype = {
* @param {array} [children] - An array of children that are used to populate the FlexLayer.
* @return {Phaser.FlexLayer} The Layer object.
*/
createFluidLayer: function (children) {
createFluidLayer: function (children, addToWorld) {

if (typeof addToWorld === 'undefined') { addToWorld = true; }

var layer = new Phaser.FlexLayer(this, this.positionFluid, this.boundsFluid, this.scaleFluid);

this.game.world.add(layer);
if (addToWorld)
{
this.game.world.add(layer);
}

this.layers.push(layer);

if (typeof children !== 'undefined')
if (typeof children !== 'undefined' && typeof children !== null)
{
layer.addMultiple(children);
}
Expand Down Expand Up @@ -9469,15 +9474,19 @@ Phaser.FlexGrid.prototype = {
*/
reset: function () {

for (var i = 0; i < this.layers.length; i++)
var i = this.layers.length;

while (i--)
{
// Remove references to this class
this.layers[i].position = null;
this.layers[i].scale = null;
if (!this.layers[i].persist)
{
// Remove references to this class
this.layers[i].position = null;
this.layers[i].scale = null;
this.layers.slice(i, 1);
}
}

this.layers.length = 0;

},

/**
Expand Down Expand Up @@ -9576,12 +9585,19 @@ Phaser.FlexLayer = function (manager, position, bounds, scale) {
/**
* @property {Phaser.ScaleManager} scale - A reference to the ScaleManager.
*/
this.manager = manager;
this.manager = manager.manager;

/**
* @property {Phaser.FlexGrid} grid - A reference to the FlexGrid that owns this layer.
*/
this.grid = manager.grid;
this.grid = manager;

/**
* Should the FlexLayer remain through a State swap?
*
* @type {boolean}
*/
this.persist = false;

// Bound to the grid
this.position = position;
Expand Down
8 changes: 4 additions & 4 deletions build/custom/phaser-no-libs.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 5b922be

Please sign in to comment.