summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-06-06 14:46:50 +0000
committerfrosch <frosch@openttd.org>2009-06-06 14:46:50 +0000
commit5b497d6b4963303ea77259c5c471ae06fb15c6ca (patch)
treee1ab3e86398ba2801ad55c202a3f6b3708e14639 /src/saveload
parentec3ef70adb40d9ff371082a7360652d58e425284 (diff)
downloadopenttd-5b497d6b4963303ea77259c5c471ae06fb15c6ca.tar.xz
(svn r16525) -Codechange: Notify small ufos on deletion of road vehicles, so they can head for somewhere else instead of stumbling over a ghost.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 36dca96bc..911e687dd 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -1841,6 +1841,19 @@ bool AfterLoadGame()
}
}
+ if (CheckSavegameVersion(121)) {
+ /* Delete small ufos heading for non-existing vehicles */
+ Vehicle *v;
+ FOR_ALL_DISASTERVEHICLES(v) {
+ if (v->subtype == 2/*ST_SMALL_UFO*/ && v->current_order.GetDestination() != 0) {
+ const Vehicle *u = Vehicle::GetIfValid(v->dest_tile);
+ if (u == NULL || u->type != VEH_ROAD || !IsRoadVehFront(u)) {
+ delete v;
+ }
+ }
+ }
+ }
+
AfterLoadLabelMaps();
GamelogPrintDebug(1);