diff options
author | truelight <truelight@openttd.org> | 2005-03-31 12:39:18 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-03-31 12:39:18 +0000 |
commit | 7f6753ed896647a1f90c9797dbf0cfda1e980de7 (patch) | |
tree | e1215d950875c35beefa8111bb3e7c8190370088 | |
parent | 3c38db7c2ba6e67a9759b75abca766c43c1a0274 (diff) | |
download | openttd-7f6753ed896647a1f90c9797dbf0cfda1e980de7.tar.xz |
(svn r2113) -Fix: first check if a vehicle is a train, before accessing u.rail
-rw-r--r-- | rail_cmd.c | 10 |
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? */ |