1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-20 02:42:42 +01:00

Add: Show height difference in bridge is too low error message. (#14614)

This commit is contained in:
Rito12
2025-10-24 22:27:11 +02:00
committed by GitHub
parent 6ebe64703f
commit 70bf84175f
3 changed files with 15 additions and 10 deletions

View File

@@ -365,7 +365,8 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlags
for (LockPart lock_part = LOCK_PART_MIDDLE; TileIndex t : {tile, tile - delta, tile + delta}) {
if (IsBridgeAbove(t) && GetBridgeHeight(GetSouthernBridgeEnd(t)) < GetTileMaxZ(t) + GetLockPartMinimalBridgeHeight(lock_part)) {
return CommandCost(STR_ERROR_BRIDGE_TOO_LOW_FOR_LOCK);
int height_diff = (GetTileMaxZ(tile) + GetLockPartMinimalBridgeHeight(lock_part) - GetBridgeHeight(GetSouthernBridgeEnd(t))) * TILE_HEIGHT_STEP;
return CommandCostWithParam(STR_ERROR_BRIDGE_TOO_LOW_FOR_LOCK, height_diff);
}
++lock_part;
}
@@ -1445,7 +1446,8 @@ static CommandCost CheckBuildAbove_Water(TileIndex tile, DoCommandFlags flags, A
if (IsWater(tile) || IsCoast(tile)) return CommandCost();
if (IsLock(tile)) {
if (GetTileMaxZ(tile) + GetLockPartMinimalBridgeHeight(GetLockPart(tile)) <= height) return CommandCost();
return CommandCost(STR_ERROR_BRIDGE_TOO_LOW_FOR_LOCK);
int height_diff = (GetTileMaxZ(tile) + GetLockPartMinimalBridgeHeight(GetLockPart(tile)) - height) * TILE_HEIGHT_STEP;
return CommandCostWithParam(STR_ERROR_BRIDGE_TOO_LOW_FOR_LOCK, height_diff);
}
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
}