OpenTTD Source  12.0-beta2
settings.cpp File Reference
#include "stdafx.h"
#include <charconv>
#include "settings_table.h"
#include "debug.h"
#include "currency.h"
#include "network/network.h"
#include "network/network_func.h"
#include "network/core/config.h"
#include "command_func.h"
#include "console_func.h"
#include "genworld.h"
#include "window_func.h"
#include "company_func.h"
#include "rev.h"
#include "error.h"
#include "gamelog.h"
#include "settings_func.h"
#include "ini_type.h"
#include "ai/ai_config.hpp"
#include "game/game_config.hpp"
#include "newgrf_config.h"
#include "fios.h"
#include "fileio_func.h"
#include "table/strings.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

class  ConfigIniFile
 IniFile to store a configuration. More...
 

Typedefs

typedef std::list< ErrorMessageDataErrorList
 
typedef void SettingDescProc(IniFile &ini, const SettingTable &desc, const char *grpname, void *object, bool only_startup)
 
typedef void SettingDescProcList(IniFile &ini, const char *grpname, StringList &list)
 

Enumerations

enum  IniFileVersion : uint32 { IFV_0, IFV_PRIVATE_SECRETS, IFV_MAX_VERSION }
 Ini-file versions. More...
 

Functions

static auto & GenericSettingTables ()
 List of all the generic setting tables. More...
 
static auto & PrivateSettingTables ()
 List of all the private setting tables.
 
static auto & SecretSettingTables ()
 List of all the secrets setting tables.
 
static bool IsSignedVarMemType (VarType vt)
 
static size_t LookupManyOfMany (const std::vector< std::string > &many, const char *str)
 Find the set-integer value MANYofMANY type in a string. More...
 
template<typename T >
static int ParseIntList (const char *p, T *items, int maxitems)
 Parse an integerlist string and set each found value. More...
 
static bool LoadIntList (const char *str, void *array, int nelems, VarType type)
 Load parsed string-values into an integer-array (intlist) More...
 
static void IniLoadSettings (IniFile &ini, const SettingTable &settings_table, const char *grpname, void *object, bool only_startup)
 Load values from a group of an IniFile structure into the internal representation. More...
 
static void IniSaveSettings (IniFile &ini, const SettingTable &settings_table, const char *grpname, void *object, bool)
 Save the values of settings to the inifile. More...
 
static void IniLoadSettingList (IniFile &ini, const char *grpname, StringList &list)
 Loads all items from a 'grpname' section into a list The list parameter can be a nullptr pointer, in this case nothing will be saved and a callback function should be defined that will take over the list-handling and store the data itself somewhere. More...
 
static void IniSaveSettingList (IniFile &ini, const char *grpname, StringList &list)
 Saves all items from a list into the 'grpname' section The list parameter can be a nullptr pointer, in this case a callback function should be defined that will provide the source data to be saved. More...
 
void IniLoadWindowSettings (IniFile &ini, const char *grpname, void *desc)
 Load a WindowDesc from config. More...
 
void IniSaveWindowSettings (IniFile &ini, const char *grpname, void *desc)
 Save a WindowDesc to config. More...
 
void PrepareOldDiffCustom ()
 Prepare for reading and old diff_custom by zero-ing the memory.
 
void HandleOldDiffCustom (bool savegame)
 Reading of the old diff_custom array and transforming it to the new format. More...
 
static void ValidateSettings ()
 Checks if any settings are set to incorrect values, and sets them to correct values in that case.
 
static void AILoadConfig (IniFile &ini, const char *grpname)
 
static void GameLoadConfig (IniFile &ini, const char *grpname)
 
static int DecodeHexNibble (char c)
 Convert a character to a hex nibble value, or -1 otherwise. More...
 
static bool DecodeHexText (const char *pos, uint8 *dest, size_t dest_size)
 Parse a sequence of characters (supposedly hex digits) into a sequence of bytes. More...
 
static GRFConfigGRFLoadConfig (IniFile &ini, const char *grpname, bool is_static)
 Load a GRF configuration. More...
 
