diff options
author | smatz <smatz@openttd.org> | 2011-02-02 14:50:57 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2011-02-02 14:50:57 +0000 |
commit | b15719bbd216966661ed66d8a54c17b27d77f391 (patch) | |
tree | 7d7d3232a5df0d61c0e896d259137f718a36a545 /src/depot.cpp | |
parent | 0ebc548a89a9966bc6ccae2731bf4d187efbe0b5 (diff) | |
download | openttd-b15719bbd216966661ed66d8a54c17b27d77f391.tar.xz |
(svn r21939) -Fix (r16357): the check for valid depot wasn't strict enough
Diffstat (limited to 'src/depot.cpp')
-rw-r--r-- | src/depot.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/depot.cpp b/src/depot.cpp index a1893c8ef..b666ca879 100644 --- a/src/depot.cpp +++ b/src/depot.cpp @@ -28,6 +28,11 @@ Depot::~Depot() { if (CleaningPool()) return; + if (!IsDepotTile(this->xy) || GetDepotIndex(this->xy) != this->index) { + /* It can happen there is no depot here anymore (TTO/TTD savegames) */ + return; + } + /* Clear the order backup. */ OrderBackup::Reset(this->xy, false); @@ -40,7 +45,7 @@ Depot::~Depot() /* Delete the depot list */ VehicleType vt; switch (GetTileType(this->xy)) { - default: return; // It can happen there is no depot here anymore (TTO/TTD savegames) + default: NOT_REACHED(); case MP_RAILWAY: vt = VEH_TRAIN; break; case MP_ROAD: vt = VEH_ROAD; break; case MP_WATER: vt = VEH_SHIP; break; |