Go to the documentation of this file.
37 #include "table/strings.h"
42 static void ShowRoadDepotPicker(
Window *parent);
45 static bool _one_way_button_clicked;
53 RF_START_HALFROAD_Y = 0x01,
54 RF_END_HALFROAD_Y = 0x02,
57 RF_START_HALFROAD_X = 0x08,
58 RF_END_HALFROAD_X = 0x10,
134 if (result.
Failed())
return;
160 if (result.
Failed())
return;
185 uint8 ddir = _road_station_picker_orientation;
186 SB(p2, 16, 16, INVALID_STATION);
208 if (_road_station_picker_orientation <
DIAGDIR_END) {
226 if (_road_station_picker_orientation <
DIAGDIR_END) {
235 typedef void OnButtonClick(
Window *w);
277 this->Initialize(_cur_roadtype);
282 if (RoadTypeIsRoad(this->roadtype)) {
305 if (!gui_scope)
return;
306 RoadTramType rtt = GetRoadTramType(this->roadtype);
320 if (_game_mode != GM_EDITOR) {
323 this->GetWidget<NWidgetCore>(
WID_ROT_DEPOT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
324 this->GetWidget<NWidgetCore>(
WID_ROT_BUS_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
325 this->GetWidget<NWidgetCore>(
WID_ROT_TRUCK_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
327 this->GetWidget<NWidgetCore>(
WID_ROT_DEPOT)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT);
328 this->GetWidget<NWidgetCore>(
WID_ROT_BUS_STATION)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION);
329 this->GetWidget<NWidgetCore>(
WID_ROT_TRUCK_STATION)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION);
350 if (_game_mode != GM_EDITOR) {
372 SetDParam(0, STR_TOOLBAR_RAILTYPE_VELOCITY);
391 switch (clicked_widget) {
393 if (RoadTypeIsRoad(this->roadtype)) {
415 if (RoadTypeIsRoad(this->roadtype)) {
426 if (RoadTypeIsRoad(this->roadtype)) {
438 _one_way_button_clicked =
false;
442 this->last_started_action = widget;
447 this->last_started_action = widget;
452 this->last_started_action = widget;
457 this->last_started_action = widget;
462 ShowRoadDepotPicker(
this);
463 this->last_started_action = widget;
470 this->last_started_action = widget;
477 this->last_started_action = widget;
485 SetSelectionRed(
false);
490 this->last_started_action = widget;
495 this->last_started_action = widget;
508 this->last_started_action = widget;
511 default: NOT_REACHED();
527 switch (this->last_started_action) {
529 _place_road_flag = RF_DIR_X;
530 if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X;
535 _place_road_flag = RF_DIR_Y;
536 if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
541 _place_road_flag = RF_NONE;
542 if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X;
543 if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
552 DoCommandP(tile, _cur_roadtype << 2 | _road_depot_orientation, 0,
577 default: NOT_REACHED();
589 if (RoadTypeIsRoad(this->roadtype)) {
607 switch (select_proc) {
609 _place_road_flag &= ~RF_END_HALFROAD_X;
610 if (pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
614 _place_road_flag &= ~RF_END_HALFROAD_Y;
615 if (pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
619 _place_road_flag &= ~(RF_END_HALFROAD_Y | RF_END_HALFROAD_X);
620 if (pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
621 if (pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
626 ( (_tile_fract_coords.x < _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) < 16) ||
627 (_tile_fract_coords.x > _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) > 16) ))) {
629 _place_road_flag &= ~RF_DIR_Y;
632 _place_road_flag |= RF_DIR_Y;
647 switch (select_proc) {
648 default: NOT_REACHED();
669 _place_road_flag = (
RoadFlags)((_place_road_flag & RF_DIR_Y) ? (_place_road_flag & 0x07) : (_place_road_flag >> 3));
671 DoCommandP(start_tile, end_tile, _place_road_flag | (_cur_roadtype << 3) | (_one_way_button_clicked << 10),
733 switch (_game_mode) {
751 static EventState RoadToolbarGlobalHotkeys(
int hotkey)
753 extern RoadType _last_built_roadtype;
757 static EventState TramToolbarGlobalHotkeys(
int hotkey)
759 extern RoadType _last_built_tramtype;
763 static Hotkey roadtoolbar_hotkeys[] = {
778 HotkeyList BuildRoadToolbarWindow::road_hotkeys(
"roadtoolbar", roadtoolbar_hotkeys, RoadToolbarGlobalHotkeys);
780 static Hotkey tramtoolbar_hotkeys[] = {
794 HotkeyList BuildRoadToolbarWindow::tram_hotkeys(
"tramtoolbar", tramtoolbar_hotkeys, TramToolbarGlobalHotkeys);
797 static const NWidgetPart _nested_build_road_widgets[] = {
836 _nested_build_road_widgets,
lengthof(_nested_build_road_widgets),
837 &BuildRoadToolbarWindow::road_hotkeys
840 static const NWidgetPart _nested_build_tramway_widgets[] = {
877 _nested_build_tramway_widgets,
lengthof(_nested_build_tramway_widgets),
878 &BuildRoadToolbarWindow::tram_hotkeys
894 _cur_roadtype = roadtype;
896 return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_desc : &_build_tramway_desc,
TRANSPORT_ROAD);
899 static const NWidgetPart _nested_build_road_scen_widgets[] = {
929 WDP_AUTO,
"toolbar_road_scen", 0, 0,
932 _nested_build_road_scen_widgets,
lengthof(_nested_build_road_scen_widgets),
933 &BuildRoadToolbarWindow::road_hotkeys
936 static const NWidgetPart _nested_build_tramway_scen_widgets[] = {
964 WDP_AUTO,
"toolbar_tram_scen", 0, 0,
967 _nested_build_tramway_scen_widgets,
lengthof(_nested_build_tramway_scen_widgets),
968 &BuildRoadToolbarWindow::tram_hotkeys
978 _cur_roadtype = roadtype;
980 return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_scen_desc : &_build_tramway_scen_desc,
TRANSPORT_ROAD);
989 if (RoadTypeIsTram(_cur_roadtype)) {
990 this->GetWidget<NWidgetCore>(
WID_BROD_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION;
1032 static const NWidgetPart _nested_build_road_depot_widgets[] = {
1066 _nested_build_road_depot_widgets,
lengthof(_nested_build_road_depot_widgets)
1069 static void ShowRoadDepotPicker(
Window *parent)
1080 if (RoadTypeIsTram(_cur_roadtype) && _road_station_picker_orientation <
DIAGDIR_END) {
1109 SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
1215 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
1217 SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
1253 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
1255 SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
1271 new BuildRoadStationWindow(RoadTypeIsRoad(_cur_roadtype) ? &_road_station_picker_desc : &_tram_station_picker_desc, parent, rs);
1274 void InitializeRoadGui()
1277 _road_station_picker_orientation =
DIAGDIR_NW;
1289 DropDownList GetRoadTypeDropDownList(RoadTramTypes rtts,
bool for_replacement,
bool all_option)
1297 if (for_replacement) {
1318 if (!for_replacement) {
1320 if (!
HasBit(used_roadtypes, rt))
continue;
1328 if (!
HasBit(used_roadtypes, rt))
continue;
1333 if (for_replacement) {
1336 StringID str = rti->
max_speed > 0 ? STR_TOOLBAR_RAILTYPE_VELOCITY : STR_JUST_STRING;
1338 iconitem->SetDimension(d);
1343 list.emplace_back(item);
1346 if (list.size() == 0) {
1354 DropDownList GetScenRoadTypeDropDownList(RoadTramTypes rtts)
1370 if (!
HasBit(used_roadtypes, rt))
continue;
1375 if (!
HasBit(used_roadtypes, rt))
continue;
1379 StringID str = rti->
max_speed > 0 ? STR_TOOLBAR_RAILTYPE_VELOCITY : STR_JUST_STRING;
1381 item->SetDimension(d);
1384 list.emplace_back(item);
1387 if (list.size() == 0) {
static const NWidgetPart _nested_tram_station_picker_widgets[]
Widget definition of the build tram station window.
@ ES_HANDLED
The passed event is handled.
StringID toolbar_caption
Caption in the construction toolbar GUI for this rail type.
void SetTileSelectSize(int w, int h)
Highlight w by h tiles at the cursor.
@ DDSP_DEMOLISH_AREA
Clear area.
static bool _remove_button_clicked
Flag whether 'remove' toggle-button is currently enabled.
@ CA_UNMODIFIED
Catchment for all stations with "modified catchment" disabled.
#define CMD_MSG(x)
Used to combine a StringID with the command.
uint32 TileIndex
The index/ID of a Tile.
static void PlaceRoad_Bridge(TileIndex tile, Window *w)
Callback to start placing a bridge.
struct RoadTypeInfo::@42 gui_sprites
struct containing the sprites for the road GUI.
Point size
Size, in tile "units", of the white/red selection area.
StringID err_build_road
Building a normal piece of road.
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
bool station_show_coverage
whether to highlight coverage area
static Titem * Get(size_t index)
Returns Titem with given index.
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
@ DDSP_PLACE_ROAD_Y_DIR
Road placement (Y axis)
void OnPaint() override
The window must be repainted.
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
StationSettings station
settings related to station management
String list item with parameters.
StringID menu_text
Name of this rail type in the main toolbar dropdown.
List of hotkeys for a window.
void VpSetPresizeRange(TileIndex from, TileIndex to)
Highlights all tiles between a set of two tiles.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
SpriteID build_y_road
button for building single rail in Y direction
Dimensions (a width and height) of a rectangle in 2D.
struct RoadTypeInfo::@44 strings
Strings associated with the rail type.
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
static void PlaceRoad_TruckStation(TileIndex tile)
Callback for placing a truck station.
RoadTypes avail_roadtypes
Road types available to this company.
void ReInit(int rx=0, int ry=0)
Re-initialize a window, and optionally change its size.
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you've selected it.
@ WC_SCEN_BUILD_TOOLBAR
Scenario build toolbar; Window numbers:
void CheckRedrawStationCoverage(const Window *w)
Check whether we need to redraw the station coverage text.
@ DDSP_REMOVE_BUSSTOP
Road stop removal (buses)
@ INVALID_ROADTYPE
flag for invalid roadtype
static Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
void SetRedErrorSquare(TileIndex tile)
Set a tile to display a red error square.
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
@ WDP_ALIGN_TOOLBAR
Align toward the toolbar.
@ DIAGDIR_END
Used for iterations.
void CcRoadStop(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
Command callback for building road stops.
Tindex index
Index of this pool item.
@ DDSP_BUILD_BUSSTOP
Road stop placement (buses)
SpriteID build_depot
button for building depots
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
bool _ctrl_pressed
Is Ctrl pressed?
@ SND_15_BEEP
19 == 0x13 GUI button click
StringID err_remove_station[2]
Removing of a bus or truck station.
@ ROADTYPE_END
Used for iterations.
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Structure for buffering the build command when selecting a station to join.
void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
Draw the road depot sprite.
@ VPM_FIX_Y
drag only in Y axis
ClientSettings _settings_client
The current settings for this game.
RoadTypes AddDateIntroducedRoadTypes(RoadTypes current, Date date)
Add the road types that are to be introduced at the given date.
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
RoadTypes GetCompanyRoadTypes(CompanyID company, bool introduces)
Get the road types the given company can build.
void DeleteWindowByClass(WindowClass cls)
Delete all windows of a given class.
int32 WindowNumber
Number to differentiate different windows of the same class.
CursorID tunnel
Cursor for building a tunnel.
StringID replace_text
Text used in the autoreplace GUI.
@ VEH_ROAD
Road vehicle type.
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
StringID err_remove_road
Removing a normal piece of road.
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
CursorID depot
Cursor for building a depot.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
CursorID road_nwse
Cursor for building rail in Y direction.
@ CMD_BUILD_TUNNEL
build a tunnel
RoadFlags
Define the values of the RoadFlags.
CursorID road_swne
Cursor for building rail in X direction.
bool Succeeded() const
Did this command succeed?
static RoadBits DiagDirToRoadBits(DiagDirection d)
Create the road-part which belongs to the given DiagDirection.
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
The user has dragged over the map when the tile highlight mode has been set.
@ ROADSTOP_BUS
A standard stop for buses.
static bool IsInsideMM(const T x, const size_t min, const size_t max)
Checks if a value is in an interval.
@ DDSP_PLACE_ROAD_X_DIR
Road placement (X axis)
static void ToggleRoadButton_Remove(Window *w)
Toggles state of the Remove button of Build road toolbar.
High level window description.
StationType
Station types.
@ TRANSPORT_ROAD
Transport by road vehicle.
@ ROAD_NONE
No road-part is build.
static RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
Get the present road bits for a specific road type.
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
RoadTypes _roadtypes_type
Bitmap of road/tram types.
@ WDP_AUTO
Find a place automatically.
@ SCT_PASSENGERS_ONLY
Draw only passenger class cargoes.
static bool IsBridgeTile(TileIndex t)
checks if there is a bridge on this tile
ResizeInfo resize
Resize information.
Common return value for all commands.
Date _date
Current date in days (day counter)
#define TILE_AREA_LOOP(var, ta)
A loop which iterates over the tiles of a TileArea.
SoundSettings sound
sound effect settings
@ CMD_BUILD_ROAD
build a "half" road
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
StationCoverageType
Types of cargo to display for station coverage.
@ VPM_FIX_X
drag only in X axis
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process)
highlighting tiles while only going over them with the mouse
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
@ CMD_REMOVE_LONG_ROAD
remove a complete road (not a "half" one)
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
@ CMD_BUILD_ROAD_STOP
build a road stop
@ WD_FRAMERECT_LEFT
Offset at left to draw the frame rectangular area.
@ HT_DIAGONAL
Also allow 'diagonal rectangles'. Only usable in combination with HT_RECT or HT_POINT.
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
@ CMD_BUILD_ROAD_DEPOT
build a road depot
uint16 w
The width of the area.
SpriteID auto_road
button for the autoroad construction
@ WC_TRUCK_STATION
Build truck station; Window numbers:
@ WD_PAR_VSEP_NORMAL
Normal amount of vertical space between two paragraphs of text.
@ WD_FRAMERECT_RIGHT
Offset at right to draw the frame rectangular area.
@ ES_NOT_HANDLED
The passed event is not handled.
bool Failed() const
Did this command fail?
struct RoadTypeInfo::@43 cursor
Cursors associated with the road type.
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
Represents the covered area of e.g.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
@ DDSP_REMOVE_TRUCKSTOP
Road stop removal (trucks)
@ WC_BUS_STATION
Build bus station; Window numbers:
@ CMD_BUILD_LONG_ROAD
build a complete road (not a "half" one)
void SetWidgetDisabledState(byte widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
Window * parent
Parent window.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode)
This code is shared for the majority of the pushbuttons.
@ WC_BUILD_BRIDGE
Build bridge; Window numbers:
@ CA_BUS
Catchment for bus stops with "modified catchment" enabled.
static DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
@ ROADSTOP_TRUCK
A standard stop for trucks.
static void PlaceRoad_BusStation(TileIndex tile)
Callback for placing a bus station.
#define FOR_ALL_SORTED_ROADTYPES(var)
Loop header for iterating over roadtypes, sorted by sortorder.
@ DDSP_PLACE_AUTOROAD
Road placement (auto)
@ DDSP_BUILD_BRIDGE
Bridge placement.
Point pos
Location, in tile "units", of the northern tile of the selected area.
@ CA_TRUCK
Catchment for truck stops with "modified catchment" enabled.
Coordinates of a point in 2D.
bool ValParamRoadType(RoadType roadtype)
Validate functions for rail building.
DiagDirection
Enumeration for diagonal directions.
SpriteID build_tunnel
button for building a tunnel
byte station_spread
amount a station may spread
WindowNumber window_number
Window number within the window class.
RoadType
The different roadtypes we support.
bool link_terraform_toolbar
display terraform toolbar when displaying rail, road, water and airport toolbars
@ CMD_CONVERT_ROAD
convert a road type
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
bool CanBuildVehicleInfrastructure(VehicleType type, byte subtype)
Check whether we can build infrastructure for the given vehicle type.
void ShowSelectStationIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the station selection window when needed.
static DiagDirection GetTunnelBridgeDirection(TileIndex t)
Get the direction pointing to the other end.
@ WC_BUILD_DEPOT
Build depot; Window numbers:
static const NWidgetPart _nested_road_station_picker_widgets[]
Widget definition of the build road station window.
uint16 h
The height of the area.
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
StringID picker_tooltip[2]
Tooltip for the station picker for bus or truck stations.
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte road_rail_type)
Prepare the data for the build a bridge window.
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)
SpriteID build_x_road
button for building single rail in X direction
SpriteID convert_road
button for converting road types
uint32 StringID
Numeric value that represents a string, independent of the selected language.
bool confirm
Play sound effect on successful constructions or other actions.
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
@ VPM_Y_LIMITED
Drag only in Y axis with limited size.
StringID err_build_station[2]
Building a bus or truck station.
static EventState RoadTramToolbarGlobalHotkeys(int hotkey, RoadType last_build, RoadTramType rtt)
Handler for global hotkeys of the BuildRoadToolbarWindow.
RoadStopType
Types of RoadStops.
@ WC_SCEN_LAND_GEN
Landscape generation (in Scenario Editor); Window numbers:
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
@ SCT_NON_PASSENGERS_ONLY
Draw all non-passenger class cargoes.
TileIndex tile
The base tile of the area.
CursorID autoroad
Cursor for autorail tool.
TileIndex _build_tunnel_endtile
The end of a tunnel; as hidden return from the tunnel build command for GUI purposes.
StringID err_convert_road
Converting a road type.
@ CMD_REMOVE_ROAD_STOP
remove a road stop
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets,...)
Sets the enabled/disabled status of a list of widgets.
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
EventState
State of handling an event.
@ HT_RECT
rectangle (stations, depots, ...)
static bool RoadToolbar_CtrlChanged(Window *w)
Updates the Remove button because of Ctrl state change.
@ VPM_X_AND_Y
area of land in X and Y directions
static const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
WindowClass window_class
Window class.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
@ DC_AUTO
don't allow building on structures
@ DDSP_CONVERT_ROAD
Road conversion.
Base class for windows opened from a toolbar.
void SetViewportCatchmentStation(const Station *st, bool sel)
Select or deselect station for coverage area highlight.
int top
y position of top edge of the window
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
void ToggleWidgetLoweredState(byte widget_index)
Invert the lowered/raised status of a widget.
bool click_beep
Beep on a random selection of buttons.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
#define lengthof(x)
Return the length of an fixed size array.
@ VPM_X_LIMITED
Drag only in X axis with limited size.
uint16 max_speed
Maximum speed for vehicles travelling on this road type.
@ SND_1F_CONSTRUCTION_OTHER
29 == 0x1D Construction: other (non-water, non-rail, non-bridge)
Window * ShowBuildRoadToolbar(RoadType roadtype)
Open the build road toolbar window.
static bool IsNormalRoadTile(TileIndex t)
Return whether a tile is a normal road tile.
static TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
Determines type of the wormhole and returns its other end.
TileIndex tile
Tile index.
Data structure for an opened window.
RoadTypes GetRoadTypes(bool introduces)
Get list of road types, regardless of company availability.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
void RaiseWidget(byte widget_index)
Marks a widget as raised.
void OnRealtimeTick(uint delta_ms) override
Called periodically.
static void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, uint32 p2, uint32 cmd)
Place a new road stop.
void DrawWidgets() const
Paint all widgets of a window.
StringID err_depot
Building a depot.
void ConnectRoadToStructure(TileIndex tile, DiagDirection direction)
If required, connects a new structure to an existing road or tram by building the missing roadbit.
@ VPM_X_AND_Y_LIMITED
area of land of limited size
void InitializeRoadGUI()
I really don't know why rail_gui.cpp has this too, shouldn't be included in the other one?
bool IsWidgetDisabled(byte widget_index) const
Gets the enabled/disabled status of a widget.
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
@ ROADTYPES_NONE
No roadtypes.
Specification of a rectangle with absolute coordinates of all edges.
void LowerWidget(byte widget_index)
Marks a widget as lowered.
@ VPM_X_OR_Y
drag in X or Y direction
void DisableWidget(byte widget_index)
Sets a widget to disabled.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
@ HT_SPECIAL
special mode used for highlighting while dragging (and for tunnels/docks)
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
StringID picker_title[2]
Title for the station picker for bus or truck stations.
List item with icon and string.
GUISettings gui
settings related to the GUI
void CcBuildRoadTunnel(const CommandCost &result, TileIndex start_tile, uint32 p1, uint32 p2, uint32 cmd)
Callback executed after a build road tunnel command has been called.
@ DDSP_BUILD_TRUCKSTOP
Road stop placement (trucks)
bool persistent_buildingtools
keep the building tools active after usage
bool modified_catchment
different-size catchment areas
static TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
All data for a single hotkey.
void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen)
Resize the window.
@ INVALID_RAILTYPE
Flag for invalid railtype.
Window * ShowBuildRoadScenToolbar(RoadType roadtype)
Show the road building toolbar in the scenario editor.