Index: src/order_gui.cpp =================================================================== --- src/order_gui.cpp (revision 27790) +++ src/order_gui.cpp (working copy) @@ -771,6 +771,10 @@ this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_O_SCROLLBAR); this->FinishInitNested(v->index); + + const Window *w = FindWindowById(WC_VEHICLE_TIMETABLE, window_number); + if (w != NULL) this->FindWindowPlacementAndResize(w->width, w->height); + if (v->owner == _local_company) { this->DisableWidget(WID_O_EMPTY); } @@ -795,6 +799,16 @@ this->OnInvalidateData(VIWD_MODIFY_ORDERS); } + virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + { + const Window *w = FindWindowById(WC_VEHICLE_TIMETABLE, window_number); + if (w != NULL) { + Point p = { w->left, w->top }; + return p; + } + return Window::OnInitialPosition(sm_width, sm_height, window_number); + } + virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { @@ -1710,7 +1724,6 @@ void ShowOrdersWindow(const Vehicle *v) { DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false); - DeleteWindowById(WC_VEHICLE_TIMETABLE, v->index, false); if (BringWindowToFrontById(WC_VEHICLE_ORDERS, v->index) != NULL) return; /* Using a different WindowDescs for _local_company causes problems. @@ -1724,4 +1737,6 @@ } else { new OrdersWindow(v->IsGroundVehicle() ? &_orders_train_desc : &_orders_desc, v); } + + DeleteWindowById(WC_VEHICLE_TIMETABLE, v->index, false); } Index: src/timetable_gui.cpp =================================================================== --- src/timetable_gui.cpp (revision 27790) +++ src/timetable_gui.cpp (working copy) @@ -168,9 +168,22 @@ this->UpdateSelectionStates(); this->FinishInitNested(window_number); + const Window *w = FindWindowById(WC_VEHICLE_ORDERS, window_number); + if (w != NULL) this->FindWindowPlacementAndResize(w->width, w->height); + this->owner = this->vehicle->owner; } + virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + { + const Window *w = FindWindowById(WC_VEHICLE_ORDERS, window_number); + if (w != NULL) { + Point p = { w->left, w->top }; + return p; + } + return Window::OnInitialPosition(sm_width, sm_height, window_number); + } + /** * Build the arrival-departure list for a given vehicle * @param v the vehicle to make the list for @@ -709,6 +722,6 @@ void ShowTimetableWindow(const Vehicle *v) { DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false); + AllocateWindowDescFront(&_timetable_desc, v->index); DeleteWindowById(WC_VEHICLE_ORDERS, v->index, false); - AllocateWindowDescFront(&_timetable_desc, v->index); }