summaryrefslogtreecommitdiff
path: root/src/saveload/afterload.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-26 14:36:00 +0000
committerrubidium <rubidium@openttd.org>2010-08-26 14:36:00 +0000
commit7f86dcca90b20241a210dd5f088e249a902f725c (patch)
tree6793ebbb3e7395db1e51b19fb18ea3b6e196a337 /src/saveload/afterload.cpp
parent193800e0faef9711b48cedcf37feb896d9e0c448 (diff)
downloadopenttd-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/afterload.cpp')
-rw-r--r--src/saveload/afterload.cpp41
1 files changed, 37 insertions, 4 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();