OpenTTD Source: src/station_gui.h File Reference

OpenTTD Source 15.3

Typedefs | Enumerations | Functions
station_gui.h File Reference

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

`#include "core/geometry_type.hpp"`
`#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 : uint8_t { SCT_PASSENGERS_ONLY , SCT_NON_PASSENGERS_ONLY , SCT_ALL }
| Types of cargo to display for station coverage. More...

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

## Detailed Description

Contains enums and function declarations connected with stations GUI.

Definition in file station_gui.h.

## Typedef Documentation

## ◆ StationPickerCmdProc

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

Definition at line 32 of file station_gui.h.

## Enumeration Type Documentation

## ◆ StationCoverageType

enum StationCoverageType : uint8_t

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 21 of file station_gui.h.

## Function Documentation

## ◆ CheckRedrawRailWaypointCoverage()

void CheckRedrawRailWaypointCoverage | ( | const Window * | w | ) |

Definition at line 197 of file station_gui.cpp.

## ◆ CheckRedrawRoadWaypointCoverage()

void CheckRedrawRoadWaypointCoverage | ( | const Window * | w | ) |

Definition at line 202 of file station_gui.cpp.

## ◆ 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

  w | the window to check.

Definition at line 159 of file station_gui.cpp.

References _ctrl_pressed, _settings_client, TileHighlightData::dirty, TileHighlightData::drawstyle, ClientSettings::gui, HT_RECT, Window::SetDirty(), and GUISettings::station_show_coverage.

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

## ◆ DrawStationCoverageAreaText()

int DrawStationCoverageAreaText | ( | const Rect & | r,
|  | StationCoverageType | sct,
|  | int | rad,
|  | bool | supplies
| ) |  |

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

Parameters

  r | Rect where the string is to be drawn.
  sct | which type of cargo is to be displayed (passengers/non-passengers)
  rad | radius around selected tile(s) to be searched
  supplies | if 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 DrawStringMultiLine(), TileHighlightData::drawstyle, GetAcceptanceAroundTiles(), GetProductionAroundTiles(), GetString(), HT_RECT, IsCargoInClass(), NUM_CARGO, Passengers, TileHighlightData::pos, SCT_ALL, SCT_NON_PASSENGERS_ONLY, SCT_PASSENGERS_ONLY, SetBit(), Map::Size(), TileHighlightData::size, TILE_SIZE, TileVirtXY(), Coord2D< T >::x, and Coord2D< T >::y.

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

## ◆ ShowSelectRailWaypointIfNeeded()

void ShowSelectRailWaypointIfNeeded | ( | TileArea | ta,
|  | StationPickerCmdProc | proc
| ) |  |

Show the rail waypoint selection window when needed.

If not, build the waypoint.

Parameters

  ta | Area to build the waypoint in
  proc | Function called to execute the build command.

Definition at line 2485 of file station_gui.cpp.

Referenced by BuildRailToolbarWindow::OnPlaceMouseUp().

## ◆ ShowSelectRoadWaypointIfNeeded()

void ShowSelectRoadWaypointIfNeeded | ( | TileArea | ta,
|  | StationPickerCmdProc | proc
| ) |  |

Show the road waypoint selection window when needed.

If not, build the waypoint.

Parameters

  ta | Area to build the waypoint in
  proc | Function called to execute the build command.

Definition at line 2495 of file station_gui.cpp.

Referenced by BuildRoadToolbarWindow::OnPlaceMouseUp().

## ◆ ShowSelectStationIfNeeded()

void ShowSelectStationIfNeeded | ( | TileArea | ta,
|  | StationPickerCmdProc | proc
| ) |  |

Show the station selection window when needed.

If not, build the station.

Parameters

  ta | Area to build the station in
  proc | Function called to execute the build command.

Definition at line 2475 of file station_gui.cpp.

Referenced by BuildDocksToolbarWindow::OnPlaceObject(), PlaceAirport(), PlaceRail_Station(), and PlaceRoadStop().