diff options
author | rubidium <rubidium@openttd.org> | 2009-11-12 17:28:20 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-12 17:28:20 +0000 |
commit | 9059e4f85f4112cba38a6fb1741be46771b000d8 (patch) | |
tree | 6a51d2ee0e9dc600c05a552405fc0d843acf32e0 /src | |
parent | c08c10f32928d81ef83a00f55119f1bc609b6a54 (diff) | |
download | openttd-9059e4f85f4112cba38a6fb1741be46771b000d8.tar.xz |
(svn r18049) -Fix [FS#3310] (r16448): Crash when an articulated RV is turning on a drive through road station that gets forcefully (bankrupt) removed
Diffstat (limited to 'src')
-rw-r--r-- | src/station_cmd.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 0bb5ff0b9..601322cf5 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1649,7 +1649,16 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin static Vehicle *ClearRoadStopStatusEnum(Vehicle *v, void *) { - if (v->type == VEH_ROAD) RoadVehicle::From(v)->state &= RVSB_ROAD_STOP_TRACKDIR_MASK; + if (v->type == VEH_ROAD) { + /* Okay... we are a road vehicle on a drive through road stop. + * But that road stop has just been removed, so we need to make + * sure we are in a valid state... however, vehicles can also + * turn on road stop tiles, so only clear the 'road stop' state + * bits and only when the state was 'in road stop', otherwise + * we'll end up clearing the turn around bits. */ + RoadVehicle *rv = RoadVehicle::From(v); + if (HasBit(rv->state, RVS_IN_DT_ROAD_STOP)) rv->state &= RVSB_ROAD_STOP_TRACKDIR_MASK; + } return NULL; } |