OpenTTD Source  20241121-master-g67a0fccfad
station_gui.h File Reference

Contains enums and function declarations connected with stations GUI. More...

#include "command_type.h"
#include "tilearea_type.h"
#include "window_type.h"
#include "station_type.h"

Go to the source code of this file.

Typedefs

using StationPickerCmdProc = std::function< bool(bool test, StationID to_join)>
 

Enumerations

enum  StationCoverageType { SCT_PASSENGERS_ONLY , SCT_NON_PASSENGERS_ONLY , SCT_ALL }
 Types of cargo to display for station coverage. More...
 

Functions

int DrawStationCoverageAreaText (int left, int right, int top, StationCoverageType sct, int rad, bool supplies)
 Calculates and draws the accepted or supplied cargo around the selected tile(s) More...
 
void CheckRedrawStationCoverage (const Window *w)
 Check whether we need to redraw the station coverage text. More...
 
void CheckRedrawRailWaypointCoverage (const Window *w)
 
void CheckRedrawRoadWaypointCoverage (const Window *w)
 
void ShowSelectStationIfNeeded (TileArea ta, StationPickerCmdProc proc)
 Show the station selection window when needed. More...
 
void ShowSelectRailWaypointIfNeeded (TileArea ta, StationPickerCmdProc proc)
 Show the rail waypoint selection window when needed. More...
 
void ShowSelectRoadWaypointIfNeeded (TileArea ta, StationPickerCmdProc proc)
 Show the road waypoint selection window when needed. More...
 

Detailed Description

Contains enums and function declarations connected with stations GUI.

Definition in file station_gui.h.

Enumeration Type Documentation

◆ StationCoverageType

Types of cargo to display for station coverage.

Enumerator
SCT_PASSENGERS_ONLY 

Draw only passenger class cargoes.

SCT_NON_PASSENGERS_ONLY 

Draw all non-passenger class cargoes.

SCT_ALL 

Draw all cargoes.

Definition at line 20 of file station_gui.h.

Function Documentation

◆ CheckRedrawStationCoverage()

void CheckRedrawStationCoverage ( const Window w)

Check whether we need to redraw the station coverage text.

If it is needed actually make the window for redrawing.

Parameters
wthe window to check.

Definition at line 160 of file station_gui.cpp.

References _ctrl_pressed.

Referenced by BuildAirportWindow::OnRealtimeTick(), BuildDocksStationWindow::OnRealtimeTick(), BuildRailStationWindow::OnRealtimeTick(), and BuildRoadStationWindow::OnRealtimeTick().

◆ DrawStationCoverageAreaText()

int DrawStationCoverageAreaText ( int  left,
int  right,
int  top,
StationCoverageType  sct,
int  rad,
bool  supplies 
)

Calculates and draws the accepted or supplied cargo around the selected tile(s)

Parameters
leftx position where the string is to be drawn
rightthe right most position to draw on
topy position where the string is to be drawn
sctwhich type of cargo is to be displayed (passengers/non-passengers)
radradius around selected tile(s) to be searched
suppliesif supplied cargoes should be drawn, else accepted cargoes
Returns
Returns the y value below the string that was drawn

Definition at line 77 of file station_gui.cpp.

References TileVirtXY().

◆ ShowSelectRailWaypointIfNeeded()

void ShowSelectRailWaypointIfNeeded ( TileArea  ta,
StationPickerCmdProc  proc 
)

Show the rail waypoint selection window when needed.

If not, build the waypoint.

Parameters
taArea to build the waypoint in
procFunction called to execute the build command.

Definition at line 2493 of file station_gui.cpp.

◆ ShowSelectRoadWaypointIfNeeded()

void ShowSelectRoadWaypointIfNeeded ( TileArea  ta,
StationPickerCmdProc  proc 
)

Show the road waypoint selection window when needed.

If not, build the waypoint.

Parameters
taArea to build the waypoint in
procFunction called to execute the build command.

Definition at line 2503 of file station_gui.cpp.

◆ ShowSelectStationIfNeeded()

void ShowSelectStationIfNeeded ( TileArea  ta,
StationPickerCmdProc  proc 
)

Show the station selection window when needed.

If not, build the station.

Parameters
taArea to build the station in
procFunction called to execute the build command.

Definition at line 2483 of file station_gui.cpp.