refactor: specify burgs fixes

This commit is contained in:
max 2022-08-07 00:31:59 +03:00
parent 7f57c9af65
commit 8c741a559e
6 changed files with 34 additions and 19 deletions

View file

@ -25,6 +25,7 @@ export function specifyBurgs(
vertices: IGraphVertices,
cultures: TCultures,
states: TStatesReturn,
rivers: Omit<IRiver, "name" | "basin" | "type">[],
cells: Pick<IPack["cells"], "v" | "p" | "g" | "h" | "f" | "haven" | "harbor" | "s" | "biome" | "fl" | "r">
): TBurgs {
TIME && console.time("specifyBurgs");
@ -102,7 +103,11 @@ export function specifyBurgs(
if (haven && (waterBody as TPackFeature).type === "lake") return "Lake";
if (cells.h[cellId] > ELEVATION.FOOTHILLS) return "Highland";
if (cells.r[cellId] && rivers[cellId].length > 100) return "River";
if (cells.r[cellId]) {
const river = rivers.find(river => river.i === cellId);
if (river && river.length > 100) return "River";
}
if (population < 6) {
const biome = cells.biome[cellId];