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
commit0c6c3311c9bd3e5544b632433c4d8416d6273848 (patch)
treedbb2d01a3da0060c340d6e2adcfcf1188c8f3891 /src/vehicle.cpp
parentc34ce32f261fb145af2d2153f0e694ac7a99a80c (diff)
downloadopenttd-0c6c3311c9bd3e5544b632433c4d8416d6273848.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);