buildableUnits perf and related refactor of StructureTypes/IsStructureType

This commit is contained in:
VariableVince
2026-02-13 00:31:08 +01:00
parent bd96bcca0d
commit a9fa5d9780
8 changed files with 57 additions and 38 deletions
@@ -5,7 +5,6 @@ import {
Player,
PlayerType,
Relation,
StructureTypes,
Unit,
UnitType,
} from "../../game/Game";
@@ -347,7 +346,7 @@ export class NationStructureBehavior {
*/
private getTotalStructureDensity(): number {
let totalStructures = 0;
for (const type of StructureTypes) {
for (const type of this.game.getStructureTypes()) {
totalStructures += this.player.units(type).length; // ignoring levels
}
const tilesOwned = this.player.numTilesOwned();