(svn r16444) -Codechange: Set all company settings to their default value for a new company instead of zeroing them.

This commit is contained in:
yexo
2009-05-26 23:14:02 +00:00
parent 1d61619adc
commit 18d0a5238f
4 changed files with 16 additions and 6 deletions

View File

@@ -1507,6 +1507,19 @@ void SetCompanySetting(uint index, int32 value)
}
}
/**
* Set the company settings for a new company to their default values.
*/
void SetDefaultCompanySettings(CompanyID cid)
{
Company *c = Company::Get(cid);
const SettingDesc *sd;
for (sd = _company_settings; sd->save.cmd != SL_END; sd++) {
void *var = GetVariableAddress(&c->settings, &sd->save);
Write_ValidateSetting(var, sd, (int32)sd->desc.def);
}
}
/**
* Sync all company settings in a multiplayer game.
*/