summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorplanetmaker <planetmaker@openttd.org>2012-10-20 22:05:26 +0000
committerplanetmaker <planetmaker@openttd.org>2012-10-20 22:05:26 +0000
commitf2e94237fc6dbca89f06de0befd44c2e9faf3b72 (patch)
tree44e0bb58670faf89266128d139e965a2ae6f3837 /src/saveload
parentb446780f01bdf4b01c43204503d38eb191613741 (diff)
downloadopenttd-f2e94237fc6dbca89f06de0befd44c2e9faf3b72.tar.xz
(svn r24619) -Change: Check for bankruptcy on a monthly basis (ZxBioHazardZx)
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp5
-rw-r--r--src/saveload/company_sl.cpp2
-rw-r--r--src/saveload/oldloader_sl.cpp2
-rw-r--r--src/saveload/saveload.cpp3
4 files changed, 9 insertions, 3 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index bc27288e2..e29889dd5 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2746,6 +2746,11 @@ bool AfterLoadGame()
/* Fix too high inflation rates */
if (_economy.inflation_prices > MAX_INFLATION) _economy.inflation_prices = MAX_INFLATION;
if (_economy.inflation_payment > MAX_INFLATION) _economy.inflation_payment = MAX_INFLATION;
+
+ /* We have to convert the quarters of bankruptcy into months of bankruptcy */
+ FOR_ALL_COMPANIES(c) {
+ c->months_of_bankruptcy = 3 * c->months_of_bankruptcy;
+ }
}
/* Road stops is 'only' updating some caches */
diff --git a/src/saveload/company_sl.cpp b/src/saveload/company_sl.cpp
index 34309bf9a..5878f31ea 100644
--- a/src/saveload/company_sl.cpp
+++ b/src/saveload/company_sl.cpp
@@ -272,7 +272,7 @@ static const SaveLoad _company_desc[] = {
SLE_VAR(CompanyProperties, num_valid_stat_ent, SLE_UINT8),
- SLE_VAR(CompanyProperties, quarters_of_bankruptcy,SLE_UINT8),
+ SLE_VAR(CompanyProperties, months_of_bankruptcy, SLE_UINT8),
SLE_CONDVAR(CompanyProperties, bankrupt_asked, SLE_FILE_U8 | SLE_VAR_U16, 0, 103),
SLE_CONDVAR(CompanyProperties, bankrupt_asked, SLE_UINT16, 104, SL_MAX_VERSION),
SLE_VAR(CompanyProperties, bankrupt_timeout, SLE_INT16),
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index 479ee206e..a78acfd48 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -926,7 +926,7 @@ static const OldChunks _company_chunk[] = {
OCL_SVAR( OC_UINT8, Company, colour ),
OCL_SVAR( OC_UINT8, Company, money_fraction ),
- OCL_SVAR( OC_UINT8, Company, quarters_of_bankruptcy ),
+ OCL_SVAR( OC_UINT8, Company, months_of_bankruptcy ),
OCL_SVAR( OC_FILE_U8 | OC_VAR_U16, Company, bankrupt_asked ),
OCL_SVAR( OC_FILE_U32 | OC_VAR_I64, Company, bankrupt_value ),
OCL_SVAR( OC_UINT16, Company, bankrupt_timeout ),
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index d49d90a5a..625a106ff 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -240,8 +240,9 @@
* 174 23973 1.2.x
* 175 24136
* 176 24446
+ * 177 24619
*/
-extern const uint16 SAVEGAME_VERSION = 176; ///< Current savegame version of OpenTTD.
+extern const uint16 SAVEGAME_VERSION = 177; ///< Current savegame version of OpenTTD.
SavegameType _savegame_type; ///< type of savegame we are loading