OpenTTD: src/settings.cpp File Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

Typedefs | Functions | Variables
settings.cpp File Reference

All actions handling saving and loading of the settings/configuration goes on in this file. More...

`#include "stdafx.h"`
`#include "currency.h"`
`#include "screenshot.h"`
`#include "network/network.h"`
`#include "network/network_func.h"`
`#include "settings_internal.h"`
`#include "command_func.h"`
`#include "console_func.h"`
`#include "pathfinder/pathfinder_type.h"`
`#include "genworld.h"`
`#include "train.h"`
`#include "news_func.h"`
`#include "window_func.h"`
`#include "sound_func.h"`
`#include "company_func.h"`
`#include "rev.h"`
`#include "fontcache.h"`
`#include "textbuf_gui.h"`
`#include "rail_gui.h"`
`#include "elrail_func.h"`
`#include "error.h"`
`#include "town.h"`
`#include "video/video_driver.hpp"`
`#include "sound/sound_driver.hpp"`
`#include "music/music_driver.hpp"`
`#include "blitter/factory.hpp"`
`#include "base_media_base.h"`
`#include "gamelog.h"`
`#include "settings_func.h"`
`#include "ini_type.h"`
`#include "ai/ai_config.hpp"`
`#include "ai/ai.hpp"`
`#include "game/game_config.hpp"`
`#include "game/game.hpp"`
`#include "ship.h"`
`#include "smallmap_gui.h"`
`#include "roadveh.h"`
`#include "fios.h"`
`#include "strings_func.h"`
`#include "void_map.h"`
`#include "station_base.h"`
`#include "table/strings.h"`
`#include "table/settings.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Typedefs
typedef std::list < ErrorMessageData > | ErrorList
typedef void | SettingDescProc (IniFile *ini, const SettingDesc *desc, const char *grpname, void *object)
typedef void | SettingDescProcList (IniFile *ini, const char *grpname, StringList *list)

## Functions
static bool | IsSignedVarMemType (VarType vt)
static size_t | LookupOneOfMany (const char *many, const char *one, size_t onelen=0)
| Find the index value of a ONEofMANY type in a string separated by |.
static size_t | LookupManyOfMany (const char *many, const char *str)
| Find the set-integer value MANYofMANY type in a string.
static int | ParseIntList (const char *p, int *items, int maxitems)
| Parse an integerlist string and set each found value.
static bool | LoadIntList (const char *str, void *array, int nelems, VarType type)
| Load parsed string-values into an integer-array (intlist)
static void | MakeIntList (char *buf, const char *last, const void *array, int nelems, VarType type)
| Convert an integer-array (intlist) to a string representation.
static void | MakeOneOfMany (char *buf, const char *last, const char *many, int id)
| Convert a ONEofMANY structure to a string representation.
static void | MakeManyOfMany (char *buf, const char *last, const char *many, uint32 x)
| Convert a MANYofMANY structure to a string representation.
static const void * | StringToVal (const SettingDescBase *desc, const char *orig_str)
| Convert a string representation (external) of a setting to the internal rep.
static void | Write_ValidateSetting (void *ptr, const SettingDesc *sd, int32 val)
| Set the value of a setting and if needed clamp the value to the preset minimum and maximum.
static void | IniLoadSettings (IniFile *ini, const SettingDesc *sd, const char *grpname, void *object)
| Load values from a group of an IniFile structure into the internal representation.
static void | IniSaveSettings (IniFile *ini, const SettingDesc *sd, const char *grpname, void *object)
| Save the values of settings to the inifile.
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 NULL 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.
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 NULL pointer, in this case a callback function should be defined that will provide the source data to be saved.
void | IniLoadWindowSettings (IniFile *ini, const char *grpname, void *desc)
| Load a WindowDesc from config.
void | IniSaveWindowSettings (IniFile *ini, const char *grpname, void *desc)
| Save a WindowDesc to config.
static bool | v_PositionMainToolbar (int32 p1)
| Reposition the main toolbar as the setting changed.
static bool | v_PositionStatusbar (int32 p1)
| Reposition the statusbar as the setting changed.
static bool | PopulationInLabelActive (int32 p1)
static bool | RedrawScreen (int32 p1)
static bool | RedrawSmallmap (int32 p1)
| Redraw the smallmap after a colour scheme change.
static bool | InvalidateDetailsWindow (int32 p1)
static bool | StationSpreadChanged (int32 p1)
static bool | InvalidateBuildIndustryWindow (int32 p1)
static bool | CloseSignalGUI (int32 p1)
static bool | InvalidateTownViewWindow (int32 p1)
static bool | DeleteSelectStationWindow (int32 p1)
static bool | UpdateConsists (int32 p1)
static bool | CheckInterval (int32 p1)
static bool | UpdateInterval (VehicleType type, int32 p1)
static bool | UpdateIntervalTrains (int32 p1)
static bool | UpdateIntervalRoadVeh (int32 p1)
static bool | UpdateIntervalShips (int32 p1)
static bool | UpdateIntervalAircraft (int32 p1)
static bool | TrainAccelerationModelChanged (int32 p1)
static bool | TrainSlopeSteepnessChanged (int32 p1)
| This function updates the train acceleration cache after a steepness change.
static bool | RoadVehAccelerationModelChanged (int32 p1)
| This function updates realistic acceleration caches when the setting "Road vehicle acceleration model" is set.
static bool | RoadVehSlopeSteepnessChanged (int32 p1)
| This function updates the road vehicle acceleration cache after a steepness change.
static bool | DragSignalsDensityChanged (int32)
static bool | TownFoundingChanged (int32 p1)
static bool | InvalidateVehTimetableWindow (int32 p1)
static bool | ZoomMinMaxChanged (int32 p1)
static bool | InvalidateNewGRFChangeWindows (int32 p1)
| Update any possible saveload window and delete any newgrf dialogue as its widget parts might change.
static bool | InvalidateCompanyLiveryWindow (int32 p1)
static bool | InvalidateIndustryViewWindow (int32 p1)
static bool | InvalidateAISettingsWindow (int32 p1)
static bool | RedrawTownAuthority (int32 p1)
| Update the town authority window after a town authority setting change.
static bool | InvalidateCompanyInfrastructureWindow (int32 p1)
| Invalidate the company infrastructure details window after a infrastructure maintenance setting change.
static bool | InvalidateCompanyWindow (int32 p1)
| Invalidate the company details window after the shares setting changed.
static void | ValidateSettings ()
| Checks if any settings are set to incorrect values, and sets them to correct values in that case.
static bool | DifficultyNoiseChange (int32 i)
static bool | MaxNoAIsChange (int32 i)
static bool | CheckRoadSide (int p1)
| Check whether the road side may be changed.
static size_t | ConvertLandscape (const char *value)
| Conversion callback for _gameopt_settings_game.landscape It converts (or try) between old values and the new ones, without losing initial setting of the user.
static bool | CheckFreeformEdges (int32 p1)
static bool | ChangeDynamicEngines (int32 p1)
| Changing the setting "allow multiple NewGRF sets" is not allowed if there are vehicles.
static bool | ChangeMaxHeightLevel (int32 p1)
static bool | StationCatchmentChanged (int32 p1)
static bool | UpdateClientName (int32 p1)
static bool | UpdateServerPassword (int32 p1)
static bool | UpdateRconPassword (int32 p1)
static bool | UpdateClientConfigValues (int32 p1)
static void | PrepareOldDiffCustom ()
| Prepare for reading and old diff_custom by zero-ing the memory.
static void | HandleOldDiffCustom (bool savegame)
| Reading of the old diff_custom array and transforming it to the new format.
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.
static bool | DecodeHexText (char *pos, uint8 *dest, size_t dest_size)
| Parse a sequence of characters (supposedly hex digits) into a sequence of bytes.
static GRFConfig * | GRFLoadConfig (IniFile *ini, const char *grpname, bool is_static)
| Load a GRF configuration.
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.
static void | GRFSaveConfig (IniFile *ini, const char *grpname, const GRFConfig *list)
static void | HandleSettingDescs (IniFile *ini, SettingDescProc *proc, SettingDescProcList *proc_list, bool basic_settings=true, bool other_settings=true)
static IniFile * | IniLoadConfig ()
void | LoadFromConfig (bool minimal)
| Load the values from the configuration files.
void | SaveToConfig ()
| Save the values to the configuration file.
void | GetGRFPresetList (GRFPresetList *list)
| Get the list of known NewGrf presets.
GRFConfig * | LoadGRFPresetFromConfig (const char *config_name)
| Load a NewGRF configuration by preset-name.
void | SaveGRFPresetToConfig (const char *config_name, GRFConfig *config)
| Save a NewGRF configuration with a preset name.
void | DeleteGRFPresetFromConfig (const char *config_name)
| Delete a NewGRF configuration by preset name.
const SettingDesc * | GetSettingDescription (uint index)
CommandCost | CmdChangeSetting (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
| Network-safe changing of settings (server-only).
CommandCost | CmdChangeCompanySetting (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
| Change one of the per-company settings.
bool | SetSettingValue (uint index, int32 value, bool force_newgame)
| Top function to save the new value of an element of the Settings struct.
void | SetCompanySetting (uint index, int32 value)
| Top function to save the new value of an element of the Settings struct.
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.
uint | GetCompanySettingIndex (const char *name)
| Get the index in the _company_settings array of a setting.
bool | SetSettingValue (uint index, const char *value, bool force_newgame)
| Set a setting value with a string.
const SettingDesc * | GetSettingFromName (const char *name, uint *i)
| Given a name of setting, return a setting description of it.
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.
void | IConsoleListSettings (const char *prefilter)
| List all settings and their value to the console.
static void | LoadSettings (const SettingDesc *osd, void *object)
| Save and load handler for settings.
static void | SaveSettings (const SettingDesc *sd, void *object)
| Save and load handler for settings.
static void | Load_OPTS ()
static void | Load_PATS ()
static void | Check_PATS ()
static void | Save_PATS ()
void | CheckConfig ()

## Variables
ClientSettings | _settings_client
| The current settings for this game.
GameSettings | _settings_game
| Game settings of a running game or the scenario editor.
GameSettings | _settings_newgame
| Game settings for new games (updated from the intro screen).
VehicleDefaultSettings | _old_vds
| Used for loading default vehicles settings from old savegames.
char * | _config_file
| Configuration file of OpenTTD.
static ErrorList | _settings_error_list
| Errors while loading minimal settings.
static const char *const | _list_group_names []
| Groups in openttd.cfg that are actually lists.
const ChunkHandler | _setting_chunk_handlers []

## 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.

## Function Documentation

static bool CheckRoadSide | ( | int | p1 | ) |
| static

Check whether the road side may be changed.

Parameters

  p1 | unused

Returns
  true if the road side may be changed.

Definition at line 1184 of file settings.cpp.

References RoadVehiclesAreBuilt().

CommandCost CmdChangeCompanySetting | ( | TileIndex | tile,
|  | DoCommandFlag | flags,
|  | uint32 | p1,
|  | uint32 | p2,
|  | const char * | text
| ) |  |

Change one of the per-company settings.

Parameters

  tile | unused
  flags | operation to perform
  p1 | the index of the setting in the _company_settings array which identifies it
  p2 | the new value for the setting The new value is properly clamped to its minimum/maximum when setting
  text | unused

Returns
  the cost of this operation or an error

Definition at line 1877 of file settings.cpp.

References _current_company, CMD_ERROR, SaveLoad::conv, DC_EXEC, SettingDesc::desc, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetVariableAddress(), lengthof, SettingDescBase::proc, ReadValue(), SettingDesc::save, SetWindowClassesDirty(), WC_GAME_OPTIONS, Write_ValidateSetting(), and WriteValue().

CommandCost CmdChangeSetting | ( | TileIndex | tile,
|  | DoCommandFlag | flags,
|  | uint32 | p1,
|  | uint32 | p2,
|  | const char * | text
| ) |  |

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

Parameters

  tile | unused
  flags | operation to perform
  p1 | the index of the setting in the SettingDesc array which identifies it
  p2 | the new value for the setting The new value is properly clamped to its minimum/maximum when setting
  text | unused

Returns
  the cost of this operation or an error

See Also
  _settings

Definition at line 1830 of file settings.cpp.

References CMD_ERROR, SaveLoad::conv, DC_EXEC, SettingDesc::desc, SettingDescBase::flags, GamelogSetting(), GamelogStartAction(), GamelogStopAction(), GetGameSettings(), GetVariableAddress(), GLAT_SETTING, SettingDesc::IsEditable(), SettingDescBase::name, SettingDescBase::proc, ReadValue(), SettingDesc::save, SetWindowClassesDirty(), SGF_NO_NETWORK, SlIsObjectCurrentlyValid(), SaveLoad::version_from, SaveLoad::version_to, WC_GAME_OPTIONS, Write_ValidateSetting(), and WriteValue().

static size_t ConvertLandscape | ( | const char * | value | ) |
| static

Conversion callback for _gameopt_settings_game.landscape It converts (or try) between old values and the new ones, without losing initial setting of the user.

Parameters

  value | that was read from config file

Returns
  the "hopefully" converted value

Definition at line 1197 of file settings.cpp.

References LookupOneOfMany().

static int DecodeHexNibble | ( | char | c | ) |
| static

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

Parameters

  c | Character to convert.

Returns
  Hex value of the character, or `-1` if not a hex digit.

Definition at line 1442 of file settings.cpp.

Referenced by DecodeHexText().

static bool DecodeHexText | ( | 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

  pos | First character to convert.
  dest | [out] Output byte array to write the bytes.
  dest_size | Number of bytes in dest.

Returns
  Whether reading was successful.

Definition at line 1458 of file settings.cpp.

References DecodeHexNibble().

Referenced by GRFLoadConfig().

void DeleteGRFPresetFromConfig | ( | const char * | config_name | ) |

Delete a NewGRF configuration by preset name.

Parameters

  config_name | Name of the preset.

Definition at line 1801 of file settings.cpp.

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

Referenced by NewGRFWindow::OnClick().

uint GetCompanySettingIndex | ( | const char * | name | ) |

Get the index in the _company_settings array of a setting.

Parameters

  name | The name of the setting

Returns
  The index in the _company_settings array

Definition at line 2000 of file settings.cpp.

References SettingDesc::desc, SettingDescBase::flags, GetSettingFromName(), and SGF_PER_COMPANY.

Referenced by ReplaceVehicleWindow::OnClick().

void GetGRFPresetList | ( | GRFPresetList * | list | ) |

Get the list of known NewGrf presets.

Parameters

  list[inout] | Pointer to list for storing the preset names.

Definition at line 1745 of file settings.cpp.

References SmallVector< T, S >::Append(), AutoFreeSmallVector< T, S >::Clear(), IniLoadFile::group, IniGroup::name, IniGroup::next, and stredup().

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

const SettingDesc* GetSettingFromName | ( | const char * | name,
|  | uint * | i
| ) |  |

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

Parameters

  name | Name of the setting to return a setting description of
  i | Pointer to an integer that will contain the index of the setting after the call, if it is successful.

Returns
  Pointer to the setting description of setting name if it can be found, `NULL` indicates failure to obtain the description

Definition at line 2040 of file settings.cpp.

References SaveLoad::cmd, SettingDesc::desc, SettingDescBase::name, SettingDesc::save, SlIsObjectCurrentlyValid(), SaveLoad::version_from, and SaveLoad::version_to.

Referenced by GetCompanySettingIndex(), NewsTypeData::GetDisplay(), IConsoleGetSetting(), SettingEntry::Init(), and GameOptionsWindow::OnDropdownSelect().

static GRFConfig* GRFLoadConfig | ( | IniFile * | ini,
|  | const char * | grpname,
|  | bool | is_static
| ) |  |
| static

Load a GRF configuration.

Parameters

  ini | The configuration to read from.
  grpname | Group name containing the configuration of the GRF.
  is_static | GRF is static.

Definition at line 1477 of file settings.cpp.

References DecodeHexText(), FGCM_EXACT, FGCM_NEWEST_VALID, GRFConfig::filename, FillGRFDetails(), FindGRFConfig(), FioCheckFileExists(), GRFConfig::flags, GCF_INVALID, GCF_STATIC, GCF_SYSTEM, GCF_UNSAFE, GCS_NOT_FOUND, IniLoadFile::GetGroup(), GRFIdentifier::grfid, HasBit(), GRFConfig::ident, IniGroup::item, lengthof, IniItem::name, NEWGRF_DIR, IniItem::next, GRFConfig::next, GRFConfig::num_params, GRFConfig::param, ParseIntList(), SetBit(), SetDParam(), SetDParamStr(), ShowErrorMessage(), GRFConfig::status, StrEmpty(), IniItem::value, and WL_CRITICAL.

Referenced by LoadFromConfig(), and LoadGRFPresetFromConfig().

static void HandleOldDiffCustom | ( | bool | savegame | ) |
| static

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

Parameters

  savegame | is 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 1360 of file settings.cpp.

References GetVariableAddress(), IsSavegameVersionBefore(), SettingDesc::save, SlIsObjectCurrentlyValid(), SaveLoad::version_from, SaveLoad::version_to, and Write_ValidateSetting().

Referenced by LoadFromConfig().

void IConsoleGetSetting | ( | const char * | name,
|  | bool | force_newgame
| ) |  |

Output value of a specific setting to the console.

Parameters

  name | Name of the setting to output its value
  force_newgame | force the newgame settings

Definition at line 2119 of file settings.cpp.

References CC_WARNING, SettingDescBase::cmd, SaveLoad::conv, SettingDesc::desc, SettingDescBase::flags, GetSettingFromName(), GetVariableAddress(), GetVarMemType(), IConsolePrintF(), lastof, SettingDescBase::max, SettingDescBase::min, ReadValue(), SettingDesc::save, SDT_BOOLX, SDT_STRING, seprintf(), SGF_0ISDISABLED, and SLE_VAR_STRQ.

void IConsoleListSettings | ( | const char * | prefilter | ) |

List all settings and their value to the console.

Parameters

  prefilter | If not `NULL`, only list settings with names that begin with prefilter prefix

Definition at line 2152 of file settings.cpp.

References CC_DEFAULT, CC_WARNING, SettingDescBase::cmd, SaveLoad::cmd, SaveLoad::conv, SettingDesc::desc, GetGameSettings(), GetVariableAddress(), GetVarMemType(), IConsolePrintF(), lastof, SettingDescBase::min, SettingDescBase::name, ReadValue(), SettingDesc::save, SDT_BOOLX, SDT_STRING, seprintf(), SLE_VAR_STRQ, SlIsObjectCurrentlyValid(), SaveLoad::version_from, and SaveLoad::version_to.

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 NULL 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

  ini | IniFile handle to the ini file with the source data
  grpname | character string identifying the section-header of the ini file that will be parsed
  list | new list with entries of the given section

Definition at line 703 of file settings.cpp.

References SmallVector< T, S >::Append(), AutoFreeSmallVector< T, S >::Clear(), IniLoadFile::GetGroup(), IniGroup::item, IniItem::next, and stredup().

Referenced by LoadFromConfig().

static void IniLoadSettings | ( | IniFile * | ini,
|  | const SettingDesc * | sd,
|  | const char * | grpname,
|  | void * | object
| ) |  |
| static

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

Parameters

  ini | pointer to IniFile structure that holds administrative information
  sd | pointer to SettingDesc structure whose internally pointed variables will be given values
  grpname | the group of the IniFile to search in for the new values
  object | pointer to the object been loaded

Definition at line 476 of file settings.cpp.

References _settings_error_list, SettingDescBase::cmd, SaveLoad::cmd, SaveLoad::conv, SettingDescBase::def, SettingDesc::desc, free(), IniLoadFile::GetGroup(), IniGroup::GetItem(), GetVariableAddress(), GetVarMemType(), SaveLoad::length, LoadIntList(), SettingDescBase::name, SettingDescBase::proc_cnvt, SettingDesc::save, SDT_BOOLX, SDT_INTLIST, SDT_MANYOFMANY, SDT_NUMX, SDT_ONEOFMANY, SDT_STRING, ErrorMessageData::SetDParamStr(), SLE_VAR_STR, SLE_VAR_STRB, SLE_VAR_STRBQ, SLE_VAR_STRQ, SlIsObjectCurrentlyValid(), strecpy(), stredup(), StringToVal(), IniItem::value, SaveLoad::version_from, SaveLoad::version_to, and Write_ValidateSetting().

Referenced by IniLoadWindowSettings(), and LoadFromConfig().

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

Load a WindowDesc from config.

Parameters

  ini | IniFile handle to the ini file with the source data
  grpname | character string identifying the section-header of the ini file that will be parsed
  desc | Destination WindowDesc

Definition at line 743 of file settings.cpp.

References IniLoadSettings().

Referenced by WindowDesc::LoadFromConfig().

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 NULL pointer, in this case a callback function should be defined that will provide the source data to be saved.

Parameters

  ini | IniFile handle to the ini file where the destination data is saved
  grpname | character string identifying the section-header of the ini file
  list | pointer to an string(pointer) array that will be used as the source to be saved into the relevant ini section

Definition at line 725 of file settings.cpp.

References SmallVector< T, S >::Begin(), IniGroup::Clear(), SmallVector< T, S >::End(), IniLoadFile::GetGroup(), IniGroup::GetItem(), and IniItem::SetValue().

Referenced by SaveToConfig().

static void IniSaveSettings | ( | IniFile * | ini,
|  | const SettingDesc * | sd,
|  | const char * | grpname,
|  | void * | object
| ) |  |
| static

Save the values of settings to the inifile.

Parameters

  ini | pointer to IniFile structure
  sd | read-only SettingDesc structure which contains the unmodified, loaded values of the configuration file and various information about it
  grpname | holds the name of the group (eg. [network]) where these will be saved
  object | pointer 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 574 of file settings.cpp.

References SettingDescBase::cmd, SaveLoad::cmd, SaveLoad::conv, SettingDesc::desc, free(), IniLoadFile::GetGroup(), GetVariableAddress(), GetVarMemType(), lastof, SaveLoad::length, MakeIntList(), MakeManyOfMany(), MakeOneOfMany(), SettingDescBase::many, SettingDescBase::name, ReadValue(), SettingDesc::save, SDT_BOOLX, SDT_INTLIST, SDT_MANYOFMANY, SDT_NUMX, SDT_ONEOFMANY, SDT_STRING, seprintf(), SLE_VAR_STR, SLE_VAR_STRB, SLE_VAR_STRBQ, SLE_VAR_STRQ, SLF_NOT_IN_CONFIG, SlIsObjectCurrentlyValid(), strecpy(), stredup(), StringToVal(), IniItem::value, SaveLoad::version_from, and SaveLoad::version_to.

Referenced by IniSaveWindowSettings(), and SaveToConfig().

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

Save a WindowDesc to config.

Parameters

  ini | IniFile handle to the ini file where the destination data is saved
  grpname | character string identifying the section-header of the ini file
  desc | Source WindowDesc

Definition at line 754 of file settings.cpp.

References IniSaveSettings().

Referenced by WindowDesc::SaveToConfig().

static bool InvalidateCompanyInfrastructureWindow | ( | int32 | p1 | ) |
| static

Invalidate the company infrastructure details window after a infrastructure maintenance setting change.

Parameters

  p1 | Unused.

Returns
  Always true.

Definition at line 1129 of file settings.cpp.

References InvalidateWindowClassesData(), and WC_COMPANY_INFRASTRUCTURE.

static bool InvalidateCompanyWindow | ( | int32 | p1 | ) |
| static

Invalidate the company details window after the shares setting changed.

Parameters

  p1 | Unused.

Returns
  Always true.

Definition at line 1140 of file settings.cpp.

References InvalidateWindowClassesData(), and WC_COMPANY.

static bool InvalidateNewGRFChangeWindows | ( | int32 | p1 | ) |
| static

Update any possible saveload window and delete any newgrf dialogue as its widget parts might change.

Reinit all windows as it allows access to the newgrf debug button.

Parameters

  p1 | unused.

Returns
  Always true.

Definition at line 1087 of file settings.cpp.

References DeleteWindowByClass(), InvalidateWindowClassesData(), ReInitAllWindows(), WC_GAME_OPTIONS, and WC_SAVELOAD.

void LoadFromConfig | ( | bool | minimal | ) |

Load the values from the configuration files.

Parameters

  minimal | Load the minimal amount of the configuration to "bootstrap" the blitter and such.

Definition at line 1692 of file settings.cpp.

References _grfconfig_newgame, _grfconfig_static, _settings_error_list, FindWindowById(), GRFLoadConfig(), HandleOldDiffCustom(), IniLoadSettingList(), IniLoadSettings(), PrepareOldDiffCustom(), ResetCurrencies(), ScheduleErrorMessage(), ShowFirstError(), ValidateSettings(), and WC_ERRMSG.

Referenced by AfterNewGRFScan::OnNewGRFsScanned(), and openttd_main().

GRFConfig* LoadGRFPresetFromConfig | ( | const char * | config_name | ) |
| read

Load a NewGRF configuration by preset-name.

Parameters

  config_name | Name of the preset.

Returns
  NewGRF configuration.

See Also
  GetGRFPresetList

Definition at line 1766 of file settings.cpp.

References GRFLoadConfig(), and seprintf().

Referenced by NewGRFWindow::OnDropdownSelect().

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

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

Parameters

  str | the string that contains the values (and will be parsed)
  array | pointer to the integer-arrays that will be filled
  nelems | the number of elements the array holds. Maximum is 64 elements
  type | the type of elements the array holds (eg INT8, UINT16, etc.)

Returns
  return true on success and false on error

Definition at line 215 of file settings.cpp.

References lengthof, and ParseIntList().

Referenced by IniLoadSettings().

static void LoadSettings | ( | const SettingDesc * | osd,
|  | void * | object
| ) |  |
| static

Save and load handler for settings.

Parameters

  osd | SettingDesc struct containing all information
  object | can be either NULL in which case we load global variables or a pointer to a struct which is getting saved

Definition at line 2181 of file settings.cpp.

References SaveLoad::cmd, SaveLoad::conv, GetVariableAddress(), IsNumericType(), ReadValue(), SettingDesc::save, and Write_ValidateSetting().

static size_t LookupManyOfMany | ( | const char * | many,
|  | const char * | str
| ) |  |
| static

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

Parameters

  many | full domain of values the MANYofMANY setting can have
  str | the 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 138 of file settings.cpp.

References LookupOneOfMany(), and SetBit().

Referenced by StringToVal().

static size_t LookupOneOfMany | ( | const char * | many,
|  | const char * | one,
|  | size_t | onelen = `0`
| ) |  |
| static

Find the index value of a ONEofMANY type in a string separated by |.

Parameters

  many | full domain of values the ONEofMANY setting can have
  one | the current value of the setting for which a value needs found
  onelen | force calculation of the *one parameter

Returns
  the integer index of the full-list, or -1 if not found

Definition at line 109 of file settings.cpp.

Referenced by ConvertLandscape(), LookupManyOfMany(), and StringToVal().

static void MakeIntList | ( | char * | buf,
|  | const char * | last,
|  | const void * | array,
|  | int | nelems,
|  | VarType | type
| ) |  |
| static

Convert an integer-array (intlist) to a string representation.

Each value is separated by a comma or a space character

Parameters

  buf | output buffer where the string-representation will be stored
  last | last item to write to in the output buffer
  array | pointer to the integer-arrays that is read from
  nelems | the number of elements the array holds.
  type | the type of elements the array holds (eg INT8, UINT16, etc.)

Definition at line 260 of file settings.cpp.

References seprintf().

Referenced by IniSaveSettings().

static void MakeManyOfMany | ( | char * | buf,
|  | const char * | last,
|  | const char * | many,
|  | uint32 | x
| ) |  |
| static

Convert a MANYofMANY structure to a string representation.

Parameters

  buf | output buffer where the string-representation will be stored
  last | last item to write to in the output buffer
  many | the full-domain string of possible values
  x | the value of the variable and whose string-representation must be found in the bitmasked many string

Definition at line 315 of file settings.cpp.

References HasBit(), and seprintf().

Referenced by IniSaveSettings().

static void MakeOneOfMany | ( | char * | buf,
|  | const char * | last,
|  | const char * | many,
|  | int | id
| ) |  |
| static

Convert a ONEofMANY structure to a string representation.

Parameters

  buf | output buffer where the string-representation will be stored
  last | last item to write to in the output buffer
  many | the full-domain string of possible values
  id | the value of the variable and whose string-representation must be found

Definition at line 287 of file settings.cpp.

References seprintf().

Referenced by IniSaveSettings().

static int ParseIntList | ( | const char * | p,
|  | int * | items,
|  | int | maxitems
| ) |  |
| static

Parse an integerlist string and set each found value.

Parameters

  p | the string to be parsed. Each element in the list is separated by a comma or a space character
  items | pointer to the integerlist-array that will be filled with values
  maxitems | the maximum number of elements the integerlist-array has

Returns
  returns the number of items found, or -1 on an error

Definition at line 170 of file settings.cpp.

References ClampToI32().

Referenced by GRFLoadConfig(), and LoadIntList().

static bool RedrawSmallmap | ( | int32 | p1 | ) |
| static

Redraw the smallmap after a colour scheme change.

Parameters

  p1 | Callback parameter.

Returns
  Always true.

Definition at line 822 of file settings.cpp.

References BuildLandLegend(), BuildOwnerLegend(), SetWindowClassesDirty(), and WC_SMALLMAP.

static bool RedrawTownAuthority | ( | int32 | p1 | ) |
| static

Update the town authority window after a town authority setting change.

Parameters

  p1 | Unused.

Returns
  Always true.

Definition at line 1118 of file settings.cpp.

References SetWindowClassesDirty(), and WC_TOWN_AUTHORITY.

static bool RoadVehAccelerationModelChanged | ( | int32 | p1 | ) |
| static

This function updates realistic acceleration caches when the setting "Road vehicle acceleration model" is set.

Parameters

  p1 | Callback parameter

Returns
  Always true

Definition at line 1009 of file settings.cpp.

References GroundVehicle< T, Type >::CargoChanged(), InvalidateWindowClassesData(), Vehicle::IsFrontEngine(), VehicleSettings::roadveh_acceleration_model, SetWindowClassesDirty(), GameSettings::vehicle, WC_BUILD_VEHICLE, WC_ENGINE_PREVIEW, and WC_VEHICLE_DETAILS.

static bool RoadVehSlopeSteepnessChanged | ( | int32 | p1 | ) |
| static

This function updates the road vehicle acceleration cache after a steepness change.

Parameters

  p1 | Callback parameter.

Returns
  Always true.

Definition at line 1033 of file settings.cpp.

References GroundVehicle< T, Type >::CargoChanged(), and Vehicle::IsFrontEngine().

void SaveGRFPresetToConfig | ( | const char * | config_name,
|  | GRFConfig * | config
| ) |  |

Save a NewGRF configuration with a preset name.

Parameters

  config_name | Name of the preset.
  config | NewGRF configuration to save.

See Also
  GetGRFPresetList

Definition at line 1785 of file settings.cpp.

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

Referenced by NewGRFWindow::OnQueryTextFinished().

static void SaveSettings | ( | const SettingDesc * | sd,
|  | void * | object
| ) |  |
| static

Save and load handler for settings.

Parameters

  sd | SettingDesc struct containing all information
  object | can be either NULL in which case we load global variables or a pointer to a struct which is getting saved

Definition at line 2198 of file settings.cpp.

References SaveLoad::cmd, GetVariableAddress(), SettingDesc::save, and SlSetLength().

static void SaveVersionInConfig | ( | IniFile * | ini | ) |
| static

Save the version of OpenTTD to the ini file.

Parameters

  ini | the ini to write to

Definition at line 1621 of file settings.cpp.

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

Referenced by SaveToConfig().

void SetCompanySetting | ( | uint | index,
|  | int32 | value
| ) |  |

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

Parameters

  index | offset in the SettingDesc array of the CompanySettings struct which identifies the setting member we want to change
  value | new value of the setting

Definition at line 1952 of file settings.cpp.

References _local_company, CMD_CHANGE_COMPANY_SETTING, ClientSettings::company, SaveLoad::conv, SettingDesc::desc, DoCommandP(), GetVariableAddress(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), SettingDescBase::proc, ReadValue(), SettingDesc::save, and Write_ValidateSetting().

Referenced by GameSettingsWindow::OnClick(), GameSettingsWindow::OnDropdownSelect(), and GameSettingsWindow::OnQueryTextFinished().

bool SetSettingValue | ( | uint | index,
|  | int32 | value,
|  | bool | force_newgame
| ) |  |

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

Parameters

  index | offset in the SettingDesc array of the Settings struct which identifies the setting member we want to change
  value | new value of the setting
  force_newgame | force the newgame settings

Definition at line 1911 of file settings.cpp.

References _network_server, _networking, CMD_CHANGE_SETTING, SaveLoad::conv, SettingDesc::desc, DoCommandP(), GetGameSettings(), GetVariableAddress(), SettingDescBase::proc, ReadValue(), SettingDesc::save, SetWindowClassesDirty(), SLF_NO_NETWORK_SYNC, WC_GAME_OPTIONS, and Write_ValidateSetting().

Referenced by GameSettingsWindow::OnClick(), GameOptionsWindow::OnDropdownSelect(), GameSettingsWindow::OnDropdownSelect(), and GameSettingsWindow::OnQueryTextFinished().

bool SetSettingValue | ( | uint | index,
|  | const char * | value,
|  | bool | force_newgame
| ) |  |

Set a setting value with a string.

Parameters

  index | the settings index.
  value | the value to write
  force_newgame | force the newgame settings

Note
  Strings WILL NOT be synced over the network

Definition at line 2015 of file settings.cpp.

References _settings_game, SaveLoad::conv, SettingDesc::desc, free(), GetVariableAddress(), GetVarMemType(), SaveLoad::length, SettingDescBase::proc, SettingDesc::save, SLE_VAR_STRQ, SLF_NO_NETWORK_SYNC, strecpy(), and stredup().

static const void* StringToVal | ( | const SettingDescBase * | desc,
|  | const char * | orig_str
| ) |  |
| static

Convert a string representation (external) of a setting to the internal rep.

Parameters

  desc | SettingDesc struct that holds all information about the variable
  orig_str | input string that will be parsed based on the type of desc

Returns
  return the parsed value of the setting

Definition at line 348 of file settings.cpp.

References _settings_error_list, SettingDescBase::cmd, SettingDescBase::def, LookupManyOfMany(), LookupOneOfMany(), SettingDescBase::many, SettingDescBase::name, SettingDescBase::proc_cnvt, SDT_BOOLX, SDT_INTLIST, SDT_MANYOFMANY, SDT_NUMX, SDT_ONEOFMANY, SDT_STRING, and ErrorMessageData::SetDParamStr().

Referenced by IniLoadSettings(), and IniSaveSettings().

static bool TrainSlopeSteepnessChanged | ( | int32 | p1 | ) |
| static

This function updates the train acceleration cache after a steepness change.

Parameters

  p1 | Callback parameter.

Returns
  Always true.

Definition at line 994 of file settings.cpp.

References GroundVehicle< T, Type >::CargoChanged(), and Vehicle::IsFrontEngine().

static bool v_PositionMainToolbar | ( | int32 | p1 | ) |
| static

Reposition the main toolbar as the setting changed.

Definition at line 788 of file settings.cpp.

References PositionMainToolbar().

static bool v_PositionStatusbar | ( | int32 | p1 | ) |
| static

Reposition the statusbar as the setting changed.

Definition at line 795 of file settings.cpp.

References PositionNetworkChatWindow(), PositionNewsMessage(), and PositionStatusbar().

static void ValidateSettings | ( |  | ) |
| static

Checks if any settings are set to incorrect values, and sets them to correct values in that case.

Definition at line 1147 of file settings.cpp.

References CUSTOM_SEA_LEVEL_MIN_PERCENTAGE, CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY, GameSettings::difficulty, GameSettings::game_creation, GameCreationSettings::land_generator, and DifficultySettings::quantity_sea_lakes.

Referenced by LoadFromConfig().

static void Write_ValidateSetting | ( | void * | ptr,
|  | const SettingDesc * | sd,
|  | int32 | val
| ) |  |
| static

Set the value of a setting and if needed clamp the value to the preset minimum and maximum.

Parameters

  ptr | the variable itself
  sd | pointer to the 'information'-database of the variable
  val | signed long version of the new value

Precondition
  SettingDesc is of type SDT_BOOLX, SDT_NUMX, SDT_ONEOFMANY or SDT_MANYOFMANY. Other types are not supported as of now

Definition at line 423 of file settings.cpp.

References Clamp(), ClampU(), SettingDescBase::cmd, SaveLoad::conv, SettingDesc::desc, SettingDescBase::flags, GetVarMemType(), SettingDescBase::max, min(), SettingDescBase::min, SettingDesc::save, SDT_BOOLX, SDT_MANYOFMANY, SDT_NUMX, SDT_ONEOFMANY, SGF_0ISDISABLED, SLE_VAR_NULL, and WriteValue().

Referenced by CmdChangeCompanySetting(), CmdChangeSetting(), HandleOldDiffCustom(), IniLoadSettings(), LoadSettings(), SetCompanySetting(), SetDefaultCompanySettings(), and SetSettingValue().

## Variable Documentation

const char* const _list_group_names[]
| static

Initial value:
{
"bans",
"newgrf",
"servers",
"server_bind_addresses",
NULL
}

Groups in openttd.cfg that are actually lists.

Definition at line 94 of file settings.cpp.

VehicleDefaultSettings _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 79 of file settings.cpp.

Referenced by AfterLoadGame().

const ChunkHandler _setting_chunk_handlers[]

Initial value:
{
{ 'OPTS', NULL, Load_OPTS, NULL, NULL, CH_RIFF},
{ 'PATS', Save_PATS, Load_PATS, NULL, Check_PATS, CH_RIFF | CH_LAST},
}

ClientSettings _settings_client

The current settings for this game.

Definition at line 76 of file settings.cpp.

Referenced by AddNewsItem(), AfterLoadGame(), AIDebugWindow::AIDebugWindow(), ServerNetworkAdminSocketHandler::AllowConnection(), ServerNetworkGameSocketHandler::AllowConnection(), AmbientSoundEffectCallback(), AnimationBase< IndustryAnimationBase, IndustryTileSpec, Industry, int, GetSimpleIndustryCallback >::AnimateTile(), GameOptionsWindow::BuildDropDownList(), BuildLandLegend(), BuildOwnerLegend(), BuildRailClick_Remove(), CalcRaildirsDrawstyle(), CanBuildVehicleInfrastructure(), CcBuildBridge(), CcBuildRailTunnel(), CcBuildRoadTunnel(), CcRoadStop(), AnimationBase< IndustryAnimationBase, IndustryTileSpec, Industry, int, GetSimpleIndustryCallback >::ChangeAnimationFrame(), CheckMinActiveClients(), CheckOrders(), CheckPauseOnJoin(), BuildRailStationWindow::CheckSelectedSize(), CheckSoftLimit(), CheckTrainCollision(), CheckTrainStayInDepot(), ClearPathReservation(), CmdCompanyCtrl(), CommonRaiseLowerBigLand(), CompaniesYearlyLoop(), CompanyServiceInterval(), Order::ConvertFromOldSavegame(), CrashAirplane(), DisasterTick_Aircraft(), DisasterTick_Big_Ufo_Destroyer(), DisasterTick_Ufo(), DisasterTick_Zeppeliner(), DispatchRightClickEvent(), DistributeQueue(), DoAutosave(), GRFFileScanner::DoScan(), ClientNetworkContentSocketHandler::DownloadSelectedContent(), DoZoomInOutWindow(), DrawCategories(), BaseGraphWindow::DrawGraph(), DrawTile_Road(), DrawTile_TunnelBridge(), DrawTrackBits(), TimetableWindow::DrawWidget(), MusicTrackSelectionWindow::DrawWidget(), MusicWindow::DrawWidget(), NetworkStartServerWindow::DrawWidget(), ScanProgressWindow::DrawWidget(), DrawYearColumn(), Blitter_32bppOptimized::Encode(), Blitter_8bppOptimized::Encode(), FloodVehicle(), GenerateDefaultSaveName(), GenerateRockyArea(), GenericPlaceSignals(), GetLogPrefix(), GetOrderCmdFromTile(), GetSmallMapContoursPixels(), GetSmallMapIndustriesPixels(), GetSmallMapOwnerPixels(), GetSmallMapRoutesPixels(), GetSmallMapVehiclesPixels(), HandleAutoscroll(), HandleAutoSignalPlacement(), HandleMouseEvents(), Vehicle::HandlePathfindingResult(), HandlePlacePushButton(), HandleViewportScroll(), HandleWindowDragging(), HandleZoomMessage(), IConsoleDebug(), IConsoleWarning(), InitializeMusic(), InitializeRailGUI(), InitializeWindowViewport(), LoadUnloadVehicle(), MaybeBarCrossingWithSound(), MaybeStartNewCompany(), MenuClickSettings(), NetworkAutoCleanCompanies(), NetworkCheckRestartMap(), NetworkClientPreferTeamChat(), NetworkDisconnect(), NetworkInitChatMessage(), NetworkMaxCompaniesReached(), NetworkMaxSpectatorsReached(), NetworkServer_Tick(), NetworkServerSendChat(), NetworkServerSetCompanyPassword(), NetworkStartUp(), NetworkUDPAdvertise(), NetworkUDPAdvertiseThread(), NetworkUDPInitialize(), NetworkUDPRemoveAdvertiseThread(), NetworkUpdateClientName(), TransparenciesWindow::OnClick(), BuildTreesWindow::OnClick(), SmallMapWindow::OnClick(), BuildRoadToolbarWindow::OnClick(), MusicTrackSelectionWindow::OnClick(), BuildDocksStationWindow::OnClick(), BuildAirportWindow::OnClick(), SaveLoadWindow::OnClick(), BuildRailToolbarWindow::OnClick(), TimetableWindow::OnClick(), BuildDocksDepotWindow::OnClick(), ScenarioEditorLandscapeGenerationWindow::OnClick(), MusicWindow::OnClick(), NetworkGameWindow::OnClick(), BuildRoadDepotWindow::OnClick(), BuildRoadStationWindow::OnClick(), NetworkStartServerWindow::OnClick(), BuildRailStationWindow::OnClick(), NetworkLobbyWindow::OnClick(), BuildSignalWindow::OnClick(), BuildRailDepotWindow::OnClick(), BuildRailWaypointWindow::OnClick(), IndustryCargoesWindow::OnClick(), GameOptionsWindow::OnDropdownSelect(), NetworkGameWindow::OnDropdownSelect(), NetworkStartServerWindow::OnDropdownSelect(), ScenarioEditorToolbarWindow::OnDropdownSelect(), GameSettingsWindow::OnDropdownSelect(), NetworkGameWindow::OnEditboxChanged(), NetworkStartServerWindow::OnEditboxChanged(), MainWindow::OnHotkey(), SelectGameWindow::OnInit(), MusicTrackSelectionWindow::OnInvalidateData(), MusicWindow::OnInvalidateData(), SaveLoadWindow::OnInvalidateData(), SelectCompanyLiveryWindow::OnInvalidateData(), NewGRFWindow::OnInvalidateData(), BuildSignalWindow::OnInvalidateData(), ExtraViewportWindow::OnMouseWheel(), SmallMapWindow::OnMouseWheel(), MainWindow::OnMouseWheel(), AfterNewGRFScan::OnNewGRFsScanned(), OnNewMonth(), OnNewYear(), CompanyFinancesWindow::OnPaint(), BuildDocksStationWindow::OnPaint(), BuildRoadStationWindow::OnPaint(), BuildRailStationWindow::OnPaint(), BuildRoadToolbarWindow::OnPlaceMouseUp(), BuildRailToolbarWindow::OnPlaceMouseUp(), BuildIndustryWindow::OnPlaceObject(), OrdersWindow::OnPlaceObject(), TimetableWindow::OnQueryTextFinished(), NetworkStartServerWindow::OnQueryTextFinished(), OrdersWindow::OrderClick_NearestDepot(), PlaceRail_Station(), PlayVehicleSound(), PopupMainToolbMenu(), PositionMainToolbar(), PositionNetworkChatWindow(), PositionNewsMessage(), PositionStatusbar(), AISettingsWindow::RebuildVisibleSettings(), ServerNetworkAdminSocketHandler::Receive_ADMIN_JOIN(), ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND(), ServerNetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER(), ServerNetworkGameSocketHandler::Receive_CLIENT_GAME_PASSWORD(), ServerNetworkGameSocketHandler::Receive_CLIENT_JOIN(), ServerNetworkGameSocketHandler::Receive_CLIENT_NEWGRFS_CHECKED(), ServerNetworkGameSocketHandler::Receive_CLIENT_RCON(), MasterNetworkUDPSocketHandler::Receive_MASTER_ACK_REGISTER(), ScriptScanner::RegisterScript(), ResetSignalVariant(), SaveOrLoad(), SearchLumberMillTrees(), StationViewWindow::SelectGroupBy(), StationViewWindow::SelectSortBy(), StationViewWindow::SelectSortOrder(), ServerNetworkGameSocketHandler::SendConfigUpdate(), ClientNetworkGameSocketHandler::SendJoin(), ServerNetworkGameSocketHandler::SendNeedCompanyPassword(), ServerNetworkGameSocketHandler::SendWelcome(), ServerNetworkAdminSocketHandler::SendWelcome(), ServerNetworkGameSocketHandler::ServerNetworkGameSocketHandler(), SetDefaultRailGui(), MusicTrackSelectionWindow::SetStringParameters(), GameOptionsWindow::SetStringParameters(), NetworkGameWindow::SetStringParameters(), NetworkStartServerWindow::SetStringParameters(), BuildSignalWindow::SetStringParameters(), GRFConfig::SetSuitablePalette(), SetTimetableParams(), SetupScreenshotViewport(), NWidgetLeaf::SetupSmallestSize(), ShowErrorMessage(), ShowMeasurementTooltips(), ShowNetworkLobbyWindow(), ShowNewspaper(), ShowSelectBaseStationIfNeeded(), ShowTicker(), SndPlayScreenCoordFx(), ToggleBoundingBoxes(), ToggleDirtyBlocks(), ToolbarFastForwardClick(), ToolbarOptionsClick(), TrainController(), IConsoleLine::Truncate(), TryPathReserve(), TryReserveRailTrack(), UnreserveRailTrack(), UpdateLevelCrossing(), ScanProgressWindow::UpdateNewGRFScanStatus(), TimetableWindow::UpdateSelectionStates(), UpdateViewportPosition(), Town::UpdateVirtCoord(), CompanyFinancesWindow::UpdateWidgetSize(), VehicleEnterDepot(), and VpSelectTilesWithMethod().

GameSettings _settings_game

Game settings of a running game or the scenario editor.

The current settings for this game.

Definition at line 77 of file settings.cpp.

Referenced by _GenerateWorld(), AddInflation(), AffectSpeedByZChange(), AfterLoadGame(), AfterLoadVehicles(), AircraftController(), AircraftEventHandler_AtTerminal(), AlwaysDrawUnpavedRoads(), AutoslopeEnabled(), Subsidy::AwardTo(), BuildLandLegend(), BuildRailClick_Remove(), BuildTownHouse(), CalcEngineReliability(), CanBuildVehicleInfrastructure(), CanExpandRailStation(), AI::CanStartNew(), ChangeIndustryProduction(), CheckAllowRemoveRoad(), CheckAllowRemoveTunnelBridge(), CheckBridgeAvailability(), CheckBuildableTile(), CheckFlatLandRoadStop(), CheckforTownRating(), CheckIfAuthorityAllowsNewStation(), CheckIfCanLevelIndustryPlatform(), CheckIfIndustryTilesAreFree(), CheckIfTrainNeedsService(), CheckIndustryCloseDownProtection(), CheckNewIndustry_Farm(), CheckNewIndustry_Forest(), CheckNewIndustry_OilRefinery(), CheckNewIndustry_OilRig(), CheckNewTrain(), CheckNextTrainTile(), CheckOrders(), CheckRailSlope(), CheckRoadSlope(), CheckSwitchToEuro(), CheckTrainAttachment(), CheckTrainStayInDepot(), ChooseShipTrack(), ClampXYToMap(), ClickChangeMaxHlCheat(), CmdBuildAirport(), CmdBuildBridge(), CmdBuildDock(), CmdBuildIndustry(), CmdBuildRailStation(), CmdBuildRailWaypoint(), CmdBuildRoad(), CmdBuildRoadDepot(), CmdBuildRoadStop(), CmdBuildRoadVehicle(), CmdBuildSingleSignal(), CmdBuildTrainDepot(), CmdBuildTunnel(), CmdBuyShareInCompany(), CmdConvertRail(), CmdFoundTown(), CmdGiveMoney(), CmdInsertOrder(), CmdLevelLand(), CmdPlantTree(), CmdRefitVehicle(), CmdReverseTrainDirection(), CmdSellShareInCompany(), CmdTerraformLand(), CompaniesGenStatistics(), CompaniesMonthlyLoop(), Company::Company(), Train::ConsistChanged(), ConvertDisplaySpeedToKmhishSpeed(), ConvertDisplaySpeedToSpeed(), ConvertKmhishSpeedToDisplaySpeed(), ConvertSpeedToDisplaySpeed(), CreateNewIndustryHelper(), CreateRivers(), DeliverGoods(), DisplayVehicleSortDropDown(), DistanceFromEdgeDir(), DoCreateTown(), DoTrainPathfind(), LinkGraphOverlay::DrawContent(), CompanyInfrastructureWindow::DrawCountLine(), StationViewWindow::DrawEntries(), SmallMapWindow::DrawSmallMapColumn(), DrawTrainDetails(), TownViewWindow::DrawWidget(), CompanyInfrastructureWindow::DrawWidget(), ScenarioEditorToolbarWindow::DrawWidget(), VehicleDetailsWindow::DrawWidget(), ExtendTrainReservation(), FinaliseHouseArray(), FindClosestTrainDepot(), FindJoiningBaseStation(), FindSafePosition(), FindSpring(), FindStationsAroundTiles(), FindStationsNearby(), FindSubsidyIndustryCargoRoute(), FindSubsidyTownCargoRoute(), FindTownForIndustry(), FlatEmptyWorld(), FlowRiver(), FollowTrainReservation(), FormatBytes(), FormatNumber(), FormatString(), FreightWagonMult(), GamelogMode(), GamelogTestMode(), AI::GameLoop(), ScriptInstance::GameLoop(), GenerateIndustries(), GenerateLandscape(), GenerateTerrainPerlin(), GenerateTownName(), GenerateTowns(), GenerateTrees(), GetAirportNoiseLevelForTown(), GetAmplitude(), Station::GetCatchmentRadius(), GetClosestWaterDistance(), GetCompanyRailtypes(), GetCompanyRoadtypes(), GameConfig::GetConfig(), AIConfig::GetConfig(), IndustrySpec::GetConstructionCost(), RoadVehicle::GetCurrentMaxSpeed(), Train::GetCurrentMaxSpeed(), Train::GetCurveSpeedLimit(), TownViewWindow::GetDesiredInfoHeight(), GetDriveableTrackdirBits(), GetFreeUnitNumber(), GetGameSettings(), GetGlobalVariable(), GetIndustryGamePlayProbability(), Engine::GetLifeLengthInDays(), GetLoadAmount(), GetMaskOfTownActions(), GetNewEngine(), GetNewEngineID(), GetNumberOfIndustries(), GetOtherAqueductEnd(), GetRailTypeDropDownList(), GetRandomTreeType(), GetRowAtTile(), GetScaledIndustryGenerationProbability(), RoadVehicle::GetSlopeSteepness(), Train::GetSlopeSteepness(), GetSmallMapVegetationPixels(), GetSnowLine(), GetTerrainType(), TownScopeResolver::GetVariable(), GfxLoadSprites(), GlobalVarChangeInfo(), GrayscaleToMapHeights(), GrowTown(), GrowTownInTile(), GUIPlaceProcDragXY(), Vehicle::HandleBreakdown(), HasCatenaryDrawn(), HeightmapCallback(), HeightMapCoastLines(), HeightMapNormalize(), HeightMapSineTransform(), HighestSnowLine(), IndustryCargoesWindow::HousesCanAccept(), IndustriesChangeInfo(), InitializeGRFSpecial(), InitLoading(), int_noise(), AirportSpec::IsAvailable(), IsCommandAllowedWhilePaused(), Engine::IsEnabled(), ObjectSpec::IsEverAvailable(), IsInnerTile(), IsRoadAllowedHere(), IsValidTileForWaypoint(), IsVehicleTypeDisabled(), LoadNewGRF(), LoadSpriteTables(), LoadUnloadVehicle(), LowestSnowLine(), MakeLake(), Town::MaxTownNoise(), MaybeCrashAirplane(), MaybeStartNewCompany(), MayCompanyTakeOver(), MenuClickTown(), IndustryBuildData::MonthlyLoop(), Vehicle::NeedsServicing(), NetworkServerSetCompanyPassword(), NPFFindSafeTile(), NPFSaveTargetData(), TownViewWindow::OnClick(), BuildIndustryWindow::OnClick(), CreateScenarioWindow::OnClick(), LandInfoWindow::OnInit(), BuildTreesWindow::OnInit(), BuildIndustryWindow::OnInvalidateData(), BuildVehicleWindow::OnInvalidateData(), CompanyWindow::OnInvalidateData(), BuildAirportWindow::OnPaint(), BuildDocksStationWindow::OnPaint(), BuildRoadStationWindow::OnPaint(), BuildRailStationWindow::OnPaint(), ScenarioEditorToolbarWindow::OnPaint(), CreateScenarioWindow::OnQueryTextFinished(), OnTick_LinkGraph(), ParamSet(), ScriptInstance::Pause(), CargoPayment::PayTransfer(), CYapfCostRailT< Types >::PfCalcCost(), PlaceRail_Station(), PlaceRoad_BusStation(), PlaceRoad_TruckStation(), PlaceTreesRandomly(), SmallMapWindow::RebuildColourIndexIfNecessary(), ServerNetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER(), RecomputePrices(), RemoveAirport(), RemoveRoad(), ReplaceChain(), AI::ResetConfig(), ResetIndustries(), ResetNewGRFData(), ReverseTrainDirection(), RoadFindPathToDest(), ServerNetworkGameSocketHandler::SendNeedCompanyPassword(), ServerNetworkGameSocketHandler::SendWelcome(), ServerNetworkAdminSocketHandler::SendWelcome(), SetSettingValue(), SetStartingYear(), BuildIndustryWindow::SetStringParameters(), SetupScreenshotViewport(), SetYearEngineAgingStops(), StationViewWindow::ShowCargo(), Vehicle::ShowVisualEffect(), SplitGroundSpriteForOverlay(), StartupOneEngine(), StateGameLoop(), StationJoinerNeeded(), SubsidyMonthlyLoop(), TerraformTileHeight(), TestAutoslopeOnRailTile(), TGPGetMaxHeight(), TileAddWrap(), ToolbarScenDatePanel(), TownHouseChangeInfo(), TownLayoutAllows2x2HouseHere(), TownLayoutAllowsHouseHere(), TrainCheckIfLineEnds(), TrainController(), TrainDetailsCapacityTab(), TrainDetailsCargoTab(), TranslateXYToTileCoord(), TryPathReserve(), TryReserveSafeTrack(), Game::Uninitialize(), AI::Uninitialize(), UpdateAircraftSpeed(), UpdateLandscapingLimits(), RoadVehicle::UpdateSpeed(), Train::UpdateSpeed(), UpdateTownGrowRate(), CompanyInfrastructureWindow::UpdateWidgetSize(), IndustrySpec::UsesSmoothEconomy(), YapfRoadVehicleChooseTrack(), YapfRoadVehicleFindNearestDepot(), YapfShipCheckReverse(), YapfShipChooseTrack(), YapfTrainCheckReverse(), YapfTrainChooseTrack(), YapfTrainFindNearestDepot(), YapfTrainFindNearestSafeTile(), and LinkGraphJob::~LinkGraphJob().

GameSettings _settings_newgame

Game settings for new games (updated from the intro screen).

The settings values that are used for new games and/or modified in config file.

Definition at line 78 of file settings.cpp.

Referenced by _GenerateWorld(), GameConfig::GetConfig(), AIConfig::GetConfig(), SettingEntry::IsVisibleByRestrictionMode(), GenerateLandscapeWindow::OnClick(), CreateScenarioWindow::OnClick(), GenerateLandscapeWindow::OnDropdownSelect(), CreateScenarioWindow::OnDropdownSelect(), SelectGameWindow::OnInvalidateData(), GenerateLandscapeWindow::OnInvalidateData(), AfterNewGRFScan::OnNewGRFsScanned(), CreateScenarioWindow::OnPaint(), GenerateLandscapeWindow::OnQueryTextFinished(), CreateScenarioWindow::OnQueryTextFinished(), AI::ResetConfig(), SetNewLandscapeType(), GenerateLandscapeWindow::SetStringParameters(), CreateScenarioWindow::SetStringParameters(), StartNewGameWithoutGUI(), Game::Uninitialize(), and AI::Uninitialize().