summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-09-21 11:23:33 +0000
committerrubidium <rubidium@openttd.org>2014-09-21 11:23:33 +0000
commit982f5a6aa2f600106f9bd292ebefcef52e6e65e6 (patch)
tree781d2ce0c99ac2261c600ef0a0b427a86ce3ffbc /src/saveload
parent18b98afabdc04874942b451b281ad28be967d1ae (diff)
downloadopenttd-982f5a6aa2f600106f9bd292ebefcef52e6e65e6.tar.xz
(svn r26878) -Change: move m6 to TileExtended to keep Tile 8 bytes and thus better alignable
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp50
-rw-r--r--src/saveload/map_sl.cpp12
-rw-r--r--src/saveload/oldloader_sl.cpp8
-rw-r--r--src/saveload/station_sl.cpp2
4 files changed, 36 insertions, 36 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index d2b8b6d5d..514f29465 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -574,11 +574,11 @@ bool AfterLoadGame()
/* In old savegame versions, the heightlevel was coded in bits 0..3 of the type field */
for (TileIndex t = 0; t < map_size; t++) {
_m[t].height = GB(_m[t].type, 0, 4);
- SB(_m[t].type, 0, 2, GB(_m[t].m6, 0, 2));
- SB(_m[t].m6, 0, 2, 0);
+ SB(_m[t].type, 0, 2, GB(_me[t].m6, 0, 2));
+ SB(_me[t].m6, 0, 2, 0);
if (MayHaveBridgeAbove(t)) {
- SB(_m[t].type, 2, 2, GB(_m[t].m6, 6, 2));
- SB(_m[t].m6, 6, 2, 0);
+ SB(_m[t].type, 2, 2, GB(_me[t].m6, 6, 2));
+ SB(_me[t].m6, 6, 2, 0);
} else {
SB(_m[t].type, 2, 2, 0);
}
@@ -810,7 +810,7 @@ bool AfterLoadGame()
break;
case MP_STATION: {
- if (HasBit(_m[t].m6, 3)) SetBit(_m[t].m6, 2);
+ if (HasBit(_me[t].m6, 3)) SetBit(_me[t].m6, 2);
StationGfx gfx = GetStationGfx(t);
StationType st;
if ( IsInsideMM(gfx, 0, 8)) { // Rail station
@@ -848,7 +848,7 @@ bool AfterLoadGame()
ResetSignalHandlers();
return false;
}
- SB(_m[t].m6, 3, 3, st);
+ SB(_me[t].m6, 3, 3, st);
break;
}
}
@@ -1022,7 +1022,7 @@ bool AfterLoadGame()
case ROAD_TILE_NORMAL:
SB(_m[t].m4, 0, 4, GB(_m[t].m5, 0, 4));
SB(_m[t].m4, 4, 4, 0);
- SB(_m[t].m6, 2, 4, 0);
+ SB(_me[t].m6, 2, 4, 0);
break;
case ROAD_TILE_CROSSING:
SB(_m[t].m4, 5, 2, GB(_m[t].m5, 2, 2));
@@ -1061,19 +1061,19 @@ bool AfterLoadGame()
switch (GetRoadTileType(t)) {
default: SlErrorCorrupt("Invalid road tile type");
case ROAD_TILE_NORMAL:
- SB(_me[t].m7, 0, 4, GB(_m[t].m3, 0, 4)); // road works
- SB(_m[t].m6, 3, 3, GB(_m[t].m3, 4, 3)); // ground
- SB(_m[t].m3, 0, 4, GB(_m[t].m4, 4, 4)); // tram bits
- SB(_m[t].m3, 4, 4, GB(_m[t].m5, 0, 4)); // tram owner
- SB(_m[t].m5, 0, 4, GB(_m[t].m4, 0, 4)); // road bits
+ SB(_me[t].m7, 0, 4, GB(_m[t].m3, 0, 4)); // road works
+ SB(_me[t].m6, 3, 3, GB(_m[t].m3, 4, 3)); // ground
+ SB(_m[t].m3, 0, 4, GB(_m[t].m4, 4, 4)); // tram bits
+ SB(_m[t].m3, 4, 4, GB(_m[t].m5, 0, 4)); // tram owner
+ SB(_m[t].m5, 0, 4, GB(_m[t].m4, 0, 4)); // road bits
break;
case ROAD_TILE_CROSSING:
- SB(_me[t].m7, 0, 5, GB(_m[t].m4, 0, 5)); // road owner
- SB(_m[t].m6, 3, 3, GB(_m[t].m3, 4, 3)); // ground
- SB(_m[t].m3, 4, 4, GB(_m[t].m5, 0, 4)); // tram owner
- SB(_m[t].m5, 0, 1, GB(_m[t].m4, 6, 1)); // road axis
- SB(_m[t].m5, 5, 1, GB(_m[t].m4, 5, 1)); // crossing state
+ SB(_me[t].m7, 0, 5, GB(_m[t].m4, 0, 5)); // road owner
+ SB(_me[t].m6, 3, 3, GB(_m[t].m3, 4, 3)); // ground
+ SB(_m[t].m3, 4, 4, GB(_m[t].m5, 0, 4)); // tram owner
+ SB(_m[t].m5, 0, 1, GB(_m[t].m4, 6, 1)); // road axis
+ SB(_m[t].m5, 5, 1, GB(_m[t].m4, 5, 1)); // crossing state
break;
case ROAD_TILE_DEPOT:
@@ -1090,7 +1090,7 @@ bool AfterLoadGame()
if (!IsRoadStop(t)) break;
if (fix_roadtypes) SetRoadTypes(t, (RoadTypes)GB(_m[t].m3, 0, 3));
- SB(_me[t].m7, 0, 5, HasBit(_m[t].m6, 2) ? OWNER_TOWN : GetTileOwner(t));
+ SB(_me[t].m7, 0, 5, HasBit(_me[t].m6, 2) ? OWNER_TOWN : GetTileOwner(t));
SB(_m[t].m3, 4, 4, _m[t].m1);
_m[t].m4 = 0;
break;
@@ -1104,7 +1104,7 @@ bool AfterLoadGame()
SB(_me[t].m7, 0, 5, o); // road owner
SB(_m[t].m3, 4, 4, o == OWNER_NONE ? OWNER_TOWN : o); // tram owner
}
- SB(_m[t].m6, 2, 4, GB(_m[t].m2, 4, 4)); // bridge type
+ SB(_me[t].m6, 2, 4, GB(_m[t].m2, 4, 4)); // bridge type
SB(_me[t].m7, 5, 1, GB(_m[t].m4, 7, 1)); // snow/desert
_m[t].m2 = 0;
@@ -1838,7 +1838,7 @@ 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) {
- SB(_m[t].m6, 2, 6, GB(_m[t].m6, 3, 5));
+ SB(_me[t].m6, 2, 6, GB(_me[t].m6, 3, 5));
SB(_m[t].m3, 5, 1, 0);
}
}
@@ -1995,7 +1995,7 @@ bool AfterLoadGame()
/* Reordering/generalisation of the object bits. */
ObjectType type = _m[t].m5;
- SB(_m[t].m6, 2, 4, type == OBJECT_HQ ? GB(_m[t].m3, 2, 3) : 0);
+ SB(_me[t].m6, 2, 4, type == OBJECT_HQ ? GB(_m[t].m3, 2, 3) : 0);
_m[t].m3 = type == OBJECT_HQ ? GB(_m[t].m3, 1, 1) | GB(_m[t].m3, 0, 1) << 4 : 0;
/* Make sure those bits are clear as well! */
@@ -2016,8 +2016,8 @@ bool AfterLoadGame()
uint offset = _m[t].m3;
/* Also move the animation state. */
- _m[t].m3 = GB(_m[t].m6, 2, 4);
- SB(_m[t].m6, 2, 4, 0);
+ _m[t].m3 = GB(_me[t].m6, 2, 4);
+ SB(_me[t].m6, 2, 4, 0);
if (offset == 0) {
/* No offset, so make the object. */
@@ -2404,9 +2404,9 @@ bool AfterLoadGame()
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);
+ _me[t].m7 = GB(_me[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));
+ SB(_me[t].m6, 2, 6, min(per_proc, 63));
}
break;
diff --git a/src/saveload/map_sl.cpp b/src/saveload/map_sl.cpp
index 1b3977720..86a185ca4 100644
--- a/src/saveload/map_sl.cpp
+++ b/src/saveload/map_sl.cpp
@@ -223,16 +223,16 @@ static void Load_MAP6()
/* 1024, otherwise we overflow on 64x64 maps! */
SlArray(buf, 1024, SLE_UINT8);
for (uint j = 0; j != 1024; j++) {
- _m[i++].m6 = GB(buf[j], 0, 2);
- _m[i++].m6 = GB(buf[j], 2, 2);
- _m[i++].m6 = GB(buf[j], 4, 2);
- _m[i++].m6 = GB(buf[j], 6, 2);
+ _me[i++].m6 = GB(buf[j], 0, 2);
+ _me[i++].m6 = GB(buf[j], 2, 2);
+ _me[i++].m6 = GB(buf[j], 4, 2);
+ _me[i++].m6 = GB(buf[j], 6, 2);
}
}
} else {
for (TileIndex i = 0; i != size;) {
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8);
- for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _m[i++].m6 = buf[j];
+ for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _me[i++].m6 = buf[j];
}
}
}
@@ -244,7 +244,7 @@ static void Save_MAP6()
SlSetLength(size);
for (TileIndex i = 0; i != size;) {
- for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _m[i++].m6;
+ for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _me[i++].m6;
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8);
}
}
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index 7a2ce4c30..4afbe6033 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -1495,10 +1495,10 @@ static bool LoadOldMapPart1(LoadgameState *ls, int num)
}
for (uint i = 0; i < OLD_MAP_SIZE / 4; i++) {
byte b = ReadByte(ls);
- _m[i * 4 + 0].m6 = GB(b, 0, 2);
- _m[i * 4 + 1].m6 = GB(b, 2, 2);
- _m[i * 4 + 2].m6 = GB(b, 4, 2);
- _m[i * 4 + 3].m6 = GB(b, 6, 2);
+ _me[i * 4 + 0].m6 = GB(b, 0, 2);
+ _me[i * 4 + 1].m6 = GB(b, 2, 2);
+ _me[i * 4 + 2].m6 = GB(b, 4, 2);
+ _me[i * 4 + 3].m6 = GB(b, 6, 2);
}
}
diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp
index 17fcc58bd..3db5e1f5f 100644
--- a/src/saveload/station_sl.cpp
+++ b/src/saveload/station_sl.cpp
@@ -95,7 +95,7 @@ void MoveBuoysToWaypoints()
TILE_AREA_LOOP(t, train_st) {
if (!IsTileType(t, MP_STATION) || GetStationIndex(t) != index) continue;
- SB(_m[t].m6, 3, 3, STATION_WAYPOINT);
+ SB(_me[t].m6, 3, 3, STATION_WAYPOINT);
wp->rect.BeforeAddTile(t, StationRect::ADD_FORCE);
}