diff options
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/afterload.cpp | 18 | ||||
-rw-r--r-- | src/saveload/saveload.cpp | 3 |
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 |