MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ShowOrdersWindow

Function ShowOrdersWindow

src/order_gui.cpp:1739–1756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1737);
1738
1739void 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}

Callers 4

OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85

Calls 3

CloseWindowByIdFunction · 0.85
BringWindowToFrontByIdFunction · 0.85
IsGroundVehicleMethod · 0.45

Tested by

no test coverage detected