summaryrefslogtreecommitdiff
path: root/rail_cmd.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-03-31 12:39:18 +0000
committertruelight <truelight@openttd.org>2005-03-31 12:39:18 +0000
commitc6f56edcff05e5e1bcdc664ffd6434234255c922 (patch)
treee1215d950875c35beefa8111bb3e7c8190370088 /rail_cmd.c
parent66989faab68ac7fa082aa9e6feb461e835a96d19 (diff)
downloadopenttd-c6f56edcff05e5e1bcdc664ffd6434234255c922.tar.xz
(svn r2113) -Fix: first check if a vehicle is a train, before accessing u.rail
Diffstat (limited to 'rail_cmd.c')
-rw-r--r--rail_cmd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 57c882fbd..1e64dadc1 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1572,15 +1572,17 @@ static void *SignalVehicleCheckProc(Vehicle *v, void *data)
SignalVehicleCheckStruct *dest = data;
TileIndex tile;
+ if (v->type != VEH_Train)
+ return NULL;
+
/* Find the tile outside the tunnel, for signalling */
- if (v->u.rail.track == 0x40) {
+ if (v->u.rail.track == 0x40)
tile = GetVehicleOutOfTunnelTile(v);
- } else {
+ else
tile = v->tile;
- }
/* Wrong tile, or no train? Not a match */
- if (tile != dest->tile || v->type != VEH_Train)
+ if (tile != dest->tile)
return NULL;
/* Are we on the same piece of track? */