mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 03:51:23 +01:00
Changed pack.cells.haven and pack.cells.harbor to use less memory
This commit is contained in:
parent
51c6704868
commit
d50dcc0614
1 changed files with 2 additions and 2 deletions
4
main.js
4
main.js
|
|
@ -1021,8 +1021,8 @@ function reMarkFeatures() {
|
||||||
const cells = pack.cells, features = pack.features = [0];
|
const cells = pack.cells, features = pack.features = [0];
|
||||||
cells.f = new Uint16Array(cells.i.length); // cell feature number
|
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.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.haven = cells.i.length < 65535 ? new Uint16Array(cells.i.length) : 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.harbor = new Uint8Array(cells.i.length); // cell harbor (number of adjacent water cells);
|
||||||
|
|
||||||
for (let i=1, queue=[0]; queue[0] !== -1; i++) {
|
for (let i=1, queue=[0]; queue[0] !== -1; i++) {
|
||||||
const start = queue[0]; // first cell
|
const start = queue[0]; // first cell
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue