| 1737 | ); |
| 1738 | |
| 1739 | void ShowOrdersWindow(const Vehicle *v) |
| 1740 | { |
| 1741 | CloseWindowById(WC_VEHICLE_DETAILS, v->index, false); |
| 1742 | CloseWindowById(WC_VEHICLE_TIMETABLE, v->index, false); |
| 1743 | if (BringWindowToFrontById(WC_VEHICLE_ORDERS, v->index) != nullptr) return; |
| 1744 | |
| 1745 | /* Using a different WindowDescs for _local_company causes problems. |
| 1746 | * Due to this we have to close order windows in ChangeWindowOwner/CloseCompanyWindows, |
| 1747 | * because we cannot change switch the WindowDescs and keeping the old WindowDesc results |
| 1748 | * in crashed due to missing widget. |
| 1749 | * TODO Rewrite the order GUI to not use different WindowDescs. |
| 1750 | */ |
| 1751 | if (v->owner != _local_company) { |
| 1752 | new OrdersWindow(_other_orders_desc, v); |
| 1753 | } else { |
| 1754 | new OrdersWindow(v->IsGroundVehicle() ? _orders_train_desc : _orders_desc, v); |
| 1755 | } |
| 1756 | } |
no test coverage detected