From c6f56edcff05e5e1bcdc664ffd6434234255c922 Mon Sep 17 00:00:00 2001 From: truelight Date: Thu, 31 Mar 2005 12:39:18 +0000 Subject: (svn r2113) -Fix: first check if a vehicle is a train, before accessing u.rail --- rail_cmd.c | 10 ++++++---- 1 file 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? */ -- cgit v1.2.3-70-g09d2