summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-05-15 23:55:06 +0000
committeryexo <yexo@openttd.org>2009-05-15 23:55:06 +0000
commit31eff1d4c30803e09083320886630da8b28690d1 (patch)
treeb8c0c563425389a5e9514760bb5e1cc9cf0013c1 /src/saveload
parentaea2fcd0a09fa47caf022934ba8029ec327906f7 (diff)
downloadopenttd-31eff1d4c30803e09083320886630da8b28690d1.tar.xz
(svn r16315) -Codechange: move the autorenew settings to a new CompanySettings struct
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp14
-rw-r--r--src/saveload/company_sl.cpp11
2 files changed, 12 insertions, 13 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 87a5c9910..cc982485e 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -661,10 +661,10 @@ bool AfterLoadGame()
* of course, we do need to initialize them for older savegames. */
if (CheckSavegameVersion(16)) {
FOR_ALL_COMPANIES(c) {
- c->engine_renew_list = NULL;
- c->engine_renew = false;
- c->engine_renew_months = -6;
- c->engine_renew_money = 100000;
+ c->engine_renew_list = NULL;
+ c->settings.engine_renew = false;
+ c->settings.engine_renew_months = 6;
+ c->settings.engine_renew_money = 100000;
}
/* When loading a game, _local_company is not yet set to the correct value.
@@ -675,9 +675,7 @@ bool AfterLoadGame()
*/
if (!_network_dedicated && IsValidCompanyID(COMPANY_FIRST)) {
c = GetCompany(COMPANY_FIRST);
- c->engine_renew = _settings_client.gui.autorenew;
- c->engine_renew_months = _settings_client.gui.autorenew_months;
- c->engine_renew_money = _settings_client.gui.autorenew_money;
+ c->settings = _settings_client.company;
}
}
@@ -950,7 +948,7 @@ bool AfterLoadGame()
* replaced, shall keep their old length. In all prior versions, just default
* to false */
if (CheckSavegameVersionOldStyle(16, 1)) {
- FOR_ALL_COMPANIES(c) c->renew_keep_length = false;
+ FOR_ALL_COMPANIES(c) c->settings.renew_keep_length = false;
}
/* In version 17, ground type is moved from m2 to m4 for depots and
diff --git a/src/saveload/company_sl.cpp b/src/saveload/company_sl.cpp
index 39d252427..0e242422f 100644
--- a/src/saveload/company_sl.cpp
+++ b/src/saveload/company_sl.cpp
@@ -6,6 +6,7 @@
#include "../company_base.h"
#include "../company_func.h"
#include "../company_manager_face.h"
+#include "../settings_type.h"
#include "saveload.h"
@@ -133,11 +134,11 @@ static const SaveLoad _company_desc[] = {
/* Engine renewal settings */
SLE_CONDNULL(512, 16, 18),
- SLE_CONDREF(Company, engine_renew_list, REF_ENGINE_RENEWS, 19, SL_MAX_VERSION),
- SLE_CONDVAR(Company, engine_renew, SLE_BOOL, 16, SL_MAX_VERSION),
- SLE_CONDVAR(Company, engine_renew_months, SLE_INT16, 16, SL_MAX_VERSION),
- SLE_CONDVAR(Company, engine_renew_money, SLE_UINT32, 16, SL_MAX_VERSION),
- SLE_CONDVAR(Company, renew_keep_length, SLE_BOOL, 2, SL_MAX_VERSION), // added with 16.1, but was blank since 2
+ SLE_CONDREF(Company, engine_renew_list, REF_ENGINE_RENEWS, 19, SL_MAX_VERSION),
+ SLE_CONDVAR(Company, settings.engine_renew, SLE_BOOL, 16, SL_MAX_VERSION),
+ SLE_CONDVAR(Company, settings.engine_renew_months, SLE_INT16, 16, SL_MAX_VERSION),
+ SLE_CONDVAR(Company, settings.engine_renew_money, SLE_UINT32, 16, SL_MAX_VERSION),
+ SLE_CONDVAR(Company, settings.renew_keep_length, SLE_BOOL, 2, SL_MAX_VERSION),
/* Reserve extra space in savegame here. (currently 63 bytes) */
SLE_CONDNULL(63, 2, SL_MAX_VERSION),