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

Method OrdersWindow

src/order_gui.cpp:770–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

768
769public:
770 OrdersWindow(WindowDesc &desc, const Vehicle *v) : Window(desc)
771 {
772 this->vehicle = v;
773
774 this->CreateNestedTree();
775 this->vscroll = this->GetScrollbar(WID_O_SCROLLBAR);
776 if (NWidgetCore *nwid = this->GetWidget<NWidgetCore>(WID_O_DEPOT_ACTION); nwid != nullptr) {
777 nwid->SetToolTip(STR_ORDER_TRAIN_DEPOT_ACTION_TOOLTIP + v->type);
778 }
779 this->FinishInitNested(v->index);
780
781 this->owner = v->owner;
782
783 this->UpdateAutoRefitState();
784
785 if (_settings_client.gui.quick_goto && v->owner == _local_company) {
786 /* If there are less than 2 station, make Go To active. */
787 int station_orders = std::ranges::count_if(v->Orders(), [](const Order &order) { return order.IsType(OT_GOTO_STATION); });
788
789 if (station_orders < 2) this->OrderClick_Goto(OPOS_GOTO);
790 }
791 this->OnInvalidateData(VIWD_MODIFY_ORDERS);
792 }
793
794 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
795 {

Callers

nothing calls this directly

Calls 9

UpdateAutoRefitStateMethod · 0.95
OrderClick_GotoMethod · 0.95
OnInvalidateDataMethod · 0.95
CreateNestedTreeMethod · 0.80
GetScrollbarMethod · 0.80
SetToolTipMethod · 0.80
FinishInitNestedMethod · 0.80
OrdersMethod · 0.80
IsTypeMethod · 0.80

Tested by

no test coverage detected