burg check added to unitUtils population conversion

This commit is contained in:
kruschen 2024-08-26 21:00:05 +00:00
parent 7519ed097e
commit c3dd1d9e6f

View file

@ -1,6 +1,7 @@
import {rn} from "./numberUtils";
import {findCell, findGridCell} from "./graphUtils";
import {getInputNumber, getInputValue} from "./nodeUtils";
import { isBurg } from "./typeUtils";
// ***
// SI
@ -136,7 +137,8 @@ export function getBurgPopulationPoints(burgPopulationValue: number) {
export function getCellPopulation(cellId: number) {
const rural = getRuralPopulation(pack.cells.pop[cellId]);
const burgId = pack.cells.burg[cellId];
const urban = burgId ? getBurgPopulation(pack.burgs[burgId].population) : 0;
const burg = pack.burgs[burgId];
const urban = isBurg(burg) ? getBurgPopulation(burg.population) : 0;
return [rural, urban];
}