aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-07-16 12:39:23 -0400
committerHolden Rohrer <hr@hrhr.dev>2020-07-16 12:39:23 -0400
commit2e483bddc3c66aab0af9d4b80f5cacde42d4f041 (patch)
treedda9c44f5352fc2099cdea4fe7585c89e7ded6a5
parent1eefea00737117706bb6cca5a2882cb2e081d5ab (diff)
tilein.call corrected in fromfetch
-rw-r--r--space.js5
1 files 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]);
}
}