From d50dcc06143948ebed066e4f8152147cc221664e Mon Sep 17 00:00:00 2001 From: Evolvedexperiment Date: Fri, 29 Nov 2019 13:23:40 +0000 Subject: [PATCH] Changed pack.cells.haven and pack.cells.harbor to use less memory --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index c335516d..26231dda 100644 --- a/main.js +++ b/main.js @@ -1021,8 +1021,8 @@ function reMarkFeatures() { const cells = pack.cells, features = pack.features = [0]; cells.f = new Uint16Array(cells.i.length); // cell feature number cells.t = new Int16Array(cells.i.length); // cell type: 1 = land along coast; -1 = water along coast; - cells.haven = new Uint32Array(cells.i.length); // cell haven (opposite water cell); - cells.harbor = new Uint16Array(cells.i.length); // cell harbor (number of adjacent water cells); + cells.haven = cells.i.length < 65535 ? new Uint16Array(cells.i.length) : new Uint32Array(cells.i.length);// cell haven (opposite water cell); + cells.harbor = new Uint8Array(cells.i.length); // cell harbor (number of adjacent water cells); for (let i=1, queue=[0]; queue[0] !== -1; i++) { const start = queue[0]; // first cell