summaryrefslogtreecommitdiff
path: root/src/tunnelbridge_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tunnelbridge_cmd.cpp')
-rw-r--r--src/tunnelbridge_cmd.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 654a5db3e..5bf567eda 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -613,12 +613,18 @@ static inline CommandCost CheckAllowRemoveTunnelBridge(TileIndex tile)
if (road_owner == OWNER_NONE || road_owner == OWNER_TOWN) road_owner = _current_company;
if (tram_owner == OWNER_NONE) tram_owner = _current_company;
- return (CheckOwnership(road_owner, tile) && CheckOwnership(tram_owner, tile)) ? CommandCost() : CMD_ERROR;
+ CommandCost ret = CheckOwnership(road_owner, tile);
+ if (ret.Succeeded()) ret = CheckOwnership(tram_owner, tile);
+ ret.SetGlobalErrorMessage();
+ return ret;
}
case TRANSPORT_RAIL:
- case TRANSPORT_WATER:
- return CheckOwnership(GetTileOwner(tile)) ? CommandCost() : CMD_ERROR;
+ case TRANSPORT_WATER: {
+ CommandCost ret = CheckOwnership(GetTileOwner(tile));
+ ret.SetGlobalErrorMessage();
+ return ret;
+ }
default: NOT_REACHED();
}