summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-12-26 21:08:51 +0000
committerrubidium <rubidium@openttd.org>2008-12-26 21:08:51 +0000
commit3ebe66a5e47531e9033c8552a1abe82ad0ef448f (patch)
treedbb2d01a3da0060c340d6e2adcfcf1188c8f3891 /src/vehicle.cpp
parentf18043ee21218dc9ea26ce41b1294c5212ac363c (diff)
downloadopenttd-3ebe66a5e47531e9033c8552a1abe82ad0ef448f.tar.xz
(svn r14748) -Codechange: unduplicate window updating when deleting vehicles.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index f6dc3514d..6e1af2333 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -53,6 +53,7 @@
#include "core/alloc_func.hpp"
#include "core/smallmap_type.hpp"
#include "vehiclelist.h"
+#include "depot_func.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -668,8 +669,17 @@ void Vehicle::PreDestructor()
InvalidateWindowData(WC_VEHICLE_DEPOT, this->tile);
}
+ if (this->IsPrimaryVehicle()) {
+ DeleteWindowById(WC_VEHICLE_VIEW, this->index);
+ DeleteWindowById(WC_VEHICLE_DETAILS, this->index);
+ DeleteWindowById(WC_VEHICLE_ORDERS, this->index);
+ InvalidateWindow(WC_COMPANY, this->owner);
+ }
+ InvalidateWindowClassesData(GetWindowClassForVehicleType(this->type), 0);
+
this->cargo.Truncate(0);
DeleteVehicleOrders(this);
+ DeleteDepotHighlightOfVehicle(this);
extern void StopGlobalFollowVehicle(const Vehicle *v);
StopGlobalFollowVehicle(this);