mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 18:11:24 +01:00
fix: redraw population on change
This commit is contained in:
parent
cf5e75b561
commit
8907cd62ec
6 changed files with 8 additions and 0 deletions
|
|
@ -485,6 +485,7 @@ function applyPopulationChange(oldRural, oldUrban, newRural, newUrban, culture)
|
||||||
burgs.forEach(b => (b.population = population));
|
burgs.forEach(b => (b.population = population));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layerIsOn("togglePopulation")) drawPopulation();
|
||||||
refreshCulturesEditor();
|
refreshCulturesEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -462,6 +462,7 @@ function changePopulation() {
|
||||||
burgs.forEach(b => (b.population = population));
|
burgs.forEach(b => (b.population = population));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layerIsOn("togglePopulation")) drawPopulation();
|
||||||
refreshReligionsEditor();
|
refreshReligionsEditor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -543,6 +543,7 @@ function changePopulation(stateId) {
|
||||||
burgs.forEach(b => (b.population = population));
|
burgs.forEach(b => (b.population = population));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layerIsOn("togglePopulation")) drawPopulation();
|
||||||
refreshStatesEditor();
|
refreshStatesEditor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -454,6 +454,7 @@ function editProvinces() {
|
||||||
p.burgs.forEach(b => (pack.burgs[b].population = population));
|
p.burgs.forEach(b => (pack.burgs[b].population = population));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layerIsOn("togglePopulation")) drawPopulation();
|
||||||
refreshProvincesEditor();
|
refreshProvincesEditor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,7 @@ function regenerateRivers() {
|
||||||
|
|
||||||
function recalculatePopulation() {
|
function recalculatePopulation() {
|
||||||
rankCells();
|
rankCells();
|
||||||
|
|
||||||
pack.burgs.forEach(b => {
|
pack.burgs.forEach(b => {
|
||||||
if (!b.i || b.removed || b.lock) return;
|
if (!b.i || b.removed || b.lock) return;
|
||||||
const i = b.cell;
|
const i = b.cell;
|
||||||
|
|
@ -144,6 +145,8 @@ function recalculatePopulation() {
|
||||||
if (b.port) b.population = b.population * 1.3; // increase port population
|
if (b.port) b.population = b.population * 1.3; // increase port population
|
||||||
b.population = rn(b.population * gauss(2, 3, 0.6, 20, 3), 3);
|
b.population = rn(b.population * gauss(2, 3, 0.6, 20, 3), 3);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (layerIsOn("togglePopulation")) drawPopulation();
|
||||||
}
|
}
|
||||||
|
|
||||||
function regenerateStates() {
|
function regenerateStates() {
|
||||||
|
|
|
||||||
|
|
@ -472,6 +472,7 @@ function editZones() {
|
||||||
burgs.forEach(b => (b.population = population));
|
burgs.forEach(b => (b.population = population));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layerIsOn("togglePopulation")) drawPopulation();
|
||||||
zonesEditorAddLines();
|
zonesEditorAddLines();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue