From 2f43694ecb244bbd4a9855b338a56c68bb9cccee Mon Sep 17 00:00:00 2001 From: evolvedexperiment <55178666+evolvedexperiment@users.noreply.github.com> Date: Fri, 29 Nov 2019 15:33:06 +0200 Subject: [PATCH] Fixes for 60k+ maps, removed contest message. (#379) * Fixes for 60k+ maps, removed contest message * Changed pack.cells.haven and pack.cells.harbor to use less memory --- main.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/main.js b/main.js index c9d25dca..26231dda 100644 --- a/main.js +++ b/main.js @@ -332,11 +332,6 @@ function showWelcomeMessage() {

* It's recommended to regenerate rivers to get clean data for Rivers Overview.

-

We are happy to invite you to participate in our first map making contest! - Valuable prizes for winners and our respect for all participants. - See ${link("https://www.reddit.com/r/FantasyMapGenerator/comments/dn2sqv/azgaars_fantasy_map_generator_mapmaking_contest/", "Reddit post")} for the details.

- -

Join our ${reddit} and ${discord} to ask questions, share maps, discuss the Generator, report bugs and propose new features.

Thanks for all supporters on ${patreon}!

`; $("#alert").dialog( @@ -981,7 +976,7 @@ function drawCoastline() { // connect vertices to chain function connectVertices(start, t) { const chain = []; // vertices chain to form a path - for (let i=0, current = start; i === 0 || current !== start && i < 10000; i++) { + for (let i=0, current = start; i === 0 || current !== start && i < 50000; i++) { const prev = chain[chain.length-1]; // previous vertex in chain //d3.select("#labels").append("text").attr("x", vertices.p[current][0]).attr("y", vertices.p[current][1]).text(i).attr("font-size", "1px"); chain.push(current); // add current vertex to sequence @@ -1026,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 Uint16Array(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