diff options
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r-- | src/town_cmd.cpp | 13 |
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); } |