bugfix: have radial menu check canBuild when checking if boating allowed

This commit is contained in:
evan
2025-04-22 08:15:21 -07:00
parent fd0279cdf4
commit cee06c82db
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -380,7 +380,8 @@ export class RadialMenu implements Layer {
}); });
} }
if ( if (
actions.buildableUnits.some((bu) => bu.type == UnitType.TransportShip) actions.buildableUnits.find((bu) => bu.type == UnitType.TransportShip)
?.canBuild
) { ) {
this.activateMenuElement(Slot.Boat, "#3f6ab1", boatIcon, () => { this.activateMenuElement(Slot.Boat, "#3f6ab1", boatIcon, () => {
// BestTransportShipSpawn is an expensive operation, so // BestTransportShipSpawn is an expensive operation, so
+2 -2
View File
@@ -43,7 +43,7 @@ import { andFN, manhattanDistFN, TileRef } from "./GameMap";
import { AttackUpdate, GameUpdateType, PlayerUpdate } from "./GameUpdates"; import { AttackUpdate, GameUpdateType, PlayerUpdate } from "./GameUpdates";
import { TerraNulliusImpl } from "./TerraNulliusImpl"; import { TerraNulliusImpl } from "./TerraNulliusImpl";
import { import {
bestShoreDeploymentSource as bestTranpsortShipSpawn, bestShoreDeploymentSource,
canBuildTransportShip, canBuildTransportShip,
} from "./TransportShipUtils"; } from "./TransportShipUtils";
import { UnitImpl } from "./UnitImpl"; import { UnitImpl } from "./UnitImpl";
@@ -1017,7 +1017,7 @@ export class PlayerImpl implements Player {
} }
bestTransportShipSpawn(targetTile: TileRef): TileRef | false { bestTransportShipSpawn(targetTile: TileRef): TileRef | false {
return bestTranpsortShipSpawn(this.mg, this, targetTile); return bestShoreDeploymentSource(this.mg, this, targetTile);
} }
// It's a probability list, so if an element appears twice it's because it's // It's a probability list, so if an element appears twice it's because it's