From 940dcce9582a537b6c1a08dd08e04221b6fcf696 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Fri, 27 Dec 2019 02:17:11 -0500 Subject: repaired space.comb --- space.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'space.js') diff --git a/space.js b/space.js index 4159fc9..d94a212 100644 --- a/space.js +++ b/space.js @@ -101,12 +101,13 @@ function Space(){ } if (offset[1] < 0) offset[1] = 0; - // Iterate over other.data and add to this.data + // Parse over all relevant tiles and process them into usable chars (this.data is all relevant tiles due to padding) while (this.data.length < offset[0]+other.data.length) this.data.push([]); // Row padding for (let row = 0; row < this.data.length; row++){ - while (this.data[row].length < offset[1]+other.data[row+offset[0]].length) thisrow.push(''); // Character-wise padding + let otherrow = other.data[row-offset[0]] || []; + while (this.data[row].length < offset[1]+otherrow.length) this.data[row].push(''); // Character-wise padding for (let chr = 0; chr < this.data[row].length; chr++){ - thisrow[chr] = func(thisrow[chr], other.data[row+offset[0]][chr+offset[1]] || ''); + this.data[row][chr] = func(this.data[row][chr], otherrow[chr-offset[1]] || ''); } } } -- cgit