mirror of https://github.com/OpenTTD/OpenTTD.git
Fix #6507: Don't try to load invalid depots from older savegames
This commit is contained in:
parent
3299d6540b
commit
d9f9a64389
|
@ -2312,6 +2312,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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue