OpenTTD Source 20241224-master-gee860a5c8e
|
Functions related to setting/changing the settings. More...
Go to the source code of this file.
Functions | |
void | IConsoleSetSetting (const char *name, const char *value, bool force_newgame=false) |
void | IConsoleSetSetting (const char *name, int32_t value) |
void | IConsoleGetSetting (const char *name, bool force_newgame=false) |
Output value of a specific setting to the console. | |
void | IConsoleListSettings (const char *prefilter) |
List all settings and their value to the console. | |
void | LoadFromConfig (bool minimal=false) |
Load the values from the configuration files. | |
void | SaveToConfig () |
Save the values to the configuration file. | |
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. | |
StringList | GetGRFPresetList () |
Get the list of known NewGrf presets. | |
struct GRFConfig * | LoadGRFPresetFromConfig (const char *config_name) |
Load a NewGRF configuration by preset-name. | |
void | SaveGRFPresetToConfig (const char *config_name, struct GRFConfig *config) |
Save a NewGRF configuration with a preset name. | |
void | DeleteGRFPresetFromConfig (const char *config_name) |
Delete a NewGRF configuration by preset name. | |
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. | |
Functions related to setting/changing the settings.
Definition in file settings_func.h.
void DeleteGRFPresetFromConfig | ( | const char * | config_name | ) |
Delete a NewGRF configuration by preset name.
config_name | Name of the preset. |
Definition at line 1572 of file settings.cpp.
References _config_file, IniLoadFile::RemoveGroup(), and IniFile::SaveToDisk().
Referenced by NewGRFWindow::OnClick().
StringList GetGRFPresetList | ( | ) |
Get the list of known NewGrf presets.
Definition at line 1521 of file settings.cpp.
References _config_file, IniLoadFile::groups, and IniGroup::name.
Referenced by NewGRFWindow::OnClick(), NewGRFWindow::OnQueryTextFinished(), and SavePresetWindow::SavePresetWindow().
void IConsoleGetSetting | ( | const char * | name, |
bool | force_newgame | ||
) |
Output value of a specific setting to the console.
name | Name of the setting to output its value |
force_newgame | force the newgame settings |
Definition at line 1894 of file settings.cpp.
References _settings_game, _settings_newgame, SettingDesc::AsIntSetting(), SettingDesc::AsStringSetting(), CC_ERROR, CC_INFO, SettingDesc::flags, SettingDesc::FormatValue(), SettingDesc::GetName(), GetSettingFromName(), IConsolePrint(), SettingDesc::IsIntSetting(), SettingDesc::IsStringSetting(), IntSettingDesc::max, IntSettingDesc::min, StringSettingDesc::Read(), and SF_GUI_0_IS_SPECIAL.
void IConsoleListSettings | ( | const char * | prefilter | ) |
List all settings and their value to the console.
prefilter | If not nullptr , only list settings with names that begin with prefilter prefix |
Definition at line 1929 of file settings.cpp.
References CC_HELP, GenericSettingTables(), IConsolePrint(), PrivateSettingTables(), and SecretSettingTables().
void IConsoleSetSetting | ( | const char * | name, |
const char * | value, | ||
bool | force_newgame = false |
||
) |
Definition at line 1851 of file settings.cpp.
void IniLoadWindowSettings | ( | IniFile & | ini, |
const char * | grpname, | ||
void * | desc | ||
) |
Load a WindowDesc from config.
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 862 of file settings.cpp.
References IniLoadSettings().
Referenced by WindowDesc::LoadFromConfig().
void IniSaveWindowSettings | ( | IniFile & | ini, |
const char * | grpname, | ||
void * | desc | ||
) |
Save a WindowDesc to config.
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 873 of file settings.cpp.
References IniSaveSettings().
Referenced by WindowDesc::SaveToConfig().
void LoadFromConfig | ( | bool | startup | ) |
Load the values from the configuration files.
startup | Load the minimal amount of the configuration to "bootstrap" the blitter and such. |
Definition at line 1354 of file settings.cpp.
References _config_file, _favs_file, _grfconfig_newgame, _grfconfig_static, _private_file, _secrets_file, _settings_client, _settings_error_list, _settings_newgame, GUISettings::autosave_interval, DebugReconsiderSendRemoteMessages(), FindWindowById(), IniLoadFile::GetGroup(), IniGroup::GetItem(), GraphicsSetLoadConfig(), GRFLoadConfig(), ClientSettings::gui, HandleOldDiffCustom(), IFV_AUTOSAVE_RENAME, IFV_GAME_TYPE, IFV_LINKGRAPH_SECONDS, IFV_NETWORK_PRIVATE_SETTINGS, IFV_PRIVATE_SECRETS, IFV_RIGHT_CLICK_CLOSE, IniLoadSettingList(), IniLoadSettings(), IsConversionNeeded(), GameSettings::linkgraph, ClientSettings::network, BoolSettingDesc::ParseSingleValue(), OneOfManySettingDesc::ParseSingleValue(), PickerLoadConfig(), PrepareOldDiffCustom(), LinkGraphSettings::recalc_interval, LinkGraphSettings::recalc_time, ResetCurrencies(), GUISettings::right_click_wnd_close, ScheduleErrorMessage(), TimerGameConst< struct Calendar >::SECONDS_PER_DAY, NetworkSettings::server_game_type, ShowFirstError(), NetworkSettings::use_relay_service, ValidateSettings(), IniItem::value, and WC_ERRMSG.
Referenced by AfterNewGRFScan::OnNewGRFsScanned(), and openttd_main().
struct GRFConfig * LoadGRFPresetFromConfig | ( | const char * | config_name | ) |
Load a NewGRF configuration by preset-name.
config_name | Name of the preset. |
Definition at line 1541 of file settings.cpp.
References _config_file, and GRFLoadConfig().
Referenced by NewGRFWindow::OnDropdownSelect().
void SaveGRFPresetToConfig | ( | const char * | config_name, |
GRFConfig * | config | ||
) |
Save a NewGRF configuration with a preset name.
config_name | Name of the preset. |
config | NewGRF configuration to save. |
Definition at line 1558 of file settings.cpp.
References _config_file, and IniFile::SaveToDisk().
Referenced by NewGRFWindow::OnQueryTextFinished().
void SaveToConfig | ( | ) |
Save the values to the configuration file.
Definition at line 1447 of file settings.cpp.
References _config_file, _favs_file, _grfconfig_newgame, _grfconfig_static, _private_file, _secrets_file, IniGroup::comment, IniLoadFile::GetGroup(), GraphicsSetSaveConfig(), IFV_0, IFV_NETWORK_PRIVATE_SETTINGS, IFV_REMOVE_GENERATION_SEED, IniSaveSettingList(), IniSaveSettings(), PickerSaveConfig(), PrivateSettingTables(), RemoveEntriesFromIni(), IniLoadFile::RemoveGroup(), IniGroup::RemoveItem(), IniFile::SaveToDisk(), SaveVersionInConfig(), and SecretSettingTables().
Referenced by IntSettingDesc::ChangeValue(), StringSettingDesc::ChangeValue(), and DEF_CONSOLE_CMD().
void SetDefaultCompanySettings | ( | CompanyID | cid | ) |
Set the company settings for a new company to their default values.
Definition at line 1783 of file settings.cpp.
References SettingDesc::AsIntSetting(), IntSettingDesc::def, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetSettingDesc(), IntSettingDesc::MakeValueValidAndWrite(), and CompanyProperties::settings.
Referenced by DoStartupNewCompany().
void SyncCompanySettings | ( | ) |
Sync all company settings in a multiplayer game.
Definition at line 1795 of file settings.cpp.
References _current_company, _local_company, _settings_client, SettingDesc::AsIntSetting(), ClientSettings::company, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), SettingDesc::GetName(), GetSettingDesc(), and IntSettingDesc::Read().
Referenced by CmdCompanyCtrl().