* Construct the window. * @param desc The description of the window. * @param window_number The window number, in this case the waypoint's ID. */
| 72 | * @param window_number The window number, in this case the waypoint's ID. |
| 73 | */ |
| 74 | WaypointWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc) |
| 75 | { |
| 76 | this->wp = Waypoint::Get(window_number); |
| 77 | if (wp->string_id == STR_SV_STNAME_WAYPOINT) { |
| 78 | this->vt = HasBit(this->wp->waypoint_flags, WPF_ROAD) ? VEH_ROAD : VEH_TRAIN; |
| 79 | } else { |
| 80 | this->vt = VEH_SHIP; |
| 81 | } |
| 82 | |
| 83 | this->CreateNestedTree(); |
| 84 | if (this->vt == VEH_TRAIN) { |
| 85 | this->GetWidget<NWidgetCore>(WID_W_SHOW_VEHICLES)->SetStringTip(STR_TRAIN, STR_STATION_VIEW_SCHEDULED_TRAINS_TOOLTIP); |
| 86 | } |
| 87 | if (this->vt == VEH_ROAD) { |
| 88 | this->GetWidget<NWidgetCore>(WID_W_SHOW_VEHICLES)->SetStringTip(STR_LORRY, STR_STATION_VIEW_SCHEDULED_ROAD_VEHICLES_TOOLTIP); |
| 89 | } |
| 90 | if (this->vt != VEH_SHIP) { |
| 91 | this->GetWidget<NWidgetCore>(WID_W_CENTER_VIEW)->SetToolTip(STR_WAYPOINT_VIEW_CENTER_TOOLTIP); |
| 92 | this->GetWidget<NWidgetCore>(WID_W_RENAME)->SetToolTip(STR_WAYPOINT_VIEW_EDIT_TOOLTIP); |
| 93 | } |
| 94 | this->FinishInitNested(window_number); |
| 95 | |
| 96 | this->owner = this->wp->owner; |
| 97 | this->flags.Set(WindowFlag::DisableVpScroll); |
| 98 | |
| 99 | NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_W_VIEWPORT); |
| 100 | nvp->InitializeViewport(this, this->GetCenterTile(), ScaleZoomGUI(ZoomLevel::Viewport)); |
| 101 | |
| 102 | this->OnInvalidateData(0); |
| 103 | } |
| 104 | |
| 105 | void Close([[maybe_unused]] int data = 0) override |
| 106 | { |
nothing calls this directly
no test coverage detected