Changeset - r24430:e39e393df7ba
[Not reviewed]
master
0 8 0
Pavel Stupnikov - 3 years ago 2020-12-14 22:35:07
dp@dpointer.org
Add: new economy "frozen" that stops production changes and industry closures (#8282)
8 files changed with 54 insertions and 35 deletions:
0 comments (0 inline, 0 general)
src/economy_type.h
Show inline comments
 
@@ -6,24 +6,33 @@
 
 */
 

	
 
/** @file economy_type.h Types related to the economy. */
 

	
 
#ifndef ECONOMY_TYPE_H
 
#define ECONOMY_TYPE_H
 

	
 
#include "core/overflowsafe_type.hpp"
 
#include "core/enum_type.hpp"
 

	
 
typedef OverflowSafeInt64 Money;
 

	
 
/** Type of the game economy. */
 
enum EconomyType : uint8 {
 
	ET_BEGIN = 0,
 
	ET_ORIGINAL = 0,
 
	ET_SMOOTH = 1,
 
	ET_FROZEN = 2,
 
	ET_END = 3,
 
};
 

	
 
/** Data of the economy. */
 
struct Economy {
 
	Money max_loan;                       ///< NOSAVE: Maximum possible loan
 
	int16 fluct;                          ///< Economy fluctuation status
 
	byte interest_rate;                   ///< Interest
 
	byte infl_amount;                     ///< inflation amount
 
	byte infl_amount_pr;                  ///< inflation rate for payment rates
 
	uint32 industry_daily_change_counter; ///< Bits 31-16 are number of industry to be performed, 15-0 are fractional collected daily
 
	uint32 industry_daily_increment;      ///< The value which will increment industry_daily_change_counter. Computed value. NOSAVE
 
	uint64 inflation_prices;              ///< Cumulated inflation of prices since game start; 16 bit fractional part
 
	uint64 inflation_payment;             ///< Cumulated inflation of cargo paypent since game start; 16 bit fractional part
 

	
src/industry_cmd.cpp
Show inline comments
 
@@ -1727,26 +1727,26 @@ static void DoCreateNewIndustry(Industry
 
	MemCpyT(i->produced_cargo,  indspec->produced_cargo,  lengthof(i->produced_cargo));
 
	MemCpyT(i->production_rate, indspec->production_rate, lengthof(i->production_rate));
 
	MemCpyT(i->accepts_cargo,   indspec->accepts_cargo,   lengthof(i->accepts_cargo));
 

	
 
	MemSetT(i->produced_cargo_waiting,     0, lengthof(i->produced_cargo_waiting));
 
	MemSetT(i->this_month_production,      0, lengthof(i->this_month_production));
 
	MemSetT(i->this_month_transported,     0, lengthof(i->this_month_transported));
 
	MemSetT(i->last_month_pct_transported, 0, lengthof(i->last_month_pct_transported));
 
	MemSetT(i->last_month_transported,     0, lengthof(i->last_month_transported));
 
	MemSetT(i->incoming_cargo_waiting,     0, lengthof(i->incoming_cargo_waiting));
 
	MemSetT(i->last_cargo_accepted_at,     0, lengthof(i->last_cargo_accepted_at));
 

	
 
	/* don't use smooth economy for industries using production related callbacks */
 
	if (indspec->UsesSmoothEconomy()) {
 
	/* Randomize inital production if non-original economy is used and there are no production related callbacks. */
 
	if (!indspec->UsesOriginalEconomy()) {
 
		for (size_t ci = 0; ci < lengthof(i->production_rate); ci++) {
 
			i->production_rate[ci] = min((RandomRange(256) + 128) * i->production_rate[ci] >> 8, 255);
 
		}
 
	}
 

	
 
	i->town = t;
 
	i->owner = OWNER_NONE;
 

	
 
	uint16 r = Random();
 
	i->random_colour = GB(r, 0, 4);
 
	i->counter = GB(r, 4, 12);
 
	i->random = initial_random_bits;
 
@@ -2295,25 +2295,25 @@ static void UpdateIndustryStatistics(Ind
 
			i->this_month_transported[j] = 0;
 
		}
 
	}
 
}
 

	
 
/**
 
 * Recompute #production_rate for current #prod_level.
 
 * This function is only valid when not using smooth economy.
 
 */
 
void Industry::RecomputeProductionMultipliers()
 
{
 
	const IndustrySpec *indspec = GetIndustrySpec(this->type);
 
	assert(!indspec->UsesSmoothEconomy());
 
	assert(indspec->UsesOriginalEconomy());
 

	
 
	/* Rates are rounded up, so e.g. oilrig always produces some passengers */
 
	for (size_t i = 0; i < lengthof(this->production_rate); i++) {
 
		this->production_rate[i] = min(CeilDiv(indspec->production_rate[i] * this->prod_level, PRODLEVEL_DEFAULT), 0xFF);
 
	}
 
}
 

	
 
void Industry::FillCachedName() const
 
{
 
	char buf[256];
 
	int64 args_array[] = { this->index };
 
	StringParameters tmp_params(args_array);
 
@@ -2595,26 +2595,26 @@ static const uint PERCENT_TRANSPORTED_80
 
 * Change industry production or do closure
 
 * @param i Industry for which changes are performed
 
 * @param monthly true if it's the monthly call, false if it's the random call
 
 */
 
static void ChangeIndustryProduction(Industry *i, bool monthly)
 
{
 
	StringID str = STR_NULL;
 
	bool closeit = false;
 
	const IndustrySpec *indspec = GetIndustrySpec(i->type);
 
	bool standard = false;
 
	bool suppress_message = false;
 
	bool recalculate_multipliers = false; ///< reinitialize production_rate to match prod_level
 
	/* don't use smooth economy for industries using production related callbacks */
 
	bool smooth_economy = indspec->UsesSmoothEconomy();
 
	/* use original economy for industries using production related callbacks */
 
	bool original_economy = indspec->UsesOriginalEconomy();
 
	byte div = 0;
 
	byte mul = 0;
 
	int8 increment = 0;
 

	
 
	bool callback_enabled = HasBit(indspec->callback_mask, monthly ? CBM_IND_MONTHLYPROD_CHANGE : CBM_IND_PRODUCTION_CHANGE);
 
	if (callback_enabled) {
 
		uint16 res = GetIndustryCallback(monthly ? CBID_INDUSTRY_MONTHLYPROD_CHANGE : CBID_INDUSTRY_PRODUCTION_CHANGE, 0, Random(), i, i->type, i->location.tile);
 
		if (res != CALLBACK_FAILED) { // failed callback means "do nothing"
 
			suppress_message = HasBit(res, 7);
 
			/* Get the custom message if any */
 
			if (HasBit(res, 8)) str = MapGRFStringID(indspec->grf_prop.grffile->grfid, GB(GetRegister(0x100), 0, 16));
 
			res = GB(res, 0, 4);
 
@@ -2631,33 +2631,43 @@ static void ChangeIndustryProduction(Ind
 
				case 0xC: mul = res - 0x7; break; // Multiply production by 32
 
				case 0xD:                         // decrement production
 
				case 0xE:                         // increment production
 
					increment = res == 0x0D ? -1 : 1;
 
					break;
 
				case 0xF:                         // Set production to third byte of register 0x100
 
					i->prod_level = Clamp(GB(GetRegister(0x100), 16, 8), PRODLEVEL_MINIMUM, PRODLEVEL_MAXIMUM);
 
					recalculate_multipliers = true;
 
					break;
 
			}
 
		}
 
	} else {
 
		if (monthly != smooth_economy) return;
 
		if (monthly == original_economy) return;
 
		if (!original_economy && _settings_game.economy.type == ET_FROZEN) return;
 
		if (indspec->life_type == INDUSTRYLIFE_BLACK_HOLE) return;
 
	}
 

	
 
	if (standard || (!callback_enabled && (indspec->life_type & (INDUSTRYLIFE_ORGANIC | INDUSTRYLIFE_EXTRACTIVE)) != 0)) {
 
		/* decrease or increase */
 
		bool only_decrease = (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _settings_game.game_creation.landscape == LT_TEMPERATE;
 

	
 
		if (smooth_economy) {
 
		if (original_economy) {
 
			if (only_decrease || Chance16(1, 3)) {
 
				/* If more than 60% transported, 66% chance of increase, else 33% chance of increase */
 
				if (!only_decrease && (i->last_month_pct_transported[0] > PERCENT_TRANSPORTED_60) != Chance16(1, 3)) {
 
					mul = 1; // Increase production
 
				} else {
 
					div = 1; // Decrease production
 
				}
 
			}
 
		} else if (_settings_game.economy.type == ET_SMOOTH) {
 
			closeit = true;
 
			for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
 
				if (i->produced_cargo[j] == CT_INVALID) continue;
 
				uint32 r = Random();
 
				int old_prod, new_prod, percent;
 
				/* If over 60% is transported, mult is 1, else mult is -1. */
 
				int mult = (i->last_month_pct_transported[j] > PERCENT_TRANSPORTED_60) ? 1 : -1;
 

	
 
				new_prod = old_prod = i->production_rate[j];
 

	
 
				/* For industries with only_decrease flags (temperate terrain Oil Wells),
 
				 * the multiplier will always be -1 so they will only decrease. */
 
@@ -2689,38 +2699,29 @@ static void ChangeIndustryProduction(Ind
 
				}
 

	
 
				percent = (old_prod == 0) ? 100 : (new_prod * 100 / old_prod - 100);
 
				i->production_rate[j] = new_prod;
 

	
 
				/* Close the industry when it has the lowest possible production rate */
 
				if (new_prod > 1) closeit = false;
 

	
 
				if (abs(percent) >= 10) {
 
					ReportNewsProductionChangeIndustry(i, i->produced_cargo[j], percent);
 
				}
 
			}
 
		} else {
 
			if (only_decrease || Chance16(1, 3)) {
 
				/* If more than 60% transported, 66% chance of increase, else 33% chance of increase */
 
				if (!only_decrease && (i->last_month_pct_transported[0] > PERCENT_TRANSPORTED_60) != Chance16(1, 3)) {
 
					mul = 1; // Increase production
 
				} else {
 
					div = 1; // Decrease production
 
				}
 
			}
 
		}
 
	}
 

	
 
	if (!callback_enabled && (indspec->life_type & INDUSTRYLIFE_PROCESSING)) {
 
		if ( (byte)(_cur_year - i->last_prod_year) >= 5 && Chance16(1, smooth_economy ? 180 : 2)) {
 
		if ( (byte)(_cur_year - i->last_prod_year) >= 5 && Chance16(1, original_economy ? 2 : 180)) {
 
			closeit = true;
 
		}
 
	}
 

	
 
	/* Increase if needed */
 
	while (mul-- != 0 && i->prod_level < PRODLEVEL_MAXIMUM) {
 
		i->prod_level = min(i->prod_level * 2, PRODLEVEL_MAXIMUM);
 
		recalculate_multipliers = true;
 
		if (str == STR_NULL) str = indspec->production_up_text;
 
	}
 

	
 
	/* Decrease if needed */
 
@@ -2925,32 +2926,32 @@ Money IndustrySpec::GetConstructionCost(
 
/**
 
 * Get the cost for removing this industry
 
 * Take note that the cost will always be zero for non-grf industries.
 
 * Only if the grf author did specified a cost will it be applicable.
 
 * @return the cost (inflation corrected etc)
 
 */
 
Money IndustrySpec::GetRemovalCost() const
 
{
 
	return (_price[PR_CLEAR_INDUSTRY] * this->removal_cost_multiplier) >> 8;
 
}
 

	
 
/**
 
 * Determines whether this industrytype uses smooth economy or whether it uses standard/newgrf production changes.
 
 * @return true if smooth economy is used.
 
 * Determines whether this industrytype uses standard/newgrf production changes.
 
 * @return true if original economy is used.
 
 */
 
bool IndustrySpec::UsesSmoothEconomy() const
 
bool IndustrySpec::UsesOriginalEconomy() const
 
{
 
	return _settings_game.economy.smooth_economy &&
 
		!(HasBit(this->callback_mask, CBM_IND_PRODUCTION_256_TICKS) || HasBit(this->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
 
		!(HasBit(this->callback_mask, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(this->callback_mask, CBM_IND_PRODUCTION_CHANGE) || HasBit(this->callback_mask, CBM_IND_PROD_CHANGE_BUILD)); // production change callbacks
 
	return _settings_game.economy.type == ET_ORIGINAL ||
 
		HasBit(this->callback_mask, CBM_IND_PRODUCTION_256_TICKS) || HasBit(this->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || // production callbacks
 
		HasBit(this->callback_mask, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(this->callback_mask, CBM_IND_PRODUCTION_CHANGE) || HasBit(this->callback_mask, CBM_IND_PROD_CHANGE_BUILD); // production change callbacks
 
}
 

	
 
IndustrySpec::~IndustrySpec()
 
{
 
	if (HasBit(this->cleanup_flag, CLEAN_RANDOMSOUNDS)) {
 
		free(this->random_sounds);
 
	}
 
}
 

	
 
static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
 
{
 
	if (AutoslopeEnabled()) {
src/industry_gui.cpp
Show inline comments
 
@@ -1071,45 +1071,45 @@ public:
 

	
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	void OnInvalidateData(int data = 0, bool gui_scope = true) override
 
	{
 
		if (!gui_scope) return;
 
		const Industry *i = Industry::Get(this->window_number);
 
		if (IsProductionAlterable(i)) {
 
			const IndustrySpec *ind = GetIndustrySpec(i->type);
 
			this->editable = ind->UsesSmoothEconomy() ? EA_RATE : EA_MULTIPLIER;
 
			this->editable = ind->UsesOriginalEconomy() ? EA_MULTIPLIER : EA_RATE;
 
		} else {
 
			this->editable = EA_NONE;
 
		}
 
	}
 

	
 
	bool IsNewGRFInspectable() const override
 
	{
 
		return ::IsNewGRFInspectable(GSF_INDUSTRIES, this->window_number);
 
	}
 

	
 
	void ShowNewGRFInspectWindow() const override
 
	{
 
		::ShowNewGRFInspectWindow(GSF_INDUSTRIES, this->window_number);
 
	}
 
};
 

	
 
static void UpdateIndustryProduction(Industry *i)
 
{
 
	const IndustrySpec *indspec = GetIndustrySpec(i->type);
 
	if (!indspec->UsesSmoothEconomy()) i->RecomputeProductionMultipliers();
 
	if (indspec->UsesOriginalEconomy()) i->RecomputeProductionMultipliers();
 

	
 
	for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
 
		if (i->produced_cargo[j] != CT_INVALID) {
 
			i->last_month_production[j] = 8 * i->production_rate[j];
 
		}
 
	}
 
}
 

	
 
/** Widget definition of the view industry gui */
 
static const NWidgetPart _nested_industry_view_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_CREAM),
src/industrytype.h
Show inline comments
 
@@ -135,25 +135,25 @@ struct IndustrySpec {
 
	uint8 number_of_sounds;                     ///< Number of sounds available in the sounds array
 
	const uint8 *random_sounds;                 ///< array of random sounds.
 
	/* Newgrf data */
 
	uint16 callback_mask;                       ///< Bitmask of industry callbacks that have to be called
 
	uint8 cleanup_flag;                         ///< flags indicating which data should be freed upon cleaning up
 
	bool enabled;                               ///< entity still available (by default true).newgrf can disable it, though
 
	GRFFileProps grf_prop;                      ///< properties related to the grf file
 

	
 
	bool IsRawIndustry() const;
 
	bool IsProcessingIndustry() const;
 
	Money GetConstructionCost() const;
 
	Money GetRemovalCost() const;
 
	bool UsesSmoothEconomy() const;
 
	bool UsesOriginalEconomy() const;
 

	
 
	~IndustrySpec();
 
};
 

	
 
/**
 
 * Defines the data structure of each individual tile of an industry.
 
 * @note A tile can at most accept 3 types of cargo, even if an industry as a whole can accept more types.
 
 */
 
struct IndustryTileSpec {
 
	CargoID accepts_cargo[INDUSTRY_NUM_INPUTS]; ///< Cargo accepted by this tile
 
	int8 acceptance[INDUSTRY_NUM_INPUTS]; ///< Level of acceptance per cargo type (signed, may be negative!)
 
	Slope slopes_refused;                 ///< slope pattern on which this tile cannot be built
src/lang/english.txt
Show inline comments
 
@@ -1544,26 +1544,29 @@ STR_CONFIG_SETTING_NEWS_GENERAL_INFORMAT
 

	
 
STR_CONFIG_SETTING_NEWS_MESSAGES_OFF                            :Off
 
STR_CONFIG_SETTING_NEWS_MESSAGES_SUMMARY                        :Summary
 
STR_CONFIG_SETTING_NEWS_MESSAGES_FULL                           :Full
 

	
 
STR_CONFIG_SETTING_COLOURED_NEWS_YEAR                           :Coloured news appears in: {STRING2}
 
STR_CONFIG_SETTING_COLOURED_NEWS_YEAR_HELPTEXT                  :Year that the newspaper announcements get printed in colour. Before this year, it uses monochrome black/white
 
STR_CONFIG_SETTING_STARTING_YEAR                                :Starting year: {STRING2}
 
STR_CONFIG_SETTING_ENDING_YEAR                                  :Scoring end year: {STRING2}
 
STR_CONFIG_SETTING_ENDING_YEAR_HELPTEXT                         :Year the game ends for scoring purposes. At the end of this year, the company's score is recorded and the high-score screen is displayed, but the players can continue playing after that.{}If this is before the starting year, the high-score screen is never displayed.
 
STR_CONFIG_SETTING_ENDING_YEAR_VALUE                            :{NUM}
 
STR_CONFIG_SETTING_ENDING_YEAR_ZERO                             :Never
 
STR_CONFIG_SETTING_SMOOTH_ECONOMY                               :Enable smooth economy (more, smaller changes): {STRING2}
 
STR_CONFIG_SETTING_SMOOTH_ECONOMY_HELPTEXT                      :When enabled, industry production changes more often, and in smaller steps. This setting has usually no effect, if industry types are provided by a NewGRF
 
STR_CONFIG_SETTING_ECONOMY_TYPE                                 :Economy type: {STRING2}
 
STR_CONFIG_SETTING_ECONOMY_TYPE_HELPTEXT                        :Smooth economy makes production changes more often, and in smaller steps. Frozen economy stops production changes and industry closures. This setting may have no effect if industry types are provided by a NewGRF.
 
STR_CONFIG_SETTING_ECONOMY_TYPE_ORIGINAL                        :Original
 
STR_CONFIG_SETTING_ECONOMY_TYPE_SMOOTH                          :Smooth
 
STR_CONFIG_SETTING_ECONOMY_TYPE_FROZEN                          :Frozen
 
STR_CONFIG_SETTING_ALLOW_SHARES                                 :Allow buying shares from other companies: {STRING2}
 
STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT                        :When enabled, allow buying and selling of company shares. Shares will only be available for companies reaching a certain age
 
STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES                         :Minimum company age to trade shares: {STRING2}
 
STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT                :Set the minimum age of a company for others to be able to buy and sell shares from them.
 
STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE                         :Percentage of leg profit to pay in feeder systems: {STRING2}
 
STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT                :Percentage of income given to the intermediate legs in feeder systems, giving more control over the income
 
STR_CONFIG_SETTING_DRAG_SIGNALS_DENSITY                         :When dragging, place signals every: {STRING2}
 
STR_CONFIG_SETTING_DRAG_SIGNALS_DENSITY_HELPTEXT                :Set the distance at which signals will be built on a track up to the next obstacle (signal, junction), if signals are dragged
 
STR_CONFIG_SETTING_DRAG_SIGNALS_DENSITY_VALUE                   :{COMMA} tile{P 0 "" s}
 
STR_CONFIG_SETTING_DRAG_SIGNALS_FIXED_DISTANCE                  :When dragging, keep fixed distance between signals: {STRING2}
 
STR_CONFIG_SETTING_DRAG_SIGNALS_FIXED_DISTANCE_HELPTEXT         :Select the behaviour of signal placement when Ctrl+dragging signals. If disabled, signals are placed around tunnels or bridges to avoid long stretches without signals. If enabled, signals are placed every n tiles, making alignment of signals at parallel tracks easier
 
STR_CONFIG_SETTING_SEMAPHORE_BUILD_BEFORE_DATE                  :Automatically build semaphores before: {STRING2}
src/settings_gui.cpp
Show inline comments
 
@@ -1720,25 +1720,25 @@ static SettingsContainer &GetSettingsTre
 
				towns->Add(new SettingEntry("economy.allow_town_roads"));
 
				towns->Add(new SettingEntry("economy.allow_town_level_crossings"));
 
				towns->Add(new SettingEntry("economy.found_town"));
 
				towns->Add(new SettingEntry("economy.town_cargogen_mode"));
 
			}
 

	
 
			SettingsPage *industries = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES));
 
			{
 
				industries->Add(new SettingEntry("construction.raw_industry_construction"));
 
				industries->Add(new SettingEntry("construction.industry_platform"));
 
				industries->Add(new SettingEntry("economy.multiple_industry_per_town"));
 
				industries->Add(new SettingEntry("game_creation.oil_refinery_limit"));
 
				industries->Add(new SettingEntry("economy.smooth_economy"));
 
				industries->Add(new SettingEntry("economy.type"));
 
				industries->Add(new SettingEntry("station.serve_neutral_industries"));
 
			}
 

	
 
			SettingsPage *cdist = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST));
 
			{
 
				cdist->Add(new SettingEntry("linkgraph.recalc_time"));
 
				cdist->Add(new SettingEntry("linkgraph.recalc_interval"));
 
				cdist->Add(new SettingEntry("linkgraph.distribution_pax"));
 
				cdist->Add(new SettingEntry("linkgraph.distribution_mail"));
 
				cdist->Add(new SettingEntry("linkgraph.distribution_armoured"));
 
				cdist->Add(new SettingEntry("linkgraph.distribution_default"));
 
				cdist->Add(new SettingEntry("linkgraph.accuracy"));
src/settings_type.h
Show inline comments
 
@@ -2,24 +2,25 @@
 
 * This file is part of OpenTTD.
 
 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 
 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
/** @file settings_type.h Types related to global configuration settings. */
 

	
 
#ifndef SETTINGS_TYPE_H
 
#define SETTINGS_TYPE_H
 

	
 
#include "date_type.h"
 
#include "economy_type.h"
 
#include "town_type.h"
 
#include "transport_type.h"
 
#include "network/core/config.h"
 
#include "company_type.h"
 
#include "cargotype.h"
 
#include "linkgraph/linkgraph_type.h"
 
#include "zoom_type.h"
 
#include "openttd.h"
 

	
 

	
 
/** Settings profiles and highscore tables. */
 
enum SettingsProfile {
 
@@ -461,25 +462,25 @@ struct VehicleSettings {
 
	uint8  freight_trains;                   ///< value to multiply the weight of cargo by
 
	bool   dynamic_engines;                  ///< enable dynamic allocation of engine data
 
	bool   never_expire_vehicles;            ///< never expire vehicles
 
	byte   extend_vehicle_life;              ///< extend vehicle life by this many years
 
	byte   road_side;                        ///< the side of the road vehicles drive on
 
	uint8  plane_crashes;                    ///< number of plane crashes, 0 = none, 1 = reduced, 2 = normal
 
};
 

	
 
/** Settings related to the economy. */
 
struct EconomySettings {
 
	bool   inflation;                        ///< disable inflation
 
	bool   bribe;                            ///< enable bribing the local authority
 
	bool   smooth_economy;                   ///< smooth economy
 
	EconomyType type;                        ///< economy type (original/smooth/frozen)
 
	bool   allow_shares;                     ///< allow the buying/selling of shares
 
	uint8  min_years_for_shares;             ///< minimum age of a company for it to trade shares
 
	uint8  feeder_payment_share;             ///< percentage of leg payment to virtually pay in feeder systems
 
	byte   dist_local_authority;             ///< distance for town local authority, default 20
 
	bool   exclusive_rights;                 ///< allow buying exclusive rights
 
	bool   fund_buildings;                   ///< allow funding new buildings
 
	bool   fund_roads;                       ///< allow funding local road reconstruction
 
	bool   give_money;                       ///< allow giving other companies money
 
	bool   mod_road_rebuild;                 ///< roadworks remove unnecessary RoadBits
 
	bool   multiple_industry_per_town;       ///< allow many industries of the same type per town
 
	uint8  town_growth_rate;                 ///< town growth rate
 
	uint8  larger_towns;                     ///< the number of cities to build. These start off larger and grow twice as fast
src/table/settings.ini
Show inline comments
 
@@ -1420,30 +1420,35 @@ var      = game_creation.ending_year
 
type     = SLE_INT32
 
from     = SLV_ENDING_YEAR
 
guiflags = SGF_0ISDISABLED
 
def      = DEF_END_YEAR
 
min      = MIN_YEAR
 
max      = MAX_YEAR
 
interval = 1
 
str      = STR_CONFIG_SETTING_ENDING_YEAR
 
strhelp  = STR_CONFIG_SETTING_ENDING_YEAR_HELPTEXT
 
strval   = STR_CONFIG_SETTING_ENDING_YEAR_VALUE
 
cat      = SC_ADVANCED
 

	
 
[SDT_BOOL]
 
[SDT_VAR]
 
base     = GameSettings
 
var      = economy.smooth_economy
 
def      = true
 
str      = STR_CONFIG_SETTING_SMOOTH_ECONOMY
 
strhelp  = STR_CONFIG_SETTING_SMOOTH_ECONOMY_HELPTEXT
 
var      = economy.type
 
type     = SLE_UINT8
 
guiflags = SGF_MULTISTRING
 
def      = ET_SMOOTH
 
min      = ET_BEGIN
 
max      = ET_END - 1
 
str      = STR_CONFIG_SETTING_ECONOMY_TYPE
 
strhelp  = STR_CONFIG_SETTING_ECONOMY_TYPE_HELPTEXT
 
strval   = STR_CONFIG_SETTING_ECONOMY_TYPE_ORIGINAL
 
proc     = InvalidateIndustryViewWindow
 
cat      = SC_BASIC
 

	
 
[SDT_BOOL]
 
base     = GameSettings
 
var      = economy.allow_shares
 
def      = false
 
str      = STR_CONFIG_SETTING_ALLOW_SHARES
 
strhelp  = STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT
 
proc     = InvalidateCompanyWindow
 

	
 
[SDT_VAR]
0 comments (0 inline, 0 general)