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.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