From 2e483bddc3c66aab0af9d4b80f5cacde42d4f041 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Thu, 16 Jul 2020 12:39:23 -0400 Subject: tilein.call corrected in fromfetch --- space.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/space.js b/space.js index 57df25f..6d09c1b 100644 --- a/space.js +++ b/space.js @@ -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]); } } -- cgit