OpenTTD Source: src/road_gui.cpp File Reference

OpenTTD Source 15.0-beta1

Data Structures | Typedefs | Functions | Variables
road_gui.cpp File Reference

GUI for building roads. More...

`#include "stdafx.h"`
`#include "gui.h"`
`#include "window_gui.h"`
`#include "station_gui.h"`
`#include "terraform_gui.h"`
`#include "viewport_func.h"`
`#include "command_func.h"`
`#include "road_cmd.h"`
`#include "station_func.h"`
`#include "waypoint_func.h"`
`#include "window_func.h"`
`#include "vehicle_func.h"`
`#include "sound_func.h"`
`#include "company_func.h"`
`#include "tunnelbridge.h"`
`#include "tunnelbridge_map.h"`
`#include "tilehighlight_func.h"`
`#include "company_base.h"`
`#include "hotkeys.h"`
`#include "road_gui.h"`
`#include "zoom_func.h"`
`#include "dropdown_type.h"`
`#include "dropdown_func.h"`
`#include "engine_base.h"`
`#include "station_base.h"`
`#include "waypoint_base.h"`
`#include "strings_func.h"`
`#include "core/geometry_func.hpp"`
`#include "station_cmd.h"`
`#include "waypoint_cmd.h"`
`#include "tunnelbridge_cmd.h"`
`#include "newgrf_roadstop.h"`
`#include "picker_gui.h"`
`#include "timer/timer.h"`
`#include "timer/timer_game_calendar.h"`
`#include "widgets/road_widget.h"`
`#include "table/strings.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | RoadWaypointPickerSelection
struct | RoadStopPickerSelection
struct | BuildRoadToolbarWindow
| Road toolbar window handler. More...
struct | BuildRoadDepotWindow
class | RoadStopPickerCallbacks< roadstoptype >
struct | BuildRoadStationWindow
class | RoadWaypointPickerCallbacks
struct | BuildRoadWaypointWindow

## Typedefs
typedef void | OnButtonClick(Window *w)

## Functions
static void | ShowRVStationPicker (Window *parent, RoadStopType rs)
static void | ShowRoadDepotPicker (Window *parent)
static void | ShowBuildRoadWaypointPicker (Window *parent)
static bool | IsRoadStopEverAvailable (const RoadStopSpec *spec, StationType type)
static bool | IsRoadStopAvailable (const RoadStopSpec *spec, StationType type)
| Check whether a road stop type can be built.
void | CcPlaySound_CONSTRUCTION_OTHER (Commands, const CommandCost &result, TileIndex tile)
static void | PlaceRoad_Bridge (TileIndex tile, Window *w)
| Callback to start placing a bridge.
void | CcBuildRoadTunnel (Commands, const CommandCost &result, TileIndex start_tile)
| Callback executed after a build road tunnel command has been called.
void | ConnectRoadToStructure (TileIndex tile, DiagDirection direction)
| If required, connects a new structure to an existing road or tram by building the missing roadbit.
void | CcRoadDepot (Commands, const CommandCost &result, TileIndex tile, RoadType, DiagDirection dir)
void | CcRoadStop (Commands, const CommandCost &result, TileIndex tile, uint8_t width, uint8_t length, RoadStopType, bool is_drive_through, DiagDirection dir, RoadType, RoadStopClassID spec_class, uint16_t spec_index, StationID, bool)
| Command callback for building road stops.
static void | PlaceRoadStop (TileIndex start_tile, TileIndex end_tile, RoadStopType stop_type, bool adjacent, RoadType rt, StringID err_msg)
| Place a new road stop.
static void | PlaceRoad_Waypoint (TileIndex tile)
| Place a road waypoint.
static void | PlaceRoad_BusStation (TileIndex tile)
| Callback for placing a bus station.
static void | PlaceRoad_TruckStation (TileIndex tile)
| Callback for placing a truck station.
static void | ToggleRoadButton_Remove (Window *w)
| Toggles state of the Remove button of Build road toolbar.
static bool | RoadToolbar_CtrlChanged (Window *w)
| Updates the Remove button because of Ctrl state change.
Window * | ShowBuildRoadToolbar (RoadType roadtype)
| Open the build road toolbar window.
Window * | ShowBuildRoadScenToolbar (RoadType roadtype)
| Show the road building toolbar in the scenario editor.
static PickerCallbacks & | GetRoadStopPickerCallbacks (RoadStopType rs)
void | InitializeRoadGui ()
void | InitializeRoadGUI ()
| I really don't know why rail_gui.cpp has this too, shouldn't be included in the other one?
DropDownList | GetRoadTypeDropDownList (RoadTramTypes rtts, bool for_replacement, bool all_option)
DropDownList | GetScenRoadTypeDropDownList (RoadTramTypes rtts)

## Variables
static bool | _remove_button_clicked
static bool | _one_way_button_clicked
static Axis | _place_road_dir
static bool | _place_road_start_half_x
static bool | _place_road_start_half_y
static bool | _place_road_end_half
static RoadType | _cur_roadtype
static DiagDirection | _road_depot_orientation
static RoadWaypointPickerSelection | _waypoint_gui
| Settings of the road waypoint picker.
static RoadStopPickerSelection | _roadstop_gui
static constexpr NWidgetPart | _nested_build_road_widgets []
static WindowDesc | _build_road_desc (WDP_ALIGN_TOOLBAR, "toolbar_road", 0, 0, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_road_widgets, &BuildRoadToolbarWindow::road_hotkeys)
static constexpr NWidgetPart | _nested_build_tramway_widgets []
static WindowDesc | _build_tramway_desc (WDP_ALIGN_TOOLBAR, "toolbar_tramway", 0, 0, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_tramway_widgets, &BuildRoadToolbarWindow::tram_hotkeys)
static constexpr NWidgetPart | _nested_build_road_scen_widgets []
static WindowDesc | _build_road_scen_desc (WDP_AUTO, "toolbar_road_scen", 0, 0, WC_SCEN_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_road_scen_widgets, &BuildRoadToolbarWindow::road_hotkeys)
static constexpr NWidgetPart | _nested_build_tramway_scen_widgets []
static WindowDesc | _build_tramway_scen_desc (WDP_AUTO, "toolbar_tram_scen", 0, 0, WC_SCEN_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_tramway_scen_widgets, &BuildRoadToolbarWindow::tram_hotkeys)
static constexpr NWidgetPart | _nested_build_road_depot_widgets []
static WindowDesc | _build_road_depot_desc (WDP_AUTO, nullptr, 0, 0, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_build_road_depot_widgets)
static RoadStopPickerCallbacks< ROADSTOP_BUS > | _bus_callback_instance ("fav_passenger_roadstops")
static RoadStopPickerCallbacks< ROADSTOP_TRUCK > | _truck_callback_instance ("fav_freight_roadstops")
static constexpr NWidgetPart | _nested_road_station_picker_widgets []
| Widget definition of the build road station window.
static WindowDesc | _road_station_picker_desc (WDP_AUTO, "build_station_road", 0, 0, WC_BUS_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_road_station_picker_widgets, &BuildRoadStationWindow::road_hotkeys)
static constexpr NWidgetPart | _nested_tram_station_picker_widgets []
| Widget definition of the build tram station window.
static WindowDesc | _tram_station_picker_desc (WDP_AUTO, "build_station_tram", 0, 0, WC_BUS_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_tram_station_picker_widgets, &BuildRoadStationWindow::tram_hotkeys)
static constexpr NWidgetPart | _nested_build_road_waypoint_widgets []
| Nested widget definition for the build NewGRF road waypoint window.
static WindowDesc | _build_road_waypoint_desc (WDP_AUTO, "build_road_waypoint", 0, 0, WC_BUILD_WAYPOINT, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_build_road_waypoint_widgets, &BuildRoadWaypointWindow::hotkeys)

## Detailed Description

GUI for building roads.

Definition in file road_gui.cpp.

## Typedef Documentation

## ◆ OnButtonClick

typedef void OnButtonClick(Window *w)

Definition at line 309 of file road_gui.cpp.

## Function Documentation

## ◆ CcBuildRoadTunnel()

void CcBuildRoadTunnel | ( | Commands | ,
|  | const CommandCost & | result,
|  | TileIndex | start_tile
| ) |  |

Callback executed after a build road tunnel command has been called.

Parameters

  result | Whether the build succeeded.
  start_tile | Starting tile of the tunnel.

Definition at line 140 of file road_gui.cpp.

References _build_tunnel_endtile, _settings_client, SoundSettings::confirm, ConnectRoadToStructure(), GetOtherTunnelBridgeEnd(), GetTunnelBridgeDirection(), ClientSettings::gui, GUISettings::persistent_buildingtools, ResetObjectToPlace(), ReverseDiagDir(), SetRedErrorSquare(), SND_1F_CONSTRUCTION_OTHER, ClientSettings::sound, and CommandCost::Succeeded().

## ◆ CcPlaySound_CONSTRUCTION_OTHER()

void CcPlaySound_CONSTRUCTION_OTHER | ( | Commands | ,
|  | const CommandCost & | result,
|  | TileIndex | tile
| ) |  |

Definition at line 114 of file road_gui.cpp.

## ◆ CcRoadDepot()

void CcRoadDepot | ( | Commands | cmd,
|  | const CommandCost & | result,
|  | TileIndex | tile,
|  | RoadType | rt,
|  | DiagDirection | dir
| ) |  |

Definition at line 173 of file road_gui.cpp.

## ◆ CcRoadStop()

void CcRoadStop | ( | Commands | cmd,
|  | const CommandCost & | result,
|  | TileIndex | tile,
|  | uint8_t | width,
|  | uint8_t | length,
|  | RoadStopType | ,
|  | bool | is_drive_through,
|  | DiagDirection | dir,
|  | RoadType | ,
|  | RoadStopClassID | spec_class,
|  | uint16_t | spec_index,
|  | StationID | ,
|  | bool |
| ) |  |

Command callback for building road stops.

Parameters

  result | Result of the build road stop command.
  tile | Start tile.
  width | Width of the road stop.
  length | Length of the road stop.
  is_drive_through | False for normal stops, true for drive-through.
  dir | Entrance direction (DiagDirection) for normal stops. Converted to the axis for drive-through stops.
  spec_class | Road stop spec class.
  spec_index | Road stop spec index.

See also
  CmdBuildRoadStop

Definition at line 194 of file road_gui.cpp.

References _settings_client, SoundSettings::confirm, ConnectRoadToStructure(), CommandCost::Failed(), NewGRFClass< Tspec, Tindex, Tmax >::Get(), NewGRFClass< Tspec, Tindex, Tmax >::GetClassCount(), NewGRFClass< Tspec, Tindex, Tmax >::GetSpec(), ClientSettings::gui, HasBit(), GUISettings::persistent_buildingtools, ResetObjectToPlace(), ReverseDiagDir(), RSF_NO_AUTO_ROAD_CONNECTION, SND_1F_CONSTRUCTION_OTHER, and ClientSettings::sound.

Referenced by PlaceRoadStop().

## ◆ ConnectRoadToStructure()

void ConnectRoadToStructure | ( | TileIndex | tile,
|  | DiagDirection | direction
| ) |  |

If required, connects a new structure to an existing road or tram by building the missing roadbit.

Parameters

  tile | Tile containing the structure to connect.
  direction | Direction to check.

Definition at line 162 of file road_gui.cpp.

References DiagDirToRoadBits(), DRD_NONE, GetRoadBits(), IsNormalRoadTile(), ReverseDiagDir(), ROAD_NONE, and TileOffsByDiagDir().

Referenced by CcBuildBridge(), CcBuildRoadTunnel(), and CcRoadStop().

## ◆ GetRoadStopPickerCallbacks()

static PickerCallbacks & GetRoadStopPickerCallbacks | ( | RoadStopType | rs | ) |
| static

Definition at line 1274 of file road_gui.cpp.

## ◆ GetRoadTypeDropDownList()

DropDownList GetRoadTypeDropDownList | ( | RoadTramTypes | rtts,
|  | bool | for_replacement,
|  | bool | all_option
| ) |  |

Definition at line 1728 of file road_gui.cpp.

## ◆ GetScenRoadTypeDropDownList()

DropDownList GetScenRoadTypeDropDownList | ( | RoadTramTypes | rtts | ) |

Definition at line 1788 of file road_gui.cpp.

## ◆ InitializeRoadGui()

void InitializeRoadGui | ( |  | ) |

Definition at line 1711 of file road_gui.cpp.

## ◆ InitializeRoadGUI()

void InitializeRoadGUI | ( |  | ) |

I really don't know why rail_gui.cpp has this too, shouldn't be included in the other one?

Definition at line 1722 of file road_gui.cpp.

References FindWindowById(), BuildRoadToolbarWindow::ModifyRoadType(), TRANSPORT_ROAD, and WC_BUILD_TOOLBAR.

## ◆ IsRoadStopAvailable()

static bool IsRoadStopAvailable | ( | const RoadStopSpec * | spec,
|  | StationType | type
| ) |  |
| static

Check whether a road stop type can be built.

Returns
  true if building is allowed.

Definition at line 101 of file road_gui.cpp.

References CALLBACK_FAILED, CBID_STATION_AVAILABILITY, CBM_ROAD_STOP_AVAIL, Convert8bitBooleanCallback(), RoadStopSpec::grf_prop, GRFFilePropsBase< Tcnt >::grffile, HasBit(), and INVALID_TILE.

Referenced by RoadStopPickerCallbacks< roadstoptype >::IsTypeAvailable(), and RoadWaypointPickerCallbacks::IsTypeAvailable().

## ◆ IsRoadStopEverAvailable()

static bool IsRoadStopEverAvailable | ( | const RoadStopSpec * | spec,
|  | StationType | type
| ) |  |
| static

Definition at line 82 of file road_gui.cpp.

## ◆ PlaceRoad_Bridge()

static void PlaceRoad_Bridge | ( | TileIndex | tile,
|  | Window * | w
| ) |  |
| static

Callback to start placing a bridge.

Parameters

  tile | Start tile of the bridge.

Definition at line 123 of file road_gui.cpp.

References DDSP_BUILD_BRIDGE, GetOtherTunnelBridgeEnd(), IsBridgeTile(), Window::OnPlaceMouseUp(), VPM_X_OR_Y, and VpStartPlaceSizing().

Referenced by BuildRoadToolbarWindow::OnPlaceObject().

## ◆ PlaceRoad_BusStation()

static void PlaceRoad_BusStation | ( | TileIndex | tile | ) |
| static

Callback for placing a bus station.

Parameters

  tile | Position to place the station.

Definition at line 277 of file road_gui.cpp.

References _settings_game, AXIS_X, DDSP_BUILD_BUSSTOP, DDSP_REMOVE_BUSSTOP, DIAGDIR_END, DiagDirToAxis(), RoadStopPickerSelection::orientation, GameSettings::station, StationSettings::station_spread, VPM_X_AND_Y, VPM_X_AND_Y_LIMITED, VPM_X_LIMITED, VPM_Y_LIMITED, and VpStartPlaceSizing().

Referenced by BuildRoadToolbarWindow::OnPlaceObject().

## ◆ PlaceRoad_TruckStation()

static void PlaceRoad_TruckStation | ( | TileIndex | tile | ) |
| static

Callback for placing a truck station.

Parameters

  tile | Position to place the station.

Definition at line 295 of file road_gui.cpp.

References _settings_game, AXIS_X, DDSP_BUILD_TRUCKSTOP, DDSP_REMOVE_TRUCKSTOP, DIAGDIR_END, DiagDirToAxis(), RoadStopPickerSelection::orientation, GameSettings::station, StationSettings::station_spread, VPM_X_AND_Y, VPM_X_AND_Y_LIMITED, VPM_X_LIMITED, VPM_Y_LIMITED, and VpStartPlaceSizing().

Referenced by BuildRoadToolbarWindow::OnPlaceObject().

## ◆ PlaceRoad_Waypoint()

static void PlaceRoad_Waypoint | ( | TileIndex | tile | ) |
| static

Place a road waypoint.

Parameters

  tile | Position to start dragging a waypoint.

Definition at line 254 of file road_gui.cpp.

References _settings_game, AXIS_X, DDSP_BUILD_ROAD_WAYPOINT, DDSP_REMOVE_ROAD_WAYPOINT, GetAxisForNewRoadWaypoint(), IsValidAxis(), ROADSTOP_CLASS_WAYP, GameSettings::station, StationSettings::station_spread, VPM_X_AND_Y, VPM_X_LIMITED, VPM_Y_LIMITED, and VpStartPlaceSizing().

Referenced by BuildRoadToolbarWindow::OnPlaceObject().

## ◆ PlaceRoadStop()

static void PlaceRoadStop | ( | TileIndex | start_tile,
|  | TileIndex | end_tile,
|  | RoadStopType | stop_type,
|  | bool | adjacent,
|  | RoadType | rt,
|  | StringID | err_msg
| ) |  |
| static

Place a new road stop.

Parameters

  start_tile | First tile of the area.
  end_tile | Last tile of the area.
  stop_type | Type of stop (bus/truck).
  adjacent | Allow stations directly adjacent to other stations.
  rt | The roadtypes.
  err_msg | Error message to show.

See also
  CcRoadStop()

Definition at line 228 of file road_gui.cpp.

References CcRoadStop(), CommandFlagsToDCFlags(), DIAGDIR_END, OrthogonalTileArea::h, RoadStopPickerSelection::orientation, RoadStopPickerSelection::sel_class, RoadStopPickerSelection::sel_type, ShowSelectStationIfNeeded(), OrthogonalTileArea::tile, and OrthogonalTileArea::w.

Referenced by BuildRoadToolbarWindow::OnPlaceMouseUp().

## ◆ RoadToolbar_CtrlChanged()

static bool RoadToolbar_CtrlChanged | ( | Window * | w | ) |
| static

Updates the Remove button because of Ctrl state change.

Parameters

  w | window the button belongs to

Returns
  true iff the remove button was changed

Definition at line 328 of file road_gui.cpp.

References Window::IsWidgetDisabled(), Window::IsWidgetLowered(), ToggleRoadButton_Remove(), WID_ROT_AUTOROAD, WID_ROT_REMOVE, and WID_ROT_ROAD_X.

Referenced by BuildRoadToolbarWindow::OnClick(), and BuildRoadToolbarWindow::OnCTRLStateChange().

## ◆ ShowBuildRoadScenToolbar()

Window * ShowBuildRoadScenToolbar | ( | RoadType | roadtype | ) |

Show the road building toolbar in the scenario editor.

Returns
  The just opened toolbar, or `nullptr` if the toolbar was already open.

Definition at line 1081 of file road_gui.cpp.

References CloseWindowById(), TRANSPORT_ROAD, and WC_SCEN_BUILD_TOOLBAR.

Referenced by BuildRoadToolbarWindow::RoadTramToolbarGlobalHotkeys(), ToolbarScenBuildRoad(), and ToolbarScenBuildTram().

## ◆ ShowBuildRoadToolbar()

Window * ShowBuildRoadToolbar | ( | RoadType | roadtype | ) |

Open the build road toolbar window.

If the terraform toolbar is linked to the toolbar, that window is also opened.

Returns
  newly opened road toolbar, or nullptr if the toolbar could not be opened.

Definition at line 994 of file road_gui.cpp.

References _local_company, CloseWindowByClass(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), TRANSPORT_ROAD, ValParamRoadType(), and WC_BUILD_TOOLBAR.

Referenced by MenuClickBuildRoad(), MenuClickBuildTram(), MainToolbarWindow::OnHotkey(), and BuildRoadToolbarWindow::RoadTramToolbarGlobalHotkeys().

## ◆ ShowBuildRoadWaypointPicker()

static void ShowBuildRoadWaypointPicker | ( | Window * | parent | ) |
| static

Definition at line 1705 of file road_gui.cpp.

## ◆ ShowRoadDepotPicker()

static void ShowRoadDepotPicker | ( | Window * | parent | ) |
| static

Definition at line 1173 of file road_gui.cpp.

## ◆ ShowRVStationPicker()

static void ShowRVStationPicker | ( | Window * | parent,
|  | RoadStopType | rs
| ) |  |
| static

Definition at line 1592 of file road_gui.cpp.

## ◆ ToggleRoadButton_Remove()

static void ToggleRoadButton_Remove | ( | Window * | w | ) |
| static

Toggles state of the Remove button of Build road toolbar.

Parameters

  w | window the button belongs to

Definition at line 315 of file road_gui.cpp.

References Window::IsWidgetLowered(), Window::SetWidgetDirty(), Window::ToggleWidgetLoweredState(), and WID_ROT_REMOVE.

Referenced by BuildRoadToolbarWindow::OnClick(), and RoadToolbar_CtrlChanged().

## Variable Documentation

## ◆ _cur_roadtype

RoadType _cur_roadtype
| static

Definition at line 65 of file road_gui.cpp.

## ◆ _nested_build_road_depot_widgets

constexpr NWidgetPart _nested_build_road_depot_widgets[]
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BROD_CAPTION), SetDataTip(STR_BUILD_DEPOT_ROAD_ORIENTATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
NWidget(NWID_HORIZONTAL_LTR), SetPIP(0, WidgetDimensions::unscaled.hsep_normal, 0), SetPIPRatio(1, 0, 1), SetPadding(WidgetDimensions::unscaled.picker),
NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_normal, 0),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROD_DEPOT_NW), SetFill(0, 0), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROD_DEPOT_SW), SetFill(0, 0), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
EndContainer(),
NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_normal, 0),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROD_DEPOT_NE), SetFill(0, 0), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROD_DEPOT_SE), SetFill(0, 0), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
EndContainer(),
EndContainer(),
EndContainer(),
}
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition window_gui.h:96
SetFill
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition widget_type.h:1181
SetPIP
constexpr NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post)
Widget part function for setting a pre/inter/post spaces.
Definition widget_type.h:1271
SetPadding
constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
Widget part function for setting additional space around a widget.
Definition widget_type.h:1228
SetDataTip
constexpr NWidgetPart SetDataTip(uint32_t data, StringID tip)
Widget part function for setting the data and tooltip.
Definition widget_type.h:1202
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=-1)
Widget part function for starting a new 'real' widget.
Definition widget_type.h:1320
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition widget_type.h:1191
SetPIPRatio
constexpr NWidgetPart SetPIPRatio(uint8_t ratio_pre, uint8_t ratio_inter, uint8_t ratio_post)
Widget part function for setting a pre/inter/post ratio.
Definition widget_type.h:1283
WID_BROD_DEPOT_SE
@ WID_BROD_DEPOT_SE
Depot with SE entry.
Definition road_widget.h:39
WID_BROD_DEPOT_NE
@ WID_BROD_DEPOT_NE
Depot with NE entry.
Definition road_widget.h:38
WID_BROD_CAPTION
@ WID_BROD_CAPTION
Caption of the window.
Definition road_widget.h:37
WID_BROD_DEPOT_NW
@ WID_BROD_DEPOT_NW
Depot with NW entry.
Definition road_widget.h:41
WID_BROD_DEPOT_SW
@ WID_BROD_DEPOT_SW
Depot with SW entry.
Definition road_widget.h:40
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:75
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition widget_type.h:55
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:50
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:61
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition widget_type.h:77
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:69
NWID_HORIZONTAL_LTR
@ NWID_HORIZONTAL_LTR
Horizontal container that doesn't change the order of the widgets for RTL languages.
Definition widget_type.h:76

Definition at line 1147 of file road_gui.cpp.

## ◆ _nested_build_road_scen_widgets

constexpr NWidgetPart _nested_build_road_scen_widgets[]
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_ROT_CAPTION), SetDataTip(STR_JUST_STRING2, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), SetTextStyle(TC_WHITE),
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ROAD_X),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_X_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ROAD_Y),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_AUTOROAD),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOROAD, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOROAD),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_DEMOLISH),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, -1), SetMinimalSize(0, 22), SetFill(1, 1), EndContainer(),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ONE_WAY),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_ONE_WAY, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUILD_BRIDGE),
SetFill(0, 1), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUILD_TUNNEL),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_TUNNEL, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_TUNNEL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_REMOVE),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_ROAD),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_CONVERT_ROAD),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_CONVERT_ROAD, STR_ROAD_TOOLBAR_TOOLTIP_CONVERT_ROAD),
EndContainer(),
}
SetTextStyle
constexpr NWidgetPart SetTextStyle(TextColour colour, FontSize size=FS_NORMAL)
Widget part function for setting the text style.
Definition widget_type.h:1160
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition widget_type.h:1137
WID_ROT_BUILD_BRIDGE
@ WID_ROT_BUILD_BRIDGE
Build bridge.
Definition road_widget.h:26
WID_ROT_CAPTION
@ WID_ROT_CAPTION
Caption of the window.
Definition road_widget.h:16
WID_ROT_ROAD_Y
@ WID_ROT_ROAD_Y
Build road in y-direction.
Definition road_widget.h:18
WID_ROT_AUTOROAD
@ WID_ROT_AUTOROAD
Autorail.
Definition road_widget.h:19
WID_ROT_DEMOLISH
@ WID_ROT_DEMOLISH
Demolish.
Definition road_widget.h:20
WID_ROT_BUILD_TUNNEL
@ WID_ROT_BUILD_TUNNEL
Build tunnel.
Definition road_widget.h:27
WID_ROT_CONVERT_ROAD
@ WID_ROT_CONVERT_ROAD
Convert road.
Definition road_widget.h:29
WID_ROT_REMOVE
@ WID_ROT_REMOVE
Remove road.
Definition road_widget.h:28
WID_ROT_ONE_WAY
@ WID_ROT_ONE_WAY
Build one-way road.
Definition road_widget.h:25
WID_ROT_ROAD_X
@ WID_ROT_ROAD_X
Build road in x-direction.
Definition road_widget.h:17
WWT_IMGBTN
@ WWT_IMGBTN
(Toggle) Button with image
Definition widget_type.h:52
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition widget_type.h:66

Definition at line 1005 of file road_gui.cpp.

## ◆ _nested_build_road_waypoint_widgets

constexpr NWidgetPart _nested_build_road_waypoint_widgets[]
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WAYPOINT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_DEFSIZEBOX, COLOUR_DARK_GREEN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidgetFunction(MakePickerClassWidgets),
NWidgetFunction(MakePickerTypeWidgets),
EndContainer(),
}
NWidgetFunction
constexpr NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr)
Obtain a nested widget (sub)tree from an external source.
Definition widget_type.h:1341
MakePickerClassWidgets
std::unique_ptr< NWidgetBase > MakePickerClassWidgets()
Create nested widgets for the class picker widgets.
Definition picker_gui.cpp:623
MakePickerTypeWidgets
std::unique_ptr< NWidgetBase > MakePickerTypeWidgets()
Create nested widgets for the type picker widgets.
Definition picker_gui.cpp:646
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition widget_type.h:64
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition widget_type.h:65

Nested widget definition for the build NewGRF road waypoint window.

Definition at line 1684 of file road_gui.cpp.

## ◆ _nested_build_road_widgets

constexpr NWidgetPart _nested_build_road_widgets[]
| staticconstexpr

Definition at line 899 of file road_gui.cpp.

## ◆ _nested_build_tramway_scen_widgets

constexpr NWidgetPart _nested_build_tramway_scen_widgets[]
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_ROT_CAPTION), SetDataTip(STR_JUST_STRING2, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), SetTextStyle(TC_WHITE),
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ROAD_X),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRAMWAY_X_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_SECTION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ROAD_Y),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRAMWAY_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_SECTION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_AUTOROAD),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOTRAM, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOTRAM),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_DEMOLISH),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, -1), SetMinimalSize(0, 22), SetFill(1, 1), EndContainer(),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUILD_BRIDGE),
SetFill(0, 1), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_BRIDGE),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUILD_TUNNEL),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_TUNNEL, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_TUNNEL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_REMOVE),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_CONVERT_ROAD),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_CONVERT_ROAD, STR_ROAD_TOOLBAR_TOOLTIP_CONVERT_TRAM),
EndContainer(),
}

Definition at line 1042 of file road_gui.cpp.

## ◆ _nested_build_tramway_widgets

constexpr NWidgetPart _nested_build_tramway_widgets[]
| staticconstexpr

Definition at line 944 of file road_gui.cpp.

## ◆ _nested_road_station_picker_widgets

constexpr NWidgetPart _nested_road_station_picker_widgets[]
| staticconstexpr

Widget definition of the build road station window.

Definition at line 1491 of file road_gui.cpp.

## ◆ _nested_tram_station_picker_widgets

constexpr NWidgetPart _nested_tram_station_picker_widgets[]
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BROS_CAPTION),
NWidget(WWT_SHADEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_DEFSIZEBOX, COLOUR_DARK_GREEN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
NWidgetFunction(MakePickerClassWidgets),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_picker, 0), SetPadding(WidgetDimensions::unscaled.picker),
NWidget(NWID_HORIZONTAL_LTR), SetPIP(0, WidgetDimensions::unscaled.hsep_normal, 0), SetPIPRatio(1, 0, 1),
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_X), SetFill(0, 0), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_Y), SetFill(0, 0), EndContainer(),
EndContainer(),
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
NWidget(NWID_HORIZONTAL), SetPIPRatio(1, 0, 1),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_OFF), SetMinimalSize(60, 12),
SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_ON), SetMinimalSize(60, 12),
SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
EndContainer(),
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BROS_ACCEPTANCE), SetFill(1, 1), SetResize(1, 0), SetMinimalTextLines(2, 0),
EndContainer(),
EndContainer(),
EndContainer(),
NWidgetFunction(MakePickerTypeWidgets),
EndContainer(),
}
SetMinimalTextLines
constexpr NWidgetPart SetMinimalTextLines(uint8_t lines, uint8_t spacing, FontSize size=FS_NORMAL)
Widget part function for setting the minimal text lines.
Definition widget_type.h:1149
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition widget_type.h:1126
WID_BROS_LT_ON
@ WID_BROS_LT_ON
Turn on area highlight.
Definition road_widget.h:55
WID_BROS_ACCEPTANCE
@ WID_BROS_ACCEPTANCE
Station acceptance info.
Definition road_widget.h:56
WID_BROS_STATION_X
@ WID_BROS_STATION_X
Drive-through station in x-direction.
Definition road_widget.h:52
WID_BROS_CAPTION
@ WID_BROS_CAPTION
Caption of the window.
Definition road_widget.h:47
WID_BROS_STATION_Y
@ WID_BROS_STATION_Y
Drive-through station in y-direction.
Definition road_widget.h:53
WID_BROS_LT_OFF
@ WID_BROS_LT_OFF
Turn off area highlight.
Definition road_widget.h:54
WWT_LABEL
@ WWT_LABEL
Centered label.
Definition widget_type.h:57
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget tree.
Definition widget_type.h:48

Widget definition of the build tram station window.

Definition at line 1553 of file road_gui.cpp.

## ◆ _one_way_button_clicked

bool _one_way_button_clicked
| static

Definition at line 58 of file road_gui.cpp.

## ◆ _place_road_dir

Axis _place_road_dir
| static

Definition at line 60 of file road_gui.cpp.

## ◆ _place_road_end_half

bool _place_road_end_half
| static

Definition at line 63 of file road_gui.cpp.

## ◆ _place_road_start_half_x

bool _place_road_start_half_x
| static

Definition at line 61 of file road_gui.cpp.

## ◆ _place_road_start_half_y

bool _place_road_start_half_y
| static

Definition at line 62 of file road_gui.cpp.

## ◆ _remove_button_clicked

bool _remove_button_clicked
| static

Definition at line 57 of file road_gui.cpp.

## ◆ _road_depot_orientation

DiagDirection _road_depot_orientation
| static

Definition at line 67 of file road_gui.cpp.

## ◆ _roadstop_gui

RoadStopPickerSelection _roadstop_gui
| static

Definition at line 80 of file road_gui.cpp.

## ◆ _waypoint_gui

RoadWaypointPickerSelection _waypoint_gui
| static

Settings of the road waypoint picker.

Definition at line 73 of file road_gui.cpp.

Referenced by RoadWaypointPickerCallbacks::GetSelectedClass(), RoadWaypointPickerCallbacks::GetSelectedType(), BuildRoadToolbarWindow::OnPlaceMouseUp(), RoadWaypointPickerCallbacks::SetSelectedClass(), and RoadWaypointPickerCallbacks::SetSelectedType().