summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-05-26 23:14:02 +0000
committeryexo <yexo@openttd.org>2009-05-26 23:14:02 +0000
commitd982ec81dfec20bac9f04c1d8c50a9efdb7b53bb (patch)
tree12e2d27976683d1abf82d120ce23e05e4d238199 /src/settings.cpp
parent118d444be25efe89be1a971d5dafe65796f9b810 (diff)
downloadopenttd-d982ec81dfec20bac9f04c1d8c50a9efdb7b53bb.tar.xz
(svn r16444) -Codechange: Set all company settings to their default value for a new company instead of zeroing them.
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index ad0ac1de3..af99588e7 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1508,6 +1508,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.
*/
void SyncCompanySettings()