@@ -1102,14 +1102,22 @@ void InitializeGUI()
* @param to_index the new vehicle ID
*/
static inline void ChangeVehicleWindow(WindowClass window_class, VehicleID from_index, VehicleID to_index)
{
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();
/**
* Report a change in vehicle IDs (due to autoreplace) to affected vehicle windows.