summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-27 09:05:00 +0000
committerrubidium <rubidium@openttd.org>2009-12-27 09:05:00 +0000
commitfb9eba67d124ef136ed7447cbd81f0ac2e276494 (patch)
tree0502ca522d609a5ca8fd23c29e999071840b1f06 /src
parent9aa89db3d69f8008807c730498e44961efa1f0bd (diff)
downloadopenttd-fb9eba67d124ef136ed7447cbd81f0ac2e276494.tar.xz
(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
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 459af8473..9422db456 100644
--- 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 @@ void Vehicle::PreDestructor()
}
}
+
+ 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);
}