diff options
-rw-r--r-- | space.js | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -24,13 +24,14 @@ function Space(){ this.data = []; this.loc = []; // Coordinates to represent topleft location of spaces, and aid with .comb this.fromfetch = function(tiles, dimension, conform=true){ //tiles is straight from fetch/tileUpdate function, dimension is a min/max pair of y/x coordinates; conform is false for tileUpdate because the cell_props don't actually mean anything; all data is still included + // destroys tiles, I think. might cause bugs this.loc = vec.tileToChar(dimension[0]); for (let y=dimension[0][0]; y<=dimension[1][0]; y++){ for (let line=0; line<8; line++) this.data.push([]); // Adds lines for (let x=dimension[0][1]; x<=dimension[1][1]; x++){ - if (! tiles[[y,x]]) tilein({"content":' '.repeat(16*8),"properties":{"cell_props":{}}}); // Insert a null tile if server sends null - else tilein.call(this, tiles[[y,x]], y-dimension[0][0]); + if (!tiles[[y,x]]) tiles[[y,x]] = {"content":' '.repeat(16*8),"properties":{"cell_props":{}}}; + tilein.call(this, tiles[[y,x]], y-dimension[0][0]); } } |