mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 05:58:30 +00:00
Remove dead code (commented out).
Add flag to detect when an 'internal layer' is not needed (none of the specified tileset is used in the parent layer) and skip creating one.
This commit is contained in:
parent
f9ff1d10c5
commit
70f95d2558
1 changed files with 10 additions and 14 deletions
|
@ -316,20 +316,6 @@ Phaser.Tilemap.prototype = {
|
|||
if (this.tilesets[idx])
|
||||
{
|
||||
this.tilesets[idx].setImage(img);
|
||||
|
||||
// create an empty layer for the map parts corresponding to this tileset
|
||||
// if ( !this.tilesetLayers )
|
||||
// {
|
||||
// // for the first tileset, don't create a layer because createLayer will be called to do that
|
||||
// this.tilesetLayers = [];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // for all the rest, go ahead and make a (currently) blank layer
|
||||
// // name, width, height, tileWidth, tileHeight, group
|
||||
// this.tilesetLayers.push( this.createBlankLayer( "_internal" + this.tilesetLayers.length.toString() ) );
|
||||
// }
|
||||
|
||||
return this.tilesets[idx];
|
||||
}
|
||||
else
|
||||
|
@ -688,6 +674,7 @@ Phaser.Tilemap.prototype = {
|
|||
|
||||
var row;
|
||||
var output = [];
|
||||
var emptyFlag = true;
|
||||
|
||||
for (var y = 0; y < height; y++)
|
||||
{
|
||||
|
@ -705,6 +692,9 @@ Phaser.Tilemap.prototype = {
|
|||
// is it one of the ones we want to move?
|
||||
if (ts === tileset)
|
||||
{
|
||||
// this layer does have some content...
|
||||
emptyFlag = false;
|
||||
|
||||
// move the tile to this new layer
|
||||
row.push(tile);
|
||||
|
||||
|
@ -721,6 +711,12 @@ Phaser.Tilemap.prototype = {
|
|||
output.push(row);
|
||||
}
|
||||
|
||||
if ( emptyFlag )
|
||||
{
|
||||
// none of those tiles are used in this layer, so we don't actually need it
|
||||
return;
|
||||
}
|
||||
|
||||
layer.data = output;
|
||||
|
||||
this.layers.push(layer);
|
||||
|
|
Loading…
Add table
Reference in a new issue