| 768 | |
| 769 | public: |
| 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 | { |
nothing calls this directly
no test coverage detected