(svn r14103) -Fix [YAPP]: flooded trains didn't free their reservation
authorsmatz
Tue, 19 Aug 2008 10:55:33 +0000
changeset 9948 1f1f5558ca20
parent 9947 7d0c7f02e64f
child 9949 392998225bdd
(svn r14103) -Fix [YAPP]: flooded trains didn't free their reservation
src/water_cmd.cpp
--- a/src/water_cmd.cpp	Tue Aug 19 09:08:45 2008 +0000
+++ b/src/water_cmd.cpp	Tue Aug 19 10:55:33 2008 +0000
@@ -889,7 +889,11 @@
 				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);