summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-08-06 19:00:31 +0000
committerfrosch <frosch@openttd.org>2008-08-06 19:00:31 +0000
commitacf224683d1f3d40f74b16b75a904f5719d240c3 (patch)
treedbd56e98703bc1b336e6410be4808f033c42e362 /src
parentcffd5d17de75a48ca7ce226069da20499158cba2 (diff)
downloadopenttd-acf224683d1f3d40f74b16b75a904f5719d240c3.tar.xz
(svn r14007) -Fix [FS#2098]: Notify vehicle windows when their internal state is botched up from outside.
Diffstat (limited to 'src')
-rw-r--r--src/order_gui.cpp6
-rw-r--r--src/vehicle_gui.cpp2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 6316073c7..765efa1e7 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -619,6 +619,12 @@ public:
this->FindWindowPlacementAndResize(desc);
}
+ virtual void OnInvalidateData(int data = 0)
+ {
+ /* Autoreplace replaced the vehicle */
+ this->vehicle = GetVehicle(this->window_number);
+ }
+
virtual void OnPaint()
{
bool shared_orders = this->vehicle->IsOrderListShared();
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 5170ce9f7..2f47f7261 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -642,7 +642,7 @@ static inline void ChangeVehicleWindow(WindowClass window_class, VehicleID from_
if (w != NULL) {
w->window_number = to_index;
if (w->viewport != NULL) w->viewport->follow_vehicle = to_index;
- w->SetDirty();
+ if (to_index != INVALID_VEHICLE) InvalidateThisWindowData(w);
}
}