static IniFileVersion LoadVersionFromConfig (IniFile &ini)
 
static void AISaveConfig (IniFile &ini, const char *grpname)
 
static void GameSaveConfig (IniFile &ini, const char *grpname)
 
static void SaveVersionInConfig (IniFile &ini)
 Save the version of OpenTTD to the ini file. More...
 
static void GRFSaveConfig (IniFile &ini, const char *grpname, const GRFConfig *list)
 
static void HandleSettingDescs (IniFile &generic_ini, IniFile &private_ini, IniFile &secrets_ini, SettingDescProc *proc, SettingDescProcList *proc_list, bool only_startup=false)
 
static void RemoveEntriesFromIni (IniFile &ini, const SettingTable &table)
 Remove all entries from a settings table from an ini-file. More...
 
void LoadFromConfig (bool startup)
 Load the values from the configuration files. More...
 
void SaveToConfig ()
 Save the values to the configuration file.
 
StringList GetGRFPresetList ()
 Get the list of known NewGrf presets. More...
 
GRFConfigLoadGRFPresetFromConfig (const char *config_name)
 Load a NewGRF configuration by preset-name. More...
 
void SaveGRFPresetToConfig (const char *config_name, GRFConfig *config)
 Save a NewGRF configuration with a preset name. More...
 
void DeleteGRFPresetFromConfig (const char *config_name)
 Delete a NewGRF configuration by preset name. More...
 
static const SettingDescGetSettingFromName (const std::string_view name, const SettingTable &settings)
 Given a name of setting, return a setting description from the table. More...
 
void GetSaveLoadFromSettingTable (SettingTable settings, std::vector< SaveLoad > &saveloads)
 Get the SaveLoad for all settings in the settings table. More...
 
static const SettingDescGetCompanySettingFromName (std::string_view name)
 Given a name of setting, return a company setting description of it. More...
 
const SettingDescGetSettingFromName (const std::string_view name)
 Given a name of any setting, return any setting description of it. More...
 
