From 66e6fdf2cbd46f7638344d7c12e2de19a372598b Mon Sep 17 00:00:00 2001 From: Rob Walch Date: Fri, 22 Mar 2013 20:28:42 -0400 Subject: [PATCH] Map Export #61 invisible map boundaries - parse objects in map data bounds array --- app/scripts/models/World.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/app/scripts/models/World.js b/app/scripts/models/World.js index 9008da2..7a3fb29 100644 --- a/app/scripts/models/World.js +++ b/app/scripts/models/World.js @@ -87,21 +87,18 @@ for (j=elements.length; j-- > 0;) { if (elements[j].mapType === 'entity') { entities.push(elements.splice(j, 1)[0]); + } else if (elements[j].depth < 0) { + //negative depth implies impassable bounds + bounds.push(elements.splice(j, 1)[0]); } else { var mapElement = this.initMapElement(elements[j]); if (mapElement) { - //negative depth implies impassable bounds - if (mapElement.depth < 0) { - elements.splice(j, 1); - bounds.push(mapElement); - } else { - mapElement.layerNum = i; - mapElement.visible = !!mapElement.image || !!mapElement.children; - this.addMapElement(mapElement); + mapElement.layerNum = i; + mapElement.visible = !!mapElement.image || !!mapElement.children; + this.addMapElement(mapElement); - // ew! updating the data we're parsing - elements[j] = mapElement; - } + // ew! updating the data we're parsing + elements[j] = mapElement; } } } @@ -121,7 +118,7 @@ for (i=bounds.length; i-- > 0;) { boundsElement = bounds[i]; console.log('Map Bounds', boundsElement); - this.addMapElement(boundsElement); + this.addMapElement(this.initMapElement(boundsElement)); } this.map = data; },