MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SetDefaultCompanySettings

Function SetDefaultCompanySettings

src/settings.cpp:1857–1865  ·  view source on GitHub ↗

* Set the company settings for a new company to their default values. */

Source from the content-addressed store, hash-verified

1855 * Set the company settings for a new company to their default values.
1856 */
1857void SetDefaultCompanySettings(CompanyID cid)
1858{
1859 Company *c = Company::Get(cid);
1860 AutoRestoreBackup backup(_current_company, cid);
1861 for (auto &desc : _company_settings) {
1862 const IntSettingDesc *int_setting = GetSettingDesc(desc)->AsIntSetting();
1863 int_setting->MakeValueValidAndWrite(&c->settings, int_setting->GetDefaultValue());
1864 }
1865}
1866
1867/**
1868 * Sync all company settings in a multiplayer game.

Callers 1

DoStartupNewCompanyFunction · 0.85

Calls 4

GetSettingDescFunction · 0.85
AsIntSettingMethod · 0.80
GetDefaultValueMethod · 0.80

Tested by

no test coverage detected