OpenTTD Source: src/settings_func.h File Reference

OpenTTD Source 1.11.0-RC1

Functions
settings_func.h File Reference
`#include "core/smallvec_type.hpp"`
`#include "company_type.h"`
`#include "string_type.h"`

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 value)
void | IConsoleGetSetting (const char *name, bool force_newgame=false)
| Output value of a specific setting to the console. More...
void | IConsoleListSettings (const char *prefilter)
| List all settings and their value to the console. More...
void | LoadFromConfig (bool minimal=false)
| Load the values from the configuration files. More...
void | SaveToConfig ()
| Save the values to the configuration file.
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...
StringList | GetGRFPresetList ()
| Get the list of known NewGrf presets. More...
struct GRFConfig * | LoadGRFPresetFromConfig (const char *config_name)
| Load a NewGRF configuration by preset-name. More...
void | SaveGRFPresetToConfig (const char *config_name, struct 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...
uint | GetCompanySettingIndex (const char *name)
| Get the index in the _company_settings array of a setting. 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.

## Detailed Description

Functions related to setting/changing the settings.

Definition in file settings_func.h.

## Function Documentation

## ◆ DeleteGRFPresetFromConfig()

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

Delete a NewGRF configuration by preset name.

Parameters

  config_name | Name of the preset.

Definition at line 1862 of file settings.cpp.

References seprintf().

## ◆ GetCompanySettingIndex()

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 2064 of file settings.cpp.

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

## ◆ GetGRFPresetList()

StringList GetGRFPresetList | ( |  | ) |

Get the list of known NewGrf presets.

Returns
  List of preset names.

Definition at line 1807 of file settings.cpp.

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

## ◆ IConsoleGetSetting()

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 2186 of file settings.cpp.

References CC_WARNING, GetSettingFromName(), GetVariableAddress(), and IConsolePrintF().

## ◆ IConsoleListSettings()

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

List all settings and their value to the console.

Parameters

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

Definition at line 2219 of file settings.cpp.

References CC_WARNING, SaveLoad::cmd, IConsolePrintF(), and SettingDesc::save.

## ◆ IniLoadWindowSettings()

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 800 of file settings.cpp.

References IniLoadSettings().

Referenced by WindowDesc::LoadFromConfig().

## ◆ IniSaveWindowSettings()

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 811 of file settings.cpp.

References IniSaveSettings().

Referenced by WindowDesc::SaveToConfig().

## ◆ LoadFromConfig()

void LoadFromConfig | ( | bool | startup | ) |

Load the values from the configuration files.

Parameters

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

Definition at line 1754 of file settings.cpp.

Referenced by AfterNewGRFScan::OnNewGRFsScanned().

## ◆ LoadGRFPresetFromConfig()

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

Load a NewGRF configuration by preset-name.

Parameters

  config_name | Name of the preset.

Returns
  NewGRF configuration.

See also
  GetGRFPresetList

Definition at line 1827 of file settings.cpp.

References seprintf().

Referenced by NewGRFWindow::OnDropdownSelect().

## ◆ SaveGRFPresetToConfig()

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 1846 of file settings.cpp.

References seprintf().

Referenced by NewGRFWindow::OnQueryTextFinished().