diff options
author | alberth <alberth@openttd.org> | 2010-03-13 17:11:28 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-03-13 17:11:28 +0000 |
commit | 7cc68f493d10ed81d24b9e7a0e9631436643869f (patch) | |
tree | 1f7fef2560b9bc81461bd8f17f21bdc1d80c2a91 /src/tunnelbridge_cmd.cpp | |
parent | 19afc9fdc0f009c93f31ea8fccdf95ce1372cc58 (diff) | |
download | openttd-7cc68f493d10ed81d24b9e7a0e9631436643869f.tar.xz |
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
Diffstat (limited to 'src/tunnelbridge_cmd.cpp')
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 12 |
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(); } |