From a9e6a234abd6f04c76c0005aa9306db6da1b68d8 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Fri, 24 Jan 2020 12:29:40 -0500 Subject: 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 --- examples/jarvis.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); -- cgit