Changeset - r26201:fc753b42fb89
[Not reviewed]
master
0 8 0
Tyler Trahan - 3 years ago 2022-03-11 16:50:43
tyler@tylertrahan.com
Feature: Allow disabling local authority control of company actions
8 files changed with 37 insertions and 14 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -1151,10 +1151,11 @@ STR_TERRAIN_TYPE_ALPINIST               
 
STR_TERRAIN_TYPE_CUSTOM                                         :Custom height
 
STR_TERRAIN_TYPE_CUSTOM_VALUE                                   :Custom height ({NUM})
 

	
 
###length 3
 
STR_CITY_APPROVAL_PERMISSIVE                                    :Permissive
 
###length 4
 
STR_CITY_APPROVAL_LENIENT                                       :Lenient
 
STR_CITY_APPROVAL_TOLERANT                                      :Tolerant
 
STR_CITY_APPROVAL_HOSTILE                                       :Hostile
 
STR_CITY_APPROVAL_PERMISSIVE                                    :Permissive (no effect on company actions)
 

	
 
STR_WARNING_NO_SUITABLE_AI                                      :{WHITE}No suitable AIs available...{}You can download several AIs via the 'Online Content' system
 

	
src/settings_type.h
Show inline comments
 
@@ -519,7 +519,7 @@ struct EconomySettings {
 
	bool   allow_town_roads;                 ///< towns are allowed to build roads (always allowed when generating world / in SE)
 
	TownFounding found_town;                 ///< town founding.
 
	bool   station_noise_level;              ///< build new airports when the town noise level is still within accepted limits
 
	uint16 town_noise_population[3];         ///< population to base decision on noise evaluation (@see town_council_tolerance)
 
	uint16 town_noise_population[4];         ///< population to base decision on noise evaluation (@see town_council_tolerance)
 
	bool   allow_town_level_crossings;       ///< towns are allowed to build level crossings
 
	bool   infrastructure_maintenance;       ///< enable monthly maintenance fee for owner infrastructure
 
};
src/station_cmd.cpp
Show inline comments
 
@@ -2258,7 +2258,7 @@ CommandCost CmdBuildAirport(DoCommandFla
 
			authority_refuse_message = STR_ERROR_LOCAL_AUTHORITY_REFUSES_NOISE;
 
			authority_refuse_town = nearest;
 
		}
 
	} else {
 
	} else if (_settings_game.difficulty.town_council_tolerance != TOWN_COUNCIL_PERMISSIVE) {
 
		Town *t = ClosestTownFromTile(tile, UINT_MAX);
 
		uint num = 0;
 
		for (const Station *st : Station::Iterate()) {
src/table/settings/difficulty_settings.ini
Show inline comments
 
@@ -265,11 +265,11 @@ from     = SLV_97
 
flags    = SF_GUI_DROPDOWN
 
def      = 0
 
min      = 0
 
max      = 2
 
max      = 3
 
interval = 1
 
str      = STR_CONFIG_SETTING_CITY_APPROVAL
 
strhelp  = STR_CONFIG_SETTING_CITY_APPROVAL_HELPTEXT
 
strval   = STR_CITY_APPROVAL_PERMISSIVE
 
strval   = STR_CITY_APPROVAL_LENIENT
 
post_cb  = DifficultyNoiseChange
 

	
 
[SDTG_VAR]
src/table/settings/economy_settings.ini
Show inline comments
 
@@ -284,6 +284,14 @@ min      = 800
 
max      = 65535
 
cat      = SC_EXPERT
 

	
 
[SDT_VAR]
 
var      = economy.town_noise_population[3]
 
type     = SLE_UINT16
 
def      = 400
 
min      = 100
 
max      = 65535
 
cat      = SC_EXPERT
 

	
 
[SDT_BOOL]
 
var      = economy.infrastructure_maintenance
 
from     = SLV_166
src/town.h
Show inline comments
 
@@ -152,6 +152,13 @@ void ExpandTown(Town *t);
 

	
 
void RebuildTownKdtree();
 

	
 
/** Settings for town council attitudes. */
 
enum TownCouncilAttitudes {
 
	TOWN_COUNCIL_LENIENT    = 0,
 
	TOWN_COUNCIL_TOLERANT   = 1,
 
	TOWN_COUNCIL_HOSTILE    = 2,
 
	TOWN_COUNCIL_PERMISSIVE = 3,
 
};
 

	
 
/**
 
 * Action types that a company must ask permission for to a town authority.
src/town_cmd.cpp
Show inline comments
 
@@ -675,7 +675,8 @@ static CommandCost ClearTile_Town(TileIn
 
	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(DoCommand
 
	/* 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
src/town_type.h
Show inline comments
 
@@ -56,16 +56,18 @@ enum Ratings {
 

	
 
	RATING_TUNNEL_BRIDGE_DOWN_STEP = -250, ///< penalty for removing town owned tunnel or bridge
 
	RATING_TUNNEL_BRIDGE_MINIMUM   =    0, ///< minimum rating after removing tunnel or bridge
 
	RATING_TUNNEL_BRIDGE_NEEDED_PERMISSIVE = 144, ///< rating needed, "Permissive" difficulty settings
 
	RATING_TUNNEL_BRIDGE_NEEDED_NEUTRAL    = 208, ///< "Neutral"
 
	RATING_TUNNEL_BRIDGE_NEEDED_HOSTILE    = 400, ///< "Hostile"
 
	RATING_TUNNEL_BRIDGE_NEEDED_LENIENT    =            144, ///< rating needed, "Lenient" difficulty settings
 
	RATING_TUNNEL_BRIDGE_NEEDED_NEUTRAL    =            208, ///< "Neutral"
 
	RATING_TUNNEL_BRIDGE_NEEDED_HOSTILE    =            400, ///< "Hostile"
 
	RATING_TUNNEL_BRIDGE_NEEDED_PERMISSIVE = RATING_MINIMUM, ///< "Permissive" (local authority disabled)
 

	
 
	RATING_ROAD_DOWN_STEP_INNER =  -50, ///< removing a roadpiece in the middle
 
	RATING_ROAD_DOWN_STEP_EDGE  =  -18, ///< removing a roadpiece at the edge
 
	RATING_ROAD_MINIMUM         = -100, ///< minimum rating after removing town owned road
 
	RATING_ROAD_NEEDED_PERMISSIVE =  16, ///< rating needed, "Permissive" difficulty settings
 
	RATING_ROAD_NEEDED_NEUTRAL    =  64, ///< "Neutral"
 
	RATING_ROAD_NEEDED_HOSTILE    = 112, ///< "Hostile"
 
	RATING_ROAD_NEEDED_LENIENT    =             16, ///< rating needed, "Lenient" difficulty settings
 
	RATING_ROAD_NEEDED_NEUTRAL    =             64, ///< "Neutral"
 
	RATING_ROAD_NEEDED_HOSTILE    =            112, ///< "Hostile"
 
	RATING_ROAD_NEEDED_PERMISSIVE = RATING_MINIMUM, ///< "Permissive" (local authority disabled)
 

	
 
	RATING_HOUSE_MINIMUM  = RATING_MINIMUM,
 

	
0 comments (0 inline, 0 general)