# HG changeset patch # User rubidium # Date 1261904700 0 # Node ID ba99afa62cd222660518ffd5184c5fc5077b6177 # Parent 353d6f5c65de333e432127d1547306a984c890b3 (svn r18642) -Fix [FS#3432]: when a company goes bankrupt and has vehicles on a drive through road stop that is not theirs, the 'filled' cache of the road stops would get corrupted diff --git a/src/vehicle.cpp b/src/vehicle.cpp --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -46,6 +46,7 @@ #include "core/pool_func.hpp" #include "economy_base.h" #include "articulated_vehicles.h" +#include "roadstop_base.h" #include "table/sprites.h" #include "table/strings.h" @@ -574,6 +575,15 @@ } } + + if (this->type == VEH_ROAD && this->IsPrimaryVehicle()) { + RoadVehicle *v = RoadVehicle::From(this); + if (!(v->vehstatus & VS_CRASHED) && IsInsideMM(v->state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END)) { + /* Leave the drive through roadstop, when you have not already left it. */ + RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile))->Leave(v); + } + } + if (this->Previous() == NULL) { InvalidateWindowData(WC_VEHICLE_DEPOT, this->tile); }