This commit is contained in:
Azgaar 2019-10-03 00:48:33 +03:00
parent 481d7da4e6
commit 8ff1fe46b8
9 changed files with 31 additions and 28 deletions

View file

@ -393,7 +393,7 @@ function editZones() {
});
function applyPopulationChange() {
const ruralChange = rn(ruralPop.value / rural, 4);
const ruralChange = ruralPop.value / rural;
if (isFinite(ruralChange) && ruralChange !== 1) {
cells.forEach(i => pack.cells.pop[i] *= ruralChange);
}
@ -403,13 +403,13 @@ function editZones() {
cells.forEach(i => pack.cells.pop[i] = pop);
}
const urbanChange = rn(urbanPop.value / urban, 4);
const urbanChange = urbanPop.value / urban;
if (isFinite(urbanChange) && urbanChange !== 1) {
burgs.forEach(b => b.population *= urbanChange);
burgs.forEach(b => b.population = rn(b.population * urbanChange, 4));
}
if (!isFinite(urbanChange) && +urbanPop.value > 0) {
const points = urbanPop.value / populationRate.value / urbanization.value;
const population = rn(points / burgs.length);
const population = rn(points / burgs.length, 4);
burgs.forEach(b => b.population = population);
}