summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-05-23 22:14:22 +0000
committerrubidium <rubidium@openttd.org>2010-05-23 22:14:22 +0000
commit4092471a98f8a3fdfb75b2ff946535349536f4e8 (patch)
tree7a4f3583a0b1c733d6346f16af5210f301d10b72 /src
parent5ba088982d3b2ebe28f57317bc75a455dd4e32a3 (diff)
downloadopenttd-4092471a98f8a3fdfb75b2ff946535349536f4e8.tar.xz
(svn r19892) -Fix [FS#3856] (r19792): crash when trying to reserve 'in depot' track on clearing a crashed train
Diffstat (limited to 'src')
-rw-r--r--src/train_cmd.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index fc8ec0253..2dfca725c 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -3455,11 +3455,12 @@ static Vehicle *CollectTrackbitsFromCrashedVehiclesEnum(Vehicle *v, void *data)
TrackBits *trackbits = (TrackBits *)data;
if (v->type == VEH_TRAIN && (v->vehstatus & VS_CRASHED) != 0) {
- if (Train::From(v)->track == TRACK_BIT_WORMHOLE) {
+ TrackBits train_tbits = Train::From(v)->track;
+ if (train_tbits == TRACK_BIT_WORMHOLE) {
/* Vehicle is inside a wormhole, v->track contains no useful value then. */
*trackbits |= DiagDirToDiagTrackBits(GetTunnelBridgeDirection(v->tile));
- } else {
- *trackbits |= Train::From(v)->track;
+ } else if (train_tbits != TRACK_BIT_DEPOT) {
+ *trackbits |= train_tbits;
}
}