Codechange: Don't store tree counter in the map array (#10018)

This commit is contained in:
dP
2023-02-27 01:39:44 +04:00
committed by GitHub
parent 6eabbaa751
commit b0542c8c49
5 changed files with 18 additions and 59 deletions

View File

@@ -2334,8 +2334,7 @@ bool AfterLoadGame()
if (IsTileType(t, MP_TREES)) {
uint density = GB(_m[t].m2, 6, 2);
uint ground = GB(_m[t].m2, 4, 2);
uint counter = GB(_m[t].m2, 0, 4);
_m[t].m2 = ground << 6 | density << 4 | counter;
_m[t].m2 = ground << 6 | density << 4;
}
}
}
@@ -3190,6 +3189,15 @@ bool AfterLoadGame()
}
}
if (IsSavegameVersionBeforeOrAt(SLV_MULTITRACK_LEVEL_CROSSINGS)) {
/* Reset unused tree counters to reduce the savegame size. */
for (TileIndex t = 0; t < map_size; t++) {
if (IsTileType(t, MP_TREES)) {
SB(_m[t].m2, 0, 4, 0);
}
}
}
/* Refresh all level crossings to bar adjacent crossing tiles, if needed. */
for (TileIndex tile = 0; tile < Map::Size(); tile++) {
if (IsLevelCrossingTile(tile)) UpdateLevelCrossing(tile, false);