changeset 17251:ee3dc725dbcc draft

(svn r21991) -Fix [FS#4466]: The share/copy-orders-cursor was not updated to refer to the new vehicle when it got autoreplaced/-renewed.
author frosch <frosch@openttd.org>
date Sat, 05 Feb 2011 23:10:31 +0000
parents 0c4b996455b2
children c52379fc5dd0
files src/vehicle_gui.cpp
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1105,8 +1105,16 @@
 {
 	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();
 	}
 }