summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-08-19 10:55:33 +0000
committersmatz <smatz@openttd.org>2008-08-19 10:55:33 +0000
commitbd6ef958e7f1073dfe9ea8b15c2877a0f9362251 (patch)
tree2ddba1a511b5cd82251100d13c3fc558913d7b0d /src
parentaa80c3a96cca9c48cad41160679c54c723159683 (diff)
downloadopenttd-bd6ef958e7f1073dfe9ea8b15c2877a0f9362251.tar.xz
(svn r14103) -Fix [YAPP]: flooded trains didn't free their reservation
Diffstat (limited to 'src')
-rw-r--r--src/water_cmd.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 3ad2b235f..e82e8cbba 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -889,7 +889,11 @@ static void FloodVehicle(Vehicle *v)
case VEH_TRAIN:
if (IsFrontEngine(v)) {
pass += 4; // driver
+ /* FreeTrainTrackReservation() calls GetVehicleTrackdir() that doesn't like crashed vehicles.
+ * In this case, v->direction matches v->u.rail.track, so we can do this (it wasn't crashed before) */
+ v->vehstatus &= ~VS_CRASHED;
FreeTrainTrackReservation(v);
+ v->vehstatus |= VS_CRASHED;
}
v->u.rail.crash_anim_pos = 4000; // max 4440, disappear pretty fast
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);