Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/client/graphics/layers/RadialMenuElements.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -338,29 +343,24 @@ export const infoMenuElement: MenuElement = {
};

function getAllEnabledUnits(myPlayer: boolean, config: Config): Set<UnitType> {
const Units: Set<UnitType> = new Set<UnitType>();
const units: Set<UnitType> = new Set<UnitType>();

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[] = [
Expand Down
2 changes: 1 addition & 1 deletion src/core/game/PlayerImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ export class PlayerImpl implements Player {
canBuild !== false
? this.mg.railNetwork().computeGhostRailPaths(u, canBuild)
: [],
} as BuildableUnit;
};
});
}

Expand Down
Loading