mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Fix rural population calculation to only count small burgs
Rural population now correctly counted only from burgs with ≤100 people. Eliminates double-counting and ensures consistent statistics across charts and CSV exports.
This commit is contained in:
parent
e669549390
commit
8ec53293b7
2 changed files with 17 additions and 6 deletions
|
|
@ -672,7 +672,14 @@ function getUrbanPopulation(cellId) {
|
|||
}
|
||||
|
||||
function getRuralPopulation(cellId) {
|
||||
return pack.cells.pop[cellId] * populationRate;
|
||||
const burgId = pack.cells.burg[cellId];
|
||||
if (!burgId) return 0; // No burg = no rural population
|
||||
|
||||
const burgPopulation = pack.burgs[burgId].population;
|
||||
if (burgPopulation > 0.1) return 0; // Burg has >100 people = no rural population
|
||||
|
||||
// Small burg (≤100 people) = count the burg's actual population as rural
|
||||
return burgPopulation * 1000 * populationRate;
|
||||
}
|
||||
|
||||
function sortData(data, sorting) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue