diff options
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r-- | src/vehicle.cpp | 10 |
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); |