diff options
author | rubidium <rubidium@openttd.org> | 2010-08-26 14:36:00 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-08-26 14:36:00 +0000 |
commit | 7f86dcca90b20241a210dd5f088e249a902f725c (patch) | |
tree | 6793ebbb3e7395db1e51b19fb18ea3b6e196a337 /src/saveload | |
parent | 193800e0faef9711b48cedcf37feb896d9e0c448 (diff) | |
download | openttd-7f86dcca90b20241a210dd5f088e249a902f725c.tar.xz |
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/afterload.cpp | 41 | ||||
-rw-r--r-- | src/saveload/saveload.cpp | 3 |
2 files changed, 39 insertions, 5 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 17b356aae..23b7aebfd 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -1283,19 +1283,19 @@ bool AfterLoadGame() if (IsTileType(t, MP_INDUSTRY)) { switch (GetIndustryGfx(t)) { case GFX_POWERPLANT_SPARKS: - SetIndustryAnimationState(t, GB(_m[t].m1, 2, 5)); + _m[t].m3 = GB(_m[t].m1, 2, 5); break; case GFX_OILWELL_ANIMATED_1: case GFX_OILWELL_ANIMATED_2: case GFX_OILWELL_ANIMATED_3: - SetIndustryAnimationState(t, GB(_m[t].m1, 0, 2)); + _m[t].m3 = GB(_m[t].m1, 0, 2); break; case GFX_COAL_MINE_TOWER_ANIMATED: case GFX_COPPER_MINE_TOWER_ANIMATED: case GFX_GOLD_MINE_TOWER_ANIMATED: - SetIndustryAnimationState(t, _m[t].m1); + _m[t].m3 = _m[t].m1; break; default: // No animation states to change @@ -1684,7 +1684,8 @@ bool AfterLoadGame() /* Increase HouseAnimationFrame from 5 to 7 bits */ for (TileIndex t = 0; t < map_size; t++) { if (IsTileType(t, MP_HOUSE) && GetHouseType(t) >= NEW_HOUSE_OFFSET) { - SetHouseAnimationFrame(t, GB(_m[t].m6, 3, 5)); + SB(_m[t].m6, 2, 6, GB(_m[t].m6, 3, 5)); + SB(_m[t].m3, 5, 1, 0); } } } @@ -2249,6 +2250,38 @@ bool AfterLoadGame() } } + /* Move the animation frame to the same location (m7) for all objects. */ + if (CheckSavegameVersion(147)) { + for (TileIndex t = 0; t < map_size; t++) { + switch (GetTileType(t)) { + case MP_HOUSE: + if (GetHouseType(t) >= NEW_HOUSE_OFFSET) { + uint per_proc = _me[t].m7; + _me[t].m7 = GB(_m[t].m6, 2, 6) | (GB(_m[t].m3, 5, 1) << 6); + SB(_m[t].m3, 5, 1, 0); + SB(_m[t].m6, 2, 6, min(per_proc, 63)); + } + break; + + case MP_INDUSTRY: { + uint rand = _me[t].m7; + _me[t].m7 = _m[t].m3; + _m[t].m3 = rand; + break; + } + + case MP_OBJECT: + _me[t].m7 = _m[t].m3; + _m[t].m3 = 0; + break; + + default: + /* For stations/airports it's already at m7 */ + break; + } + } + } + /* Road stops is 'only' updating some caches */ AfterLoadRoadStops(); AfterLoadLabelMaps(); diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 935ebe61d..cd5ae3329 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -210,8 +210,9 @@ * 144 20334 * 145 20376 * 146 20446 + * 147 20621 */ -extern const uint16 SAVEGAME_VERSION = 146; ///< current savegame version of OpenTTD +extern const uint16 SAVEGAME_VERSION = 147; ///< current savegame version of OpenTTD SavegameType _savegame_type; ///< type of savegame we are loading |