mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.22.18
This commit is contained in:
parent
bf8d18937a
commit
e2e7f2e076
2 changed files with 3 additions and 3 deletions
4
main.js
4
main.js
|
|
@ -1139,13 +1139,13 @@ function rankCells() {
|
||||||
cells.s = new Int16Array(cells.i.length); // cell suitability array
|
cells.s = new Int16Array(cells.i.length); // cell suitability array
|
||||||
cells.pop = new Float32Array(cells.i.length); // cell population array
|
cells.pop = new Float32Array(cells.i.length); // cell population array
|
||||||
|
|
||||||
const flMean = d3.median(cells.fl.filter(f => f)), flMax = d3.max(cells.fl) + d3.max(cells.conf); // to normalize flux
|
const flMean = d3.median(cells.fl.filter(f => f)) || 0, flMax = d3.max(cells.fl) + d3.max(cells.conf); // to normalize flux
|
||||||
const areaMean = d3.mean(cells.area); // to adjust population by cell area
|
const areaMean = d3.mean(cells.area); // to adjust population by cell area
|
||||||
|
|
||||||
for (const i of cells.i) {
|
for (const i of cells.i) {
|
||||||
let s = +biomesData.habitability[cells.biome[i]]; // base suitability derived from biome habitability
|
let s = +biomesData.habitability[cells.biome[i]]; // base suitability derived from biome habitability
|
||||||
if (!s) continue; // uninhabitable biomes has 0 suitability
|
if (!s) continue; // uninhabitable biomes has 0 suitability
|
||||||
s += normalize(cells.fl[i] + cells.conf[i], flMean, flMax) * 250; // big rivers and confluences are valued
|
if (flMean) s += normalize(cells.fl[i] + cells.conf[i], flMean, flMax) * 250; // big rivers and confluences are valued
|
||||||
s -= (cells.h[i] - 50) / 5; // low elevation is valued, high is not;
|
s -= (cells.h[i] - 50) / 5; // low elevation is valued, high is not;
|
||||||
|
|
||||||
if (cells.t[i] === 1) {
|
if (cells.t[i] === 1) {
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ function regenerateBurgs() {
|
||||||
if (burgsTree.find(x, y, s) !== undefined) continue; // to close to existing burg
|
if (burgsTree.find(x, y, s) !== undefined) continue; // to close to existing burg
|
||||||
|
|
||||||
const state = cells.state[cell];
|
const state = cells.state[cell];
|
||||||
const capital = state > 0 ? !states[state].capital : 0; // if state doesn't have capital, make this burg a capital, no capital for neutral lands
|
const capital = state && !states[state].capital; // if state doesn't have capital, make this burg a capital, no capital for neutral lands
|
||||||
if (capital) {states[state].capital = id; states[state].center = cell;}
|
if (capital) {states[state].capital = id; states[state].center = cell;}
|
||||||
|
|
||||||
const culture = cells.culture[cell];
|
const culture = cells.culture[cell];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue