From 7f86dcca90b20241a210dd5f088e249a902f725c Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 26 Aug 2010 14:36:00 +0000 Subject: (svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations) --- src/saveload/afterload.cpp | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) (limited to 'src/saveload/afterload.cpp') 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(); -- cgit v1.2.3-70-g09d2