28 #include "table/strings.h"
44 if (!this->wp->
IsInUse())
return this->wp->
xy;
49 type = STATION_WAYPOINT;
53 type = STATION_ROADWAYPOINT;
85 this->GetWidget<NWidgetCore>(
WID_W_SHOW_VEHICLES)->SetDataTip(STR_TRAIN, STR_STATION_VIEW_SCHEDULED_TRAINS_TOOLTIP);
88 this->GetWidget<NWidgetCore>(
WID_W_SHOW_VEHICLES)->SetDataTip(STR_LORRY, STR_STATION_VIEW_SCHEDULED_ROAD_VEHICLES_TOOLTIP);
91 this->GetWidget<NWidgetCore>(
WID_W_CENTER_VIEW)->tool_tip = STR_WAYPOINT_VIEW_CENTER_TOOLTIP;
92 this->GetWidget<NWidgetCore>(
WID_W_RENAME)->tool_tip = STR_WAYPOINT_VIEW_CHANGE_WAYPOINT_NAME;
105 void Close([[maybe_unused]]
int data = 0)
override
112 void SetStringParameters(
WidgetID widget)
const override
126 void OnClick([[maybe_unused]]
Point pt,
WidgetID widget, [[maybe_unused]]
int click_count)
override
143 ShowVehicleListWindow(this->wp->
owner, this->vt, this->wp->index);
157 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
159 if (!gui_scope)
return;
179 void OnQueryTextFinished(std::optional<std::string> str)
override
181 if (!str.has_value())
return;
205 NWidget(
WWT_TEXTBTN, COLOUR_GREY,
WID_W_CATCHMENT),
SetMinimalSize(50, 12),
SetResize(1, 0),
SetFill(1, 1),
SetDataTip(STR_BUTTON_CATCHMENT, STR_TOOLTIP_CATCHMENT),
213 WDP_AUTO,
"view_waypoint", 260, 118,
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Functions related to commands.
Definition of stuff that is very close to a company, like the company struct itself.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Functions related to companies.
@ OWNER_NONE
The tile has no ownership.
bool _ctrl_pressed
Is Ctrl pressed?
GUI functions that shouldn't be here.
void ShowExtraViewportWindow(TileIndex tile=INVALID_TILE)
Show a new Extra Viewport window.
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
A number of safeguards to prevent using unsafe methods.
StationType
Station types.
static const uint MAX_LENGTH_STATION_NAME_CHARS
The maximum length of a station name in characters including '\0'.
Definition of base types and functions in a cross-platform compatible way.
@ CS_ALPHANUMERAL
Both numeric and alphabetic and spaces and stuff.
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
Functions related to OTTD's strings.
StringID string_id
Default name (town area) of station.
TileIndex xy
Base tile of the station.
Owner owner
The owner of this station.
bool IsInUse() const
Check whether the base station currently is in use; in use means that it is not scheduled for deletio...
Represents the covered area of e.g.
TileIndex GetCenterTile() const
Get the center tile.
Coordinates of a point in 2D.
Tindex index
Index of this pool item.
static Waypoint * Get(size_t index)
Gets station with given index.
The information about a vehicle list.
GUI for accessing waypoints and buoys.
void OnInvalidateData([[maybe_unused]] int data=0, [[maybe_unused]] bool gui_scope=true) override
Some data on this window has become invalid.
TileIndex GetCenterTile() const
Get the center tile of the waypoint.
VehicleType vt
Vehicle type using the waypoint.
Waypoint * wp
Waypoint displayed by the window.
WaypointWindow(WindowDesc &desc, WindowNumber window_number)
Construct the window.
void OnResize() override
Called after the window got resized.
void OnPaint() override
The window must be repainted.
Representation of a waypoint.
uint16_t waypoint_flags
Waypoint flags, see WaypointFlags.
void GetTileArea(TileArea *ta, StationType type) const override
Get the tile area for a given station type.
void UpdateVirtCoord() override
Update the virtual coords needed to draw the waypoint sign.
High level window description.
Data structure for an opened window.
virtual void Close(int data=0)
Hide the window and all its child windows, and mark them for a later deletion.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
void DrawWidgets() const
Paint all widgets of a window.
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
ViewportData * viewport
Pointer to viewport data, if present.
bool IsWidgetLowered(WidgetID widget_index) const
Gets the lowered state of a widget.
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
void SetWidgetLoweredState(WidgetID widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
WindowFlags flags
Window flags.
void SetWidgetDisabledState(WidgetID widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
WindowNumber window_number
Window number within the window class.
Stuff related to the text buffer GUI.
@ QSF_ENABLE_DEFAULT
enable the 'Default' button ("\0" is returned)
@ QSF_LEN_IN_CHARS
the length of the string is counted in characters
Functions related to the vehicle's GUIs.
WindowClass GetWindowClassForVehicleType(VehicleType vt)
Get WindowClass for vehicle list of given vehicle type.
VehicleType
Available vehicle types.
@ VEH_ROAD
Road vehicle type.
@ VEH_SHIP
Ship vehicle type.
@ VEH_TRAIN
Train vehicle type.
Functions and type for generating vehicle lists.
bool ScrollWindowToTile(TileIndex tile, Window *w, bool instant)
Scrolls the viewport in a window to a given location.
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
void SetViewportCatchmentWaypoint(const Waypoint *wp, bool sel)
Select or deselect waypoint for coverage area highlight.
const Waypoint * _viewport_highlight_waypoint
Currently selected waypoint for coverage area highlight.
Functions related to (drawing on) viewports.
@ WPF_ROAD
This is a road waypoint.
Command definitions related to waypoints.
static WindowDesc _waypoint_view_desc(WDP_AUTO, "view_waypoint", 260, 118, WC_WAYPOINT_VIEW, WC_NONE, 0, _nested_waypoint_view_widgets)
The description of the waypoint view.
static constexpr NWidgetPart _nested_waypoint_view_widgets[]
The widgets of the waypoint view.
void ShowWaypointWindow(const Waypoint *wp)
Show the window for the given waypoint.
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
Close a window by its class and window number (if it is open).
Window functions not directly related to making/drawing windows.
Functions, definitions and such used only by the GUI.
@ WF_DISABLE_VP_SCROLL
Window does not do autoscroll,.
@ WDP_AUTO
Find a place automatically.
int32_t WindowNumber
Number to differentiate different windows of the same class.
@ WC_WAYPOINT_VIEW
Waypoint view; Window numbers:
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Functions related to zooming.
ZoomLevel ScaleZoomGUI(ZoomLevel value)
Scale zoom level relative to GUI zoom.
@ ZOOM_LVL_VIEWPORT
Default zoom level for viewports.