CommandCost CmdChangeSetting (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
 Network-safe changing of settings (server-only). More...
 
CommandCost CmdChangeCompanySetting (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
 Change one of the per-company settings. More...
 
bool SetSettingValue (const IntSettingDesc *sd, int32 value, bool force_newgame)
 Top function to save the new value of an element of the Settings struct. More...
 
void SetDefaultCompanySettings (CompanyID cid)
 Set the company settings for a new company to their default values.
 
void SyncCompanySettings ()
 Sync all company settings in a multiplayer game.
 
bool SetSettingValue (const StringSettingDesc *sd, std::string value, bool force_newgame)
 Set a setting value with a string. More...
 
void IConsoleSetSetting (const char *name, const char *value, bool force_newgame)
 
void IConsoleSetSetting (const char *name, int value)
 
void IConsoleGetSetting (const char *name, bool force_newgame)
 Output value of a specific setting to the console. More...
 
static void IConsoleListSettingsTable (const SettingTable &table, const char *prefilter)
 
void IConsoleListSettings (const char *prefilter)
 List all settings and their value to the console. More...
 

Variables

ClientSettings _settings_client
 The current settings for this game.
 
GameSettings _settings_game
 Game settings of a running game or the scenario editor. More...
 
GameSettings _settings_newgame
 Game settings for new games (updated from the intro screen). More...
 
VehicleDefaultSettings _old_vds
 Used for loading default vehicles settings from old savegames. More...
 
std::string _config_file
 Configuration file of OpenTTD.
 
std::string _private_file
 Private configuration file of OpenTTD.
 
std::string _secrets_file
 Secrets configuration file of OpenTTD.
 
static ErrorList _settings_error_list
 Errors while loading minimal settings.
 
const uint16 INIFILE_VERSION = (IniFileVersion)(IFV_MAX_VERSION - 1)
 Current ini-file version of OpenTTD.
 

Detailed Description

All actions handling saving and loading of the settings/configuration goes on in this file. The file consists of three parts:

  1. Parsing the configuration file (openttd.cfg). This is achieved with the ini_ functions which handle various types, such as normal 'key = value' pairs, lists and value combinations of lists, strings, integers, 'bit'-masks and element selections.
  2. Handle reading and writing to the setting-structures from inside the game either from the console for example or through the gui with CMD_ functions.
  3. Handle saving/loading of the PATS chunk inside the savegame.
See also
SettingDesc
SaveLoad

Definition in file settings.cpp.

Enumeration Type Documentation

◆ IniFileVersion

enum IniFileVersion : uint32

Ini-file versions.

Sometimes we move settings between different ini-files, as we need to know when we have to load/remove it from the old versus reading it from the new location. These versions assist with situations like that.

Enumerator
IFV_0 

0 All versions prior to introduction.

IFV_PRIVATE_SECRETS 

1 PR#9298 Moving of settings from openttd.cfg to private.cfg / secrets.cfg.

IFV_MAX_VERSION 

Highest possible ini-file version.

Definition at line 156 of file settings.cpp.

Function Documentation

◆ CmdChangeCompanySetting()

CommandCost CmdChangeCompanySetting ( TileIndex  tile,
DoCommandFlag  flags,
uint32  p1,
uint32  p2,
const std::string &  text 
)

Change one of the per-company settings.

Parameters
tileunused
flagsoperation to perform
p1unused
p2the new value for the setting The new value is properly clamped to its minimum/maximum when setting
textthe name of the company setting to change
Returns
the cost of this operation or an error

Definition at line 1502 of file settings.cpp.

References _current_company, SettingDesc::AsIntSetting(), IntSettingDesc::ChangeValue(), CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetCompanySettingFromName(), SettingDesc::IsIntSetting(), and settings.

◆ CmdChangeSetting()

CommandCost CmdChangeSetting ( TileIndex  tile,
DoCommandFlag  flags,
uint32  p1,
uint32  p2,
const std::string &  text 
)

Network-safe changing of settings (server-only).

Parameters
tileunused
flagsoperation to perform
p1unused
p2the new value for the setting The new value is properly clamped to its minimum/maximum when setting
textthe name of the setting to change
Returns
the cost of this operation or an error
See also
_settings

Definition at line 1474 of file settings.cpp.

References SettingDesc::AsIntSetting(), IntSettingDesc::ChangeValue(), CMD_ERROR, DC_EXEC, GetGameSettings(), GetSettingFromName(), SettingDesc::IsEditable(), SettingDesc::IsIntSetting(), SettingDesc::save, SlIsObjectCurrentlyValid(), SaveLoad::version_from, and SaveLoad::version_to.

◆ DecodeHexNibble()

static int DecodeHexNibble ( char  c)
static

Convert a character to a hex nibble value, or -1 otherwise.

Parameters
cCharacter to convert.
Returns
Hex value of the character, or -1 if not a hex digit.

Definition at line 916 of file settings.cpp.

Referenced by DecodeHexText().

◆ DecodeHexText()

static bool DecodeHexText ( const char *  pos,
uint8 *  dest,
size_t  dest_size 
)
static

Parse a sequence of characters (supposedly hex digits) into a sequence of bytes.

After the hex number should be a '|' character.

Parameters
posFirst character to convert.
[out]destOutput byte array to write the bytes.
dest_sizeNumber of bytes in dest.
Returns
Whether reading was successful.

Definition at line 932 of file settings.cpp.

References DecodeHexNibble().

Referenced by GRFLoadConfig().

◆ DeleteGRFPresetFromConfig()

void DeleteGRFPresetFromConfig ( const char *  config_name)

Delete a NewGRF configuration by preset name.

Parameters
config_nameName of the preset.

Definition at line 1347 of file settings.cpp.

References _config_file, IniLoadFile::RemoveGroup(), IniFile::SaveToDisk(), and seprintf().

◆ GenericSettingTables()

static auto& GenericSettingTables ( )
static

List of all the generic setting tables.

There are a few tables that are special and not processed like the rest:

  • _currency_settings
  • _misc_settings
  • _company_settings
  • _win32_settings As such, they are not part of this list.

Definition at line 73 of file settings.cpp.

Referenced by GetSettingFromName(), and IConsoleListSettings().

◆ GetCompanySettingFromName()

static const SettingDesc* GetCompanySettingFromName ( std::string_view  name)
static

Given a name of setting, return a company setting description of it.

Parameters
nameName of the company setting to return a setting description of.
Returns
Pointer to the setting description of setting name if it can be found, nullptr indicates failure to obtain the description.

Definition at line 1432 of file settings.cpp.

References GetSettingFromName(), and StrStartsWith().

Referenced by CmdChangeCompanySetting(), and GetSettingFromName().

◆ GetGRFPresetList()

StringList GetGRFPresetList ( )

Get the list of known NewGrf presets.

Returns
List of preset names.

Definition at line 1294 of file settings.cpp.

References _config_file, IniLoadFile::group, IniGroup::name, and IniGroup::next.

Referenced by NewGRFWindow::OnQueryTextFinished(), and SavePresetWindow::SavePresetWindow().

◆ GetSaveLoadFromSettingTable()

void GetSaveLoadFromSettingTable ( SettingTable  settings,
std::vector< SaveLoad > &  saveloads 
)

Get the SaveLoad for all settings in the settings table.

Parameters
settingsThe settings table to get the SaveLoad objects from.
saveloadsA vector to store the result in.

Definition at line 1417 of file settings.cpp.

References GetSettingDesc(), SettingDesc::save, settings, SlIsObjectCurrentlyValid(), SaveLoad::version_from, and SaveLoad::version_to.

◆ GetSettingFromName() [1/2]

const SettingDesc* GetSettingFromName ( const std::string_view  name)

Given a name of any setting, return any setting description of it.

Parameters
nameName of the setting to return a setting description of.
Returns
Pointer to the setting description of setting name if it can be found, nullptr indicates failure to obtain the description.

Definition at line 1445 of file settings.cpp.

References GenericSettingTables(), GetCompanySettingFromName(), GetSettingFromName(), PrivateSettingTables(), and SecretSettingTables().

◆ GetSettingFromName() [2/2]

static const SettingDesc* GetSettingFromName ( const std::string_view  name,
const SettingTable settings 
)
static

Given a name of setting, return a setting description from the table.

Parameters
nameName of the setting to return a setting description of.
settingsTable to look in for the setting.
Returns
Pointer to the setting description of setting name if it can be found, nullptr indicates failure to obtain the description.

Definition at line 1392 of file settings.cpp.

References SettingDesc::GetName(), GetSettingDesc(), SettingDesc::save, settings, SlIsObjectCurrentlyValid(), StrEndsWith(), SaveLoad::version_from, and SaveLoad::version_to.

Referenced by CmdChangeSetting(), GetCompanySettingFromName(), NewsTypeData::GetDisplay(), GetSettingFromName(), IConsoleGetSetting(), and SettingEntry::Init().

◆ GRFLoadConfig()

◆ HandleOldDiffCustom()

void HandleOldDiffCustom ( bool  savegame)

Reading of the old diff_custom array and transforming it to the new format.

Parameters
savegameis it read from the config or savegame. In the latter case we are sure there is an array; in the former case we have to check that.

Definition at line 36 of file settings_sl.cpp.

References IsSavegameVersionBefore(), and SLV_4.

◆ IConsoleGetSetting()

void IConsoleGetSetting ( const char *  name,
bool  force_newgame 
)

Output value of a specific setting to the console.

Parameters
nameName of the setting to output its value
force_newgameforce the newgame settings

Definition at line 1669 of file settings.cpp.

References CC_ERROR, GetSettingFromName(), and IConsolePrint().

◆ IConsoleListSettings()

void IConsoleListSettings ( const char *  prefilter)

List all settings and their value to the console.

Parameters
prefilterIf not nullptr, only list settings with names that begin with prefilter prefix

Definition at line 1707 of file settings.cpp.

References CC_HELP, GenericSettingTables(), and IConsolePrint().

◆ IniLoadSettingList()

static void IniLoadSettingList ( IniFile ini,
const char *  grpname,
StringList list 
)
static

Loads all items from a 'grpname' section into a list The list parameter can be a nullptr pointer, in this case nothing will be saved and a callback function should be defined that will take over the list-handling and store the data itself somewhere.

Parameters
iniIniFile handle to the ini file with the source data
grpnamecharacter string identifying the section-header of the ini file that will be parsed
listnew list with entries of the given section

Definition at line 740 of file settings.cpp.

References IniLoadFile::GetGroup(), IniGroup::item, and IniItem::next.

◆ IniLoadSettings()

static void IniLoadSettings ( IniFile ini,
const SettingTable settings_table,
const char *  grpname,
void *  object,
bool  only_startup 
)
static

Load values from a group of an IniFile structure into the internal representation.

Parameters
inipointer to IniFile structure that holds administrative information
settings_tabletable with SettingDesc structures whose internally pointed variables will be given values
grpnamethe group of the IniFile to search in for the new values
objectpointer to the object been loaded
only_startupload only the startup settings set

Definition at line 566 of file settings.cpp.

References IniLoadFile::GetGroup(), IniGroup::GetItem(), SettingDesc::GetName(), GetSettingDesc(), SettingDesc::ParseValue(), SettingDesc::save, SlIsObjectCurrentlyValid(), SettingDesc::startup, SaveLoad::version_from, and SaveLoad::version_to.

Referenced by IniLoadWindowSettings().

◆ IniLoadWindowSettings()

void IniLoadWindowSettings ( IniFile ini,
const char *  grpname,
void *  desc 
)

Load a WindowDesc from config.

Parameters
iniIniFile handle to the ini file with the source data
grpnamecharacter string identifying the section-header of the ini file that will be parsed
descDestination WindowDesc

Definition at line 780 of file settings.cpp.

References IniLoadSettings().

Referenced by WindowDesc::LoadFromConfig().

◆ IniSaveSettingList()

static void IniSaveSettingList ( IniFile ini,
const char *  grpname,
StringList list 
)
static

Saves all items from a list into the 'grpname' section The list parameter can be a nullptr pointer, in this case a callback function should be defined that will provide the source data to be saved.

Parameters
iniIniFile handle to the ini file where the destination data is saved
grpnamecharacter string identifying the section-header of the ini file
listpointer to an string(pointer) array that will be used as the source to be saved into the relevant ini section

Definition at line 762 of file settings.cpp.

References IniGroup::Clear(), IniLoadFile::GetGroup(), IniGroup::GetItem(), and IniItem::SetValue().

◆ IniSaveSettings()

static void IniSaveSettings ( IniFile ini,
const SettingTable settings_table,
const char *  grpname,
void *  object,
bool   
)
static

Save the values of settings to the inifile.

Parameters
inipointer to IniFile structure
sdread-only SettingDesc structure which contains the unmodified, loaded values of the configuration file and various information about it
grpnameholds the name of the group (eg. [network]) where these will be saved
objectpointer to the object been saved The function works as follows: for each item in the SettingDesc structure we have a look if the value has changed since we started the game (the original values are reloaded when saving). If settings indeed have changed, we get these and save them.

Definition at line 642 of file settings.cpp.

References SettingDesc::flags, SettingDesc::FormatValue(), IniLoadFile::GetGroup(), SettingDesc::GetName(), GetSettingDesc(), SettingDesc::IsSameValue(), lastof, SettingDesc::save, SF_NOT_IN_CONFIG, SlIsObjectCurrentlyValid(), IniItem::value, SaveLoad::version_from, and SaveLoad::version_to.

Referenced by IniSaveWindowSettings().

◆ IniSaveWindowSettings()

void IniSaveWindowSettings ( IniFile ini,
const char *  grpname,
void *  desc 
)

Save a WindowDesc to config.

Parameters
iniIniFile handle to the ini file where the destination data is saved
grpnamecharacter string identifying the section-header of the ini file
descSource WindowDesc

Definition at line 791 of file settings.cpp.

References IniSaveSettings().

Referenced by WindowDesc::SaveToConfig().

◆ LoadFromConfig()

void LoadFromConfig ( bool  startup)

Load the values from the configuration files.

Parameters
startupLoad the minimal amount of the configuration to "bootstrap" the blitter and such.

Definition at line 1202 of file settings.cpp.

References _config_file, _private_file, _secrets_file, and ResetCurrencies().

Referenced by AfterNewGRFScan::OnNewGRFsScanned().

◆ LoadGRFPresetFromConfig()

GRFConfig* LoadGRFPresetFromConfig ( const char *  config_name)

Load a NewGRF configuration by preset-name.

Parameters
config_nameName of the preset.
Returns
NewGRF configuration.
See also
GetGRFPresetList

Definition at line 1314 of file settings.cpp.

References _config_file, GRFLoadConfig(), and seprintf().

Referenced by NewGRFWindow::OnDropdownSelect().

◆ LoadIntList()

static bool LoadIntList ( const char *  str,
void *  array,
int  nelems,
VarType  type 
)
static

Load parsed string-values into an integer-array (intlist)

Parameters
strthe string that contains the values (and will be parsed)
arraypointer to the integer-arrays that will be filled
nelemsthe number of elements the array holds. Maximum is 64 elements
typethe type of elements the array holds (eg INT8, UINT16, etc.)
Returns
return true on success and false on error

Definition at line 272 of file settings.cpp.

References lengthof, and ParseIntList().

Referenced by ListSettingDesc::ParseValue().

◆ LookupManyOfMany()

static size_t LookupManyOfMany ( const std::vector< std::string > &  many,
const char *  str 
)
static

Find the set-integer value MANYofMANY type in a string.

Parameters
manyfull domain of values the MANYofMANY setting can have
strthe current string value of the setting, each individual of separated by a whitespace,tab or | character
Returns
the 'fully' set integer, or -1 if a set is not found

Definition at line 193 of file settings.cpp.

References OneOfManySettingDesc::ParseSingleValue(), and SetBit().

Referenced by ManyOfManySettingDesc::ParseValue().

◆ ParseIntList()

template<typename T >
static int ParseIntList ( const char *  p,
T *  items,
int  maxitems 
)
static

Parse an integerlist string and set each found value.

Parameters
pthe string to be parsed. Each element in the list is separated by a comma or a space character
itemspointer to the integerlist-array that will be filled with values
maxitemsthe maximum number of elements the integerlist-array has
Returns
returns the number of items found, or -1 on an error

Definition at line 226 of file settings.cpp.

Referenced by GRFLoadConfig(), and LoadIntList().

◆ RemoveEntriesFromIni()

static void RemoveEntriesFromIni ( IniFile ini,
const SettingTable table 
)
static

Remove all entries from a settings table from an ini-file.

This is only useful if those entries are moved to another file, and you want to clean up what is left behind.

Parameters
iniThe ini file to remove the entries from.
tableThe table to look for entries to remove.

Definition at line 1181 of file settings.cpp.

References IniLoadFile::GetGroup(), SettingDesc::GetName(), GetSettingDesc(), and IniGroup::RemoveItem().

◆ SaveGRFPresetToConfig()

void SaveGRFPresetToConfig ( const char *  config_name,
GRFConfig config 
)

Save a NewGRF configuration with a preset name.

Parameters
config_nameName of the preset.
configNewGRF configuration to save.
See also
GetGRFPresetList

Definition at line 1332 of file settings.cpp.

References _config_file, and seprintf().

Referenced by NewGRFWindow::OnQueryTextFinished().

◆ SaveVersionInConfig()

static void SaveVersionInConfig ( IniFile ini)
static

Save the version of OpenTTD to the ini file.

Parameters
inithe ini to write to

Definition at line 1114 of file settings.cpp.

References IniLoadFile::GetGroup(), IniGroup::GetItem(), and IniItem::SetValue().

◆ SetSettingValue() [1/2]

bool SetSettingValue ( const IntSettingDesc sd,
int32  value,
bool  force_newgame 
)

Top function to save the new value of an element of the Settings struct.

Parameters
indexoffset in the SettingDesc array of the Settings struct which identifies the setting member we want to change
valuenew value of the setting
force_newgameforce the newgame settings

Definition at line 1524 of file settings.cpp.

References _local_company, SettingDesc::AsIntSetting(), SettingDesc::flags, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and SF_PER_COMPANY.

Referenced by GameSettingsWindow::OnDropdownSelect().

◆ SetSettingValue() [2/2]

bool SetSettingValue ( const StringSettingDesc sd,
std::string  value,
bool  force_newgame 
)

Set a setting value with a string.

Parameters
sdthe setting to change.
valuethe value to write
force_newgameforce the newgame settings
Note
Strings WILL NOT be synced over the network

Definition at line 1594 of file settings.cpp.

References SaveLoad::conv, SettingDesc::flags, GetVarMemType(), SettingDesc::save, SF_NO_NETWORK_SYNC, and SLE_VAR_STRQ.

Variable Documentation

◆ _old_vds

Used for loading default vehicles settings from old savegames.

Old vehicle settings, which were game settings before, and are company settings now.

Definition at line 55 of file settings.cpp.

◆ _settings_game

GameSettings _settings_game

Game settings of a running game or the scenario editor.

The current settings for this game.

Definition at line 53 of file settings.cpp.

Referenced by AffectSpeedByZChange(), AfterNewGRFScan::AfterNewGRFScan(), AutoslopeEnabled(), Subsidy::AwardTo(), BuildLandLegend(), BuildTownHouse(), CalcEngineReliability(), CalculateDesertLine(), CalculateSnowLine(), CanBuildVehicleInfrastructure(), CanFollowRoad(), AI::CanStartNew(), CheckBridgeAvailability(), CheckBuildableTile(), CheckforTownRating(), CheckIfAuthorityAllowsNewStation(), CheckIfCanLevelIndustryPlatform(), CheckIfTrainNeedsService(), CheckIndustryCloseDownProtection(), CheckNewIndustry_Farm(), CheckNewIndustry_Forest(), CheckNewTrain(), CheckNextTrainTile(), CheckRailSlope(), CheckRoadSlope(), CheckSwitchToEuro(), CheckTrainAttachment(), CheckTrainStayInDepot(), ChooseShipTrack(), ClickChangeMaxHlCheat(), CmdBuildRailWaypoint(), CmdBuildRoadDepot(), CmdBuildTrainDepot(), CmdConvertRail(), CmdFoundTown(), CmdGiveMoney(), CmdLevelLand(), CmdTerraformLand(), CompaniesMonthlyLoop(), ConvertDisplaySpeedToKmhishSpeed(), ConvertDisplaySpeedToSpeed(), ConvertKmhishSpeedToDisplaySpeed(), ConvertSpeedToDisplaySpeed(), CreateRivers(), DeleteStaleLinks(), DisplayVehicleSortDropDown(), DistanceFromEdgeDir(), DoTrainPathfind(), LinkGraphOverlay::DrawContent(), StationViewWindow::DrawEntries(), DrawRoadAsSnowDesert(), ScenarioEditorToolbarWindow::DrawWidget(), ExistingRoadTypes(), ExtendTrainReservation(), FillStaticNetworkServerGameInfo(), FindClosestTrainDepot(), FindSafePosition(), FindSpring(), FindSubsidyIndustryCargoRoute(), FindTownForIndustry(), FlatEmptyWorld(), FlowRiver(), FollowTrainReservation(), ForAllStationsAroundTiles(), FormatBytes(), FormatNumber(), FreightWagonMult(), AI::GameLoop(), ScriptInstance::GameLoop(), GenerateLandscape(), GenerateTerrainPerlin(), GenerateTownName(), GenerateTrees(), GetAcceptanceAroundTiles(), GetAirportNoiseLevelForDistance(), GetAmplitude(), Station::GetCatchmentRadius(), GetCompanyRailtypes(), GetCompanyRoadTypes(), Train::GetCurrentMaxSpeed(), RoadVehicle::GetCurrentMaxSpeed(), GetFreeUnitNumber(), GetGlobalVariable(), GetIndustryGamePlayProbability(), Engine::GetLifeLengthInDays(), GetLoadAmount(), GetMaskOfTownActions(), GetNormalGrowthRate(), GetOtherAqueductEnd(), GetRailTypes(), GetRandomTreeType(), GetRoadTypes(), GetScaledIndustryGenerationProbability(), RoadVehicle::GetSlopeSteepness(), Train::GetSlopeSteepness(), GetSnowLine(), GetTerrainType(), GetTileCatchmentRadius(), TownScopeResolver::GetVariable(), GfxLoadSprites(), GrayscaleToMapHeights(), GUIPlaceProcDragXY(), HasRailCatenaryDrawn(), HeightMapCoastLines(), HeightMapNormalize(), HeightMapSineTransform(), HighestSnowLine(), IndustryCargoesWindow::HousesCanAccept(), InitializeGRFSpecial(), AirportSpec::IsAvailable(), Engine::IsEnabled(), ObjectSpec::IsEverAvailable(), IsVehicleTypeDisabled(), PATSChunkHandler::Load(), LoadNewGRF(), LoadSpriteTables(), LowestSnowLine(), MakeLake(), Town::MaxTownNoise(), MaybeStartNewCompany(), MayCompanyTakeOver(), IndustryBuildData::MonthlyLoop(), Vehicle::NeedsServicing(), NetworkServerSetCompanyPassword(), NPFFindSafeTile(), NPFSaveTargetData(), LandInfoWindow::OnInit(), BuildIndustryWindow::OnInvalidateData(), BuildVehicleWindow::OnInvalidateData(), CompanyWindow::OnInvalidateData(), HighScoreWindow::OnPaint(), BuildAirportWindow::OnPaint(), BuildDocksStationWindow::OnPaint(), BuildRoadStationWindow::OnPaint(), CompanyWindow::OnPaint(), ScenarioEditorToolbarWindow::OnPaint(), OnTick_LinkGraph(), ScriptInstance::Pause(), PopulateStationsNearby(), SmallMapWindow::RebuildColourIndexIfNecessary(), Station::RecomputeCatchment(), RemoveAirport(), AI::ResetConfig(), RoadVehAccelerationModelChanged(), PATSChunkHandler::Save(), ServerNetworkGameSocketHandler::SendNeedCompanyPassword(), ServerNetworkGameSocketHandler::SendWelcome(), ServerNetworkAdminSocketHandler::SendWelcome(), SetStartingYear(), SetYearEngineAgingStops(), StationViewWindow::ShowCargo(), Vehicle::ShowVisualEffect(), StartupOneEngine(), StateGameLoop_LinkGraphPauseControl(), StationJoinerNeeded(), SubsidyMonthlyLoop(), TerraformTileHeight(), TestAutoslopeOnRailTile(), TGPGetMaxHeight(), ToolbarScenDatePanel(), TownLayoutAllows2x2HouseHere(), TownLayoutAllowsHouseHere(), TryReserveSafeTrack(), AI::Uninitialize(), UpdateAircraftSpeed(), UpdateLandscapingLimits(), Train::UpdateSpeed(), RoadVehicle::UpdateSpeed(), UpdateTownGrowth(), IndustrySpec::UsesOriginalEconomy(), VehicleServiceInDepot(), YapfRoadVehicleChooseTrack(), YapfShipCheckReverse(), YapfShipChooseTrack(), YapfTrainCheckReverse(), YapfTrainChooseTrack(), YapfTrainFindNearestDepot(), YapfTrainFindNearestSafeTile(), and LinkGraphJob::~LinkGraphJob().

◆ _settings_newgame