aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-01-24 12:29:40 -0500
committerHolden Rohrer <hr@hrhr.dev>2020-01-24 12:29:40 -0500
commita9e6a234abd6f04c76c0005aa9306db6da1b68d8 (patch)
tree0354d1308d5e38d56b9226233af23dfd41574e58
parent5073176e74f6295307850bdcf36f7fa4f2dfe658 (diff)
made protectArea more efficient
jarvis now calls every protection update with the same movement instead of tile-by-tile, which would delay parts of the protection by a second
-rw-r--r--examples/jarvis.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/jarvis.js b/examples/jarvis.js
index d76066d..ca58f8b 100644
--- a/examples/jarvis.js
+++ b/examples/jarvis.js
@@ -89,14 +89,16 @@ function timect(){
}
function protectArea(send, tiles, locs, id, space, ctrl){
+ let writelist = [];
for (let loc of locs){
let tile = tiles[loc];
// Write diffs from the tile
let diff = space.copy(); // Acts as a window for tile (only see relevant data)
diff.comb(tile, comb.flip(comb.unmask));
diff.comb(tile, comb.sub);
- writes.enqueue(diff.towrite())
+ writelist.push(...diff.towrite())
}
+ writes.enqueue(writelist);
}
var search = new Space();