summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-03 08:09:45 +0000
committerrubidium <rubidium@openttd.org>2010-08-03 08:09:45 +0000
commitf44c51577b93faa5efc27a99b2696e08b24f7ca4 (patch)
tree5d746b7ce00185b4b742af2fbeccd39162ce35c0 /src/saveload
parent1a9d5ae076fb507cc6056f1da95e1789d2e0b1d9 (diff)
downloadopenttd-f44c51577b93faa5efc27a99b2696e08b24f7ca4.tar.xz
(svn r20334) -Codechange: reorder the unmovable bits a bit for futher extension
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp18
-rw-r--r--src/saveload/saveload.cpp3
2 files changed, 17 insertions, 4 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 2b09adfa3..db0915c3d 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -1792,13 +1792,25 @@ bool AfterLoadGame()
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].m3 = GB(_m[t].m5, 0, 5);
_m[t].m5 = UNMOVABLE_HQ;
- SetCompanyHQSize(t, GB(old_m5, 2, 3));
- SetCompanyHQSection(t, GB(old_m5, 0, 2));
}
}
}
+ if (CheckSavegameVersion(144)) {
+ for (TileIndex t = 0; t < map_size; t++) {
+ if (!IsTileType(t, MP_UNMOVABLE)) continue;
+
+ /* Reordering/generalisation of the unmovable bits. */
+ UnmovableType type = GetUnmovableType(t);
+ SetCompanyHQSize(t, type == UNMOVABLE_HQ ? GB(_m[t].m3, 2, 3) : 0);
+ SetCompanyHQSection(t, type == UNMOVABLE_HQ ? GB(_m[t].m3, 1, 1) << 4 | GB(_m[t].m3, 0, 1) : 0);
+
+ /* Make sure those bits are clear as well! */
+ _m[t].m4 = 0;
+ _me[t].m7 = 0;
+ }
+ }
if (CheckSavegameVersion(113)) {
/* allow_town_roads is added, set it if town_layout wasn't TL_NO_ROADS */
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 1c69a6ce9..c57cf597b 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -207,8 +207,9 @@
* 141 19799
* 142 20003
* 143 20048
+ * 144 20334
*/
-extern const uint16 SAVEGAME_VERSION = 143; ///< current savegame version of OpenTTD
+extern const uint16 SAVEGAME_VERSION = 144; ///< current savegame version of OpenTTD
SavegameType _savegame_type; ///< type of savegame we are loading