Update to 1.9.2

This commit is contained in:
Pavel Stupnikov
2019-07-12 02:46:41 +03:00
83 changed files with 407 additions and 317 deletions
+41 -32
View File
@@ -1178,6 +1178,38 @@ bool AfterLoadGame()
}
}
/* Railtype moved from m3 to m8 in version SLV_EXTEND_RAILTYPES. */
if (IsSavegameVersionBefore(SLV_EXTEND_RAILTYPES)) {
for (TileIndex t = 0; t < map_size; t++) {
switch (GetTileType(t)) {
case MP_RAILWAY:
SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
break;
case MP_ROAD:
if (IsLevelCrossing(t)) {
SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
}
break;
case MP_STATION:
if (HasStationRail(t)) {
SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
}
break;
case MP_TUNNELBRIDGE:
if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) {
SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
}
break;
default:
break;
}
}
}
if (IsSavegameVersionBefore(SLV_42)) {
Vehicle *v;
@@ -1259,38 +1291,6 @@ bool AfterLoadGame()
}
}
/* Railtype moved from m3 to m8 in version SLV_EXTEND_RAILTYPES. */
if (IsSavegameVersionBefore(SLV_EXTEND_RAILTYPES)) {
for (TileIndex t = 0; t < map_size; t++) {
switch (GetTileType(t)) {
case MP_RAILWAY:
SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
break;
case MP_ROAD:
if (IsLevelCrossing(t)) {
SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
}
break;
case MP_STATION:
if (HasStationRail(t)) {
SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
}
break;
case MP_TUNNELBRIDGE:
if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) {
SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
}
break;
default:
break;
}
}
}
/* Elrails got added in rev 24 */
if (IsSavegameVersionBefore(SLV_24)) {
RailType min_rail = RAILTYPE_ELECTRIC;
@@ -1939,6 +1939,7 @@ bool AfterLoadGame()
}
if (IsSavegameVersionBefore(SLV_62)) {
GroupStatistics::UpdateAfterLoad(); // Ensure statistics pool is initialised before trying to delete vehicles
/* Remove all trams from savegames without tram support.
* There would be trams without tram track under causing crashes sooner or later. */
RoadVehicle *v;
@@ -2350,6 +2351,14 @@ bool AfterLoadGame()
if (IsSavegameVersionBefore(SLV_128)) {
const Depot *d;
FOR_ALL_DEPOTS(d) {
/* At some point, invalid depots were saved into the game (possibly those removed in the past?)
* Remove them here, so they don't cause issues further down the line */
if (!IsDepotTile(d->xy)) {
DEBUG(sl, 0, "Removing invalid depot %d at %d, %d", d->index, TileX(d->xy), TileY(d->xy));
delete d;
d = nullptr;
continue;
}
_m[d->xy].m2 = d->index;
if (IsTileType(d->xy, MP_WATER)) _m[GetOtherShipDepotTile(d->xy)].m2 = d->index;
}