diff --git a/src/client/graphics/layers/RadialMenuElements.ts b/src/client/graphics/layers/RadialMenuElements.ts index 1eb35d3644..23ea02fe4b 100644 --- a/src/client/graphics/layers/RadialMenuElements.ts +++ b/src/client/graphics/layers/RadialMenuElements.ts @@ -1,5 +1,10 @@ import { Config } from "../../../core/configuration/Config"; -import { AllPlayers, PlayerActions, UnitType } from "../../../core/game/Game"; +import { + AllPlayers, + PlayerActions, + StructureTypes, + UnitType, +} from "../../../core/game/Game"; import { TileRef } from "../../../core/game/GameMap"; import { GameView, PlayerView } from "../../../core/game/GameView"; import { Emoji, flattenedEmojiTable } from "../../../core/Util"; @@ -338,29 +343,24 @@ export const infoMenuElement: MenuElement = { }; function getAllEnabledUnits(myPlayer: boolean, config: Config): Set { - const Units: Set = new Set(); + const units: Set = new Set(); - const addStructureIfEnabled = (unitType: UnitType) => { + const addIfEnabled = (unitType: UnitType) => { if (!config.isUnitDisabled(unitType)) { - Units.add(unitType); + units.add(unitType); } }; if (myPlayer) { - addStructureIfEnabled(UnitType.City); - addStructureIfEnabled(UnitType.DefensePost); - addStructureIfEnabled(UnitType.Port); - addStructureIfEnabled(UnitType.MissileSilo); - addStructureIfEnabled(UnitType.SAMLauncher); - addStructureIfEnabled(UnitType.Factory); + StructureTypes.forEach(addIfEnabled); } else { - addStructureIfEnabled(UnitType.Warship); - addStructureIfEnabled(UnitType.HydrogenBomb); - addStructureIfEnabled(UnitType.MIRV); - addStructureIfEnabled(UnitType.AtomBomb); + addIfEnabled(UnitType.Warship); + addIfEnabled(UnitType.HydrogenBomb); + addIfEnabled(UnitType.MIRV); + addIfEnabled(UnitType.AtomBomb); } - return Units; + return units; } const ATTACK_UNIT_TYPES: UnitType[] = [ diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 7cb6e689cd..e4bc3c7c9f 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -997,7 +997,7 @@ export class PlayerImpl implements Player { canBuild !== false ? this.mg.railNetwork().computeGhostRailPaths(u, canBuild) : [], - } as BuildableUnit; + }; }); }