summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-02-27 17:42:55 +0000
committeralberth <alberth@openttd.org>2010-02-27 17:42:55 +0000
commit566f87b2deca7c08582e0ed59d173b9c71304e0b (patch)
tree4af48cec0b1bdd5694716d30717a78415caf1163 /src/town_cmd.cpp
parente338c26504680156df196c10279c05342a2b76f6 (diff)
downloadopenttd-566f87b2deca7c08582e0ed59d173b9c71304e0b.tar.xz
(svn r19279) -Codechange: CheckIfAuthorityAllowsNewStation() returns CommandCost.
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 7543c63e0..28c2fe032 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -2662,20 +2662,19 @@ static void UpdateTownUnwanted(Town *t)
* Checks whether the local authority allows construction of a new station (rail, road, airport, dock) on the given tile
* @param tile The tile where the station shall be constructed.
* @param flags Command flags. DC_NO_TEST_TOWN_RATING is tested.
+ * @return Succeeded or failed command.
*/
-bool CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags)
+CommandCost CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags)
{
- if (!Company::IsValidID(_current_company) || (flags & DC_NO_TEST_TOWN_RATING)) return true;
+ if (!Company::IsValidID(_current_company) || (flags & DC_NO_TEST_TOWN_RATING)) return CommandCost();
Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
- if (t == NULL) return true;
+ if (t == NULL) return CommandCost();
- if (t->ratings[_current_company] > RATING_VERYPOOR) return true;
+ if (t->ratings[_current_company] > RATING_VERYPOOR) return CommandCost();
- _error_message = STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS;
SetDParam(0, t->index);
-
- return false;
+ return_cmd_error(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS);
}