summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2009-01-28 19:57:23 +0000
committerbelugas <belugas@openttd.org>2009-01-28 19:57:23 +0000
commita57c73e2f9db65778f14aaa28d5142ffb9950adf (patch)
tree0f8ac458ad049e4b952bb5f78a8a4a0eab88c268 /src/saveload
parent0809ff6767a3d45d798b1d84f1a51f418fbc9e82 (diff)
downloadopenttd-a57c73e2f9db65778f14aaa28d5142ffb9950adf.tar.xz
(svn r15290) -Codechange: Isolate size and section of the UnMovable HQ object, in order to keep the Unmovable type free of any irrelevant data
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp15
-rw-r--r--src/saveload/saveload.cpp2
2 files changed, 16 insertions, 1 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index acfe903dd..af22f844c 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -1694,6 +1694,21 @@ bool AfterLoadGame()
}
}
+ if (CheckSavegameVersion(112)) {
+ for (TileIndex t = 0; t < map_size; t++) {
+ /* Check for HQ bit being set, instead of using map accessor,
+ * since we've already changed it code-wise */
+ if (IsTileType(t, MP_UNMOVABLE) && HasBit(_m[t].m5, 7)) {
+ /* Move size and part identification of HQ out of the m5 attribute,
+ * on new locations */
+ uint8 old_m5 = _m[t].m5;
+ _m[t].m5 = UNMOVABLE_HQ;
+ SetCompanyHQSize(t, GB(old_m5, 2, 3));
+ SetCompanyHQSection(t, GB(old_m5, 0, 2));
+ }
+ }
+ }
+
GamelogPrintDebug(1);
bool ret = InitializeWindowsAndCaches();
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 0f241f3a1..466a67d53 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -42,7 +42,7 @@
#include <list>
-extern const uint16 SAVEGAME_VERSION = 111;
+extern const uint16 SAVEGAME_VERSION = 112;
SavegameType _savegame_type; ///< type of savegame we are loading