(svn r19400) -Codechange: CheckforTownRating returns a CommandCost.

This commit is contained in:
alberth
2010-03-13 15:33:07 +00:00
parent 7134201524
commit 6b6ff9c52b
4 changed files with 21 additions and 15 deletions

View File

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