Add: new town council "indifferent" attitude

Closes: #184
pull/217/head
Yourself 4 years ago committed by Jonathan G Rennison
parent ed9410aba9
commit 310bb876a2

@ -1123,6 +1123,7 @@ STR_TERRAIN_TYPE_HILLY :Hilly
STR_TERRAIN_TYPE_MOUNTAINOUS :Mountainous
STR_TERRAIN_TYPE_ALPINIST :Alpinist
STR_CITY_APPROVAL_INDIFFERENT :Indifferent
STR_CITY_APPROVAL_PERMISSIVE :Permissive
STR_CITY_APPROVAL_TOLERANT :Tolerant
STR_CITY_APPROVAL_HOSTILE :Hostile

@ -1123,6 +1123,7 @@ STR_TERRAIN_TYPE_HILLY :언덕
STR_TERRAIN_TYPE_MOUNTAINOUS :산
STR_TERRAIN_TYPE_ALPINIST :매우 험한 산지
STR_CITY_APPROVAL_INDIFFERENT :무관심
STR_CITY_APPROVAL_PERMISSIVE :신경 안씀
STR_CITY_APPROVAL_TOLERANT :신경 씀
STR_CITY_APPROVAL_HOSTILE :싫어함

@ -2304,6 +2304,8 @@ uint8 GetAirportNoiseLevelForDistance(const AirportSpec *as, uint distance)
* So no need to go any further*/
if (as->noise_level < 2) return as->noise_level;
if (_settings_game.difficulty.town_council_tolerance == TOWN_COUNCIL_INDIFFERENT) return 1;
/* The steps for measuring noise reduction are based on the "magical" (and arbitrary) 8 base distance
* adding the town_council_tolerance 4 times, as a way to graduate, depending of the tolerance.
* Basically, it says that the less tolerant a town is, the bigger the distance before

@ -106,6 +106,13 @@ static const SettingDescEnumEntry _linkgraph_mode_per_cargo[] = {
{ DT_ASYMMETRIC_NEAR, STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC_NEAREST },
{ 0, STR_NULL }
};
static const SettingDescEnumEntry _town_council_approval[] = {
{ 255, STR_CITY_APPROVAL_INDIFFERENT },
{ 0, STR_CITY_APPROVAL_PERMISSIVE },
{ 1, STR_CITY_APPROVAL_TOLERANT },
{ 2, STR_CITY_APPROVAL_HOSTILE },
{ 0, STR_NULL }
};
static const SettingDescEnumEntry _train_braking_model[] = {
{ TBM_ORIGINAL, STR_CONFIG_SETTING_ORIGINAL },
@ -375,19 +382,15 @@ str = STR_CONFIG_SETTING_DISASTERS
strhelp = STR_CONFIG_SETTING_DISASTERS_HELPTEXT
cat = SC_BASIC
[SDT_VAR]
[SDT_ENUM]
base = GameSettings
var = difficulty.town_council_tolerance
type = SLE_UINT8
from = SLV_97
guiflags = SGF_MULTISTRING
def = 0
min = 0
max = 2
interval = 1
enumlist = _town_council_approval
str = STR_CONFIG_SETTING_CITY_APPROVAL
strhelp = STR_CONFIG_SETTING_CITY_APPROVAL_HELPTEXT
strval = STR_CITY_APPROVAL_PERMISSIVE
proc = DifficultyNoiseChange
[SDT_BOOL]

@ -38,6 +38,8 @@ static const uint TOWN_GROWTH_DESERT = 0xFFFFFFFF; ///< The town needs the cargo
static const uint16 TOWN_GROWTH_RATE_NONE = 0xFFFF; ///< Special value for Town::growth_rate to disable town growth.
static const uint16 MAX_TOWN_GROWTH_TICKS = 930; ///< Max amount of original town ticks that still fit into uint16, about equal to UINT16_MAX / TOWN_GROWTH_TICKS but slightly less to simplify calculations
static const byte TOWN_COUNCIL_INDIFFERENT = 0xFF;
typedef Pool<Town, TownID, 64, 64000> TownPool;
extern TownPool _town_pool;
@ -148,7 +150,7 @@ struct Town : TownPool::PoolItem<&_town_pool> {
*/
inline uint16 MaxTownNoise() const
{
if (this->cache.population == 0) return 0; // no population? no noise
if (this->cache.population == 0 || _settings_game.difficulty.town_council_tolerance == TOWN_COUNCIL_INDIFFERENT) return 0; // no population? no noise
/* 3 is added (the noise of the lowest airport), so the user can at least build a small airfield. */
return (this->cache.population / _settings_game.economy.town_noise_population[_settings_game.difficulty.town_council_tolerance]) + 3;

@ -809,7 +809,10 @@ 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_INDIFFERENT) {
SetDParam(0, t->index);
return_cmd_error(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS);
}
@ -3886,7 +3889,7 @@ CommandCost CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags
Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
if (t == nullptr) return CommandCost();
if (t->ratings[_current_company] > RATING_VERYPOOR) return CommandCost();
if (t->ratings[_current_company] > RATING_VERYPOOR || _settings_game.difficulty.town_council_tolerance == TOWN_COUNCIL_INDIFFERENT) return CommandCost();
SetDParam(0, t->index);
return_cmd_error(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS);
@ -4047,6 +4050,10 @@ CommandCost CheckforTownRating(DoCommandFlag flags, Town *t, TownRatingCheckType
return CommandCost();
}
if (_settings_game.difficulty.town_council_tolerance == TOWN_COUNCIL_INDIFFERENT) {
return CommandCost();
}
/* minimum rating needed to be allowed to remove stuff */
static const int needed_rating[][TOWN_RATING_CHECK_TYPE_COUNT] = {
/* ROAD_REMOVE, TUNNELBRIDGE_REMOVE */

Loading…
Cancel
Save