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

Method WaypointWindow

src/waypoint_gui.cpp:74–103  ·  view source on GitHub ↗

* Construct the window. * @param desc The description of the window. * @param window_number The window number, in this case the waypoint's ID. */

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 10

GetCenterTileMethod · 0.95
OnInvalidateDataMethod · 0.95
HasBitFunction · 0.85
ScaleZoomGUIFunction · 0.85
CreateNestedTreeMethod · 0.80
SetStringTipMethod · 0.80
SetToolTipMethod · 0.80
FinishInitNestedMethod · 0.80
InitializeViewportMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected