summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-02-05 23:10:31 +0000
committerfrosch <frosch@openttd.org>2011-02-05 23:10:31 +0000
commit3bb7f7ebe4d097fe6061db5abf3bdc4fc10f9353 (patch)
treeb651874d64859a0d74ce811737ecec7cdf9b199b
parent2fbecaf4bf13629c73802f1d07e157bce0df82af (diff)
downloadopenttd-3bb7f7ebe4d097fe6061db5abf3bdc4fc10f9353.tar.xz
(svn r21991) -Fix [FS#4466]: The share/copy-orders-cursor was not updated to refer to the new vehicle when it got autoreplaced/-renewed.
-rw-r--r--src/vehicle_gui.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 0b89cd027..c84bd522c 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1105,8 +1105,16 @@ static inline void ChangeVehicleWindow(WindowClass window_class, VehicleID from_
{
Window *w = FindWindowById(window_class, from_index);
if (w != NULL) {
+ /* Update window_number */
w->window_number = to_index;
if (w->viewport != NULL) w->viewport->follow_vehicle = to_index;
+
+ /* Update vehicle drag data */
+ if (_thd.window_class == window_class && _thd.window_number == (WindowNumber)from_index) {
+ _thd.window_number = to_index;
+ }
+
+ /* Notify the window */
w->InvalidateData();
}
}