(svn r14007) -Fix [FS#2098]: Notify vehicle windows when their internal state is botched up from outside.
authorfrosch
Wed, 06 Aug 2008 19:00:31 +0000
changeset 9862 f801c7d84353
parent 9861 10bbfd0947e8
child 9863 af31097a285f
(svn r14007) -Fix [FS#2098]: Notify vehicle windows when their internal state is botched up from outside.
src/order_gui.cpp
src/vehicle_gui.cpp
--- a/src/order_gui.cpp	Wed Aug 06 18:57:37 2008 +0000
+++ b/src/order_gui.cpp	Wed Aug 06 19:00:31 2008 +0000
@@ -619,6 +619,12 @@
 		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();
--- a/src/vehicle_gui.cpp	Wed Aug 06 18:57:37 2008 +0000
+++ b/src/vehicle_gui.cpp	Wed Aug 06 19:00:31 2008 +0000
@@ -642,7 +642,7 @@
 	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);
 	}
 }