Fix double-leave of crashed road vehicle in drive-through stop
See: #662
This commit is contained in:
@@ -613,6 +613,7 @@ uint RoadVehicle::Crash(bool flooded)
|
|||||||
/* If we're in a drive through road stop we ought to leave it */
|
/* If we're in a drive through road stop we ought to leave it */
|
||||||
if (IsInsideMM(this->state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END)) {
|
if (IsInsideMM(this->state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END)) {
|
||||||
RoadStop::GetByTile(this->tile, GetRoadStopType(this->tile))->Leave(this);
|
RoadStop::GetByTile(this->tile, GetRoadStopType(this->tile))->Leave(this);
|
||||||
|
this->state &= RVSB_ROAD_STOP_TRACKDIR_MASK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->crashed_ctr = flooded ? 2000 : 1; // max 2220, disappear pretty fast when flooded
|
this->crashed_ctr = flooded ? 2000 : 1; // max 2220, disappear pretty fast when flooded
|
||||||
|
@@ -1204,7 +1204,7 @@ void Vehicle::PreDestructor()
|
|||||||
|
|
||||||
if (this->type == VEH_ROAD && this->IsPrimaryVehicle()) {
|
if (this->type == VEH_ROAD && this->IsPrimaryVehicle()) {
|
||||||
RoadVehicle *v = RoadVehicle::From(this);
|
RoadVehicle *v = RoadVehicle::From(this);
|
||||||
if (IsInsideMM(v->state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) || IsInsideMM(v->state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END)) {
|
if ((!(v->vehstatus & VS_CRASHED) && IsInsideMM(v->state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END)) || IsInsideMM(v->state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END)) {
|
||||||
/* Leave the roadstop (bay or drive-through), when you have not already left it. */
|
/* Leave the roadstop (bay or drive-through), when you have not already left it. */
|
||||||
RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile))->Leave(v);
|
RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile))->Leave(v);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user