summaryrefslogtreecommitdiff
path: root/src/tunnelbridge_cmd.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-03-13 15:33:07 +0000
committeralberth <alberth@openttd.org>2010-03-13 15:33:07 +0000
commit6b6ff9c52b04ec47de1281284fcc99f6775f2302 (patch)
tree303ab0e7deed7d7293218566146fa6b60387de73 /src/tunnelbridge_cmd.cpp
parent7134201524f61ce4234c476fe2d8c16eec4f391e (diff)
downloadopenttd-6b6ff9c52b04ec47de1281284fcc99f6775f2302.tar.xz
(svn r19400) -Codechange: CheckforTownRating returns a CommandCost.
Diffstat (limited to 'src/tunnelbridge_cmd.cpp')
-rw-r--r--src/tunnelbridge_cmd.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index aefb074d3..a5d724108 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -638,10 +638,9 @@ static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags)
/* Check if you are allowed to remove the tunnel owned by a town
* Removal depends on difficulty settings */
- if (!CheckforTownRating(flags, t, TUNNELBRIDGE_REMOVE)) {
- SetDParam(0, t->index);
- return_cmd_error(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS);
- }
+ CommandCost ret = CheckforTownRating(flags, t, TUNNELBRIDGE_REMOVE);
+ ret.SetGlobalErrorMessage();
+ if (ret.Failed()) return ret;
}
/* checks if the owner is town then decrease town rating by RATING_TUNNEL_BRIDGE_DOWN_STEP until
@@ -706,10 +705,9 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags)
/* Check if you are allowed to remove the bridge owned by a town
* Removal depends on difficulty settings */
- if (!CheckforTownRating(flags, t, TUNNELBRIDGE_REMOVE)) {
- SetDParam(0, t->index);
- return_cmd_error(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS);
- }
+ CommandCost ret = CheckforTownRating(flags, t, TUNNELBRIDGE_REMOVE);
+ ret.SetGlobalErrorMessage();
+ if (ret.Failed()) return ret;
}
/* checks if the owner is town then decrease town rating by RATING_TUNNEL_BRIDGE_DOWN_STEP until