Feature: Allow disabling local authority control of company actions

This commit is contained in:
Tyler Trahan
2022-03-11 09:50:43 -07:00
committed by Michael Lutz
parent 8537fa7206
commit f92cf38ab5
8 changed files with 37 additions and 14 deletions

View File

@@ -675,7 +675,8 @@ static CommandCost ClearTile_Town(TileIndex tile, DoCommandFlag flags)
Town *t = Town::GetByTile(tile);
if (Company::IsValidID(_current_company)) {
if (rating > t->ratings[_current_company] && !(flags & DC_NO_TEST_TOWN_RATING) && !_cheats.magic_bulldozer.value) {
if (rating > t->ratings[_current_company] && !(flags & DC_NO_TEST_TOWN_RATING) &&
!_cheats.magic_bulldozer.value && _settings_game.difficulty.town_council_tolerance != TOWN_COUNCIL_PERMISSIVE) {
SetDParam(0, t->index);
return_cmd_error(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS);
}
@@ -3527,6 +3528,9 @@ static void UpdateTownUnwanted(Town *t)
*/
CommandCost CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags)
{
/* The required rating is hardcoded to RATING_VERYPOOR (see below), not the authority attitude setting, so we can bail out like this. */
if (_settings_game.difficulty.town_council_tolerance == TOWN_COUNCIL_PERMISSIVE) return CommandCost();
if (!Company::IsValidID(_current_company) || (flags & DC_NO_TEST_TOWN_RATING)) return CommandCost();
Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
@@ -3691,9 +3695,10 @@ CommandCost CheckforTownRating(DoCommandFlag flags, Town *t, TownRatingCheckType
/* minimum rating needed to be allowed to remove stuff */
static const int needed_rating[][TOWN_RATING_CHECK_TYPE_COUNT] = {
/* ROAD_REMOVE, TUNNELBRIDGE_REMOVE */
{ RATING_ROAD_NEEDED_PERMISSIVE, RATING_TUNNEL_BRIDGE_NEEDED_PERMISSIVE}, // Permissive
{ RATING_ROAD_NEEDED_LENIENT, RATING_TUNNEL_BRIDGE_NEEDED_LENIENT}, // Lenient
{ RATING_ROAD_NEEDED_NEUTRAL, RATING_TUNNEL_BRIDGE_NEEDED_NEUTRAL}, // Neutral
{ RATING_ROAD_NEEDED_HOSTILE, RATING_TUNNEL_BRIDGE_NEEDED_HOSTILE}, // Hostile
{ RATING_ROAD_NEEDED_PERMISSIVE, RATING_TUNNEL_BRIDGE_NEEDED_PERMISSIVE}, // Permissive
};
/* check if you're allowed to remove the road/bridge/tunnel