Go to the documentation of this file.
40 #include "table/strings.h"
45 static void ShowRoadDepotPicker(
Window *parent);
48 static bool _one_way_button_clicked;
50 static Axis _place_road_dir;
51 static bool _place_road_start_half_x;
52 static bool _place_road_start_half_y;
53 static bool _place_road_end_half;
122 if (result.
Failed())
return;
140 void CcRoadStop(
Commands cmd,
const CommandCost &result,
TileIndex tile, uint8 width, uint8 length,
RoadStopType,
bool is_drive_through,
DiagDirection dir,
RoadType, StationID,
bool)
142 if (result.
Failed())
return;
147 for (
TileIndex cur_tile : roadstop_area) {
171 auto proc = [=](
bool test, StationID to_join) ->
bool {
175 return Command<CMD_BUILD_ROAD_STOP>::Post(err_msg,
CcRoadStop, ta.
tile, ta.
w, ta.
h, stop_type, drive_through, ddir, rt, to_join, adjacent);
191 if (_road_station_picker_orientation <
DIAGDIR_END) {
209 if (_road_station_picker_orientation <
DIAGDIR_END) {
218 typedef void OnButtonClick(
Window *w);
260 this->Initialize(_cur_roadtype);
265 if (RoadTypeIsRoad(this->roadtype)) {
289 if (!gui_scope)
return;
290 RoadTramType rtt = GetRoadTramType(this->roadtype);
304 if (_game_mode != GM_EDITOR) {
307 this->GetWidget<NWidgetCore>(
WID_ROT_DEPOT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
308 this->GetWidget<NWidgetCore>(
WID_ROT_BUS_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
309 this->GetWidget<NWidgetCore>(
WID_ROT_TRUCK_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
311 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);
312 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);
313 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);
334 if (_game_mode != GM_EDITOR) {
356 SetDParam(0, STR_TOOLBAR_RAILTYPE_VELOCITY);
375 switch (clicked_widget) {
377 if (RoadTypeIsRoad(this->roadtype)) {
399 if (RoadTypeIsRoad(this->roadtype)) {
410 if (RoadTypeIsRoad(this->roadtype)) {
422 _one_way_button_clicked =
false;
426 this->last_started_action = widget;
431 this->last_started_action = widget;
436 this->last_started_action = widget;
441 this->last_started_action = widget;
446 ShowRoadDepotPicker(
this);
447 this->last_started_action = widget;
454 this->last_started_action = widget;
461 this->last_started_action = widget;
469 SetSelectionRed(
false);
474 this->last_started_action = widget;
479 this->last_started_action = widget;
492 this->last_started_action = widget;
495 default: NOT_REACHED();
511 switch (this->last_started_action) {
514 _place_road_start_half_x = _tile_fract_coords.x >= 8;
520 _place_road_start_half_y = _tile_fract_coords.y >= 8;
526 _place_road_start_half_x = _tile_fract_coords.x >= 8;
527 _place_road_start_half_y = _tile_fract_coords.y >= 8;
537 tile, _cur_roadtype, _road_depot_orientation);
561 default: NOT_REACHED();
573 if (RoadTypeIsRoad(this->roadtype)) {
591 switch (select_proc) {
593 _place_road_end_half = pt.x & 8;
597 _place_road_end_half = pt.y & 8;
604 ( (_tile_fract_coords.x < _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) < 16) ||
605 (_tile_fract_coords.x > _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) > 16) ))) {
608 _place_road_end_half = pt.x & 8;
612 _place_road_end_half = pt.y & 8;
627 switch (select_proc) {
628 default: NOT_REACHED();
641 bool start_half = _place_road_dir ==
AXIS_Y ? _place_road_start_half_y : _place_road_start_half_x;
645 end_tile, start_tile, _cur_roadtype, _place_road_dir, start_half, _place_road_end_half);
648 end_tile, start_tile, _cur_roadtype, _place_road_dir, _one_way_button_clicked ?
DRD_NORTHBOUND :
DRD_NONE, start_half, _place_road_end_half,
false);
709 switch (_game_mode) {
727 static EventState RoadToolbarGlobalHotkeys(
int hotkey)
729 extern RoadType _last_built_roadtype;
733 static EventState TramToolbarGlobalHotkeys(
int hotkey)
735 extern RoadType _last_built_tramtype;
739 static Hotkey roadtoolbar_hotkeys[] = {
754 HotkeyList BuildRoadToolbarWindow::road_hotkeys(
"roadtoolbar", roadtoolbar_hotkeys, RoadToolbarGlobalHotkeys);
756 static Hotkey tramtoolbar_hotkeys[] = {
770 HotkeyList BuildRoadToolbarWindow::tram_hotkeys(
"tramtoolbar", tramtoolbar_hotkeys, TramToolbarGlobalHotkeys);
773 static const NWidgetPart _nested_build_road_widgets[] = {
812 _nested_build_road_widgets,
lengthof(_nested_build_road_widgets),
813 &BuildRoadToolbarWindow::road_hotkeys
816 static const NWidgetPart _nested_build_tramway_widgets[] = {
853 _nested_build_tramway_widgets,
lengthof(_nested_build_tramway_widgets),
854 &BuildRoadToolbarWindow::tram_hotkeys
870 _cur_roadtype = roadtype;
872 return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_desc : &_build_tramway_desc,
TRANSPORT_ROAD);
875 static const NWidgetPart _nested_build_road_scen_widgets[] = {
905 WDP_AUTO,
"toolbar_road_scen", 0, 0,
908 _nested_build_road_scen_widgets,
lengthof(_nested_build_road_scen_widgets),
909 &BuildRoadToolbarWindow::road_hotkeys
912 static const NWidgetPart _nested_build_tramway_scen_widgets[] = {
940 WDP_AUTO,
"toolbar_tram_scen", 0, 0,
943 _nested_build_tramway_scen_widgets,
lengthof(_nested_build_tramway_scen_widgets),
944 &BuildRoadToolbarWindow::tram_hotkeys
954 _cur_roadtype = roadtype;
956 return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_scen_desc : &_build_tramway_scen_desc,
TRANSPORT_ROAD);
965 if (RoadTypeIsTram(_cur_roadtype)) {
966 this->GetWidget<NWidgetCore>(
WID_BROD_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION;
1016 static const NWidgetPart _nested_build_road_depot_widgets[] = {
1026 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_BROD_DEPOT_NW),
SetMinimalSize(66, 50),
SetFill(0, 0),
SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
EndContainer(),
1027 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_BROD_DEPOT_NE),
SetMinimalSize(66, 50),
SetFill(0, 0),
SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
EndContainer(),
1030 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_BROD_DEPOT_SW),
SetMinimalSize(66, 50),
SetFill(0, 0),
SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
EndContainer(),
1031 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_BROD_DEPOT_SE),
SetMinimalSize(66, 50),
SetFill(0, 0),
SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
EndContainer(),
1043 _nested_build_road_depot_widgets,
lengthof(_nested_build_road_depot_widgets)
1046 static void ShowRoadDepotPicker(
Window *parent)
1057 if (RoadTypeIsTram(_cur_roadtype) && _road_station_picker_orientation <
DIAGDIR_END) {
1087 SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
1101 if (
top > r.bottom) {
1123 _cur_dpi = &tmp_dpi;
1196 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
1198 SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
1229 NWidget(
WWT_LABEL, COLOUR_DARK_GREEN,
WID_BROS_INFO),
SetPadding(
WidgetDimensions::unscaled.framerect),
SetMinimalSize(140, 14),
SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
SetFill(1, 0),
1233 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
1235 SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
1251 new BuildRoadStationWindow(RoadTypeIsRoad(_cur_roadtype) ? &_road_station_picker_desc : &_tram_station_picker_desc, parent, rs);
1254 void InitializeRoadGui()
1257 _road_station_picker_orientation =
DIAGDIR_NW;
1269 DropDownList GetRoadTypeDropDownList(RoadTramTypes rtts,
bool for_replacement,
bool all_option)
1277 if (for_replacement) {
1297 if (!for_replacement) {
1298 for (
const auto &rt : _sorted_roadtypes) {
1299 if (!
HasBit(used_roadtypes, rt))
continue;
1305 for (
const auto &rt : _sorted_roadtypes) {
1307 if (!
HasBit(used_roadtypes, rt))
continue;
1312 if (for_replacement) {
1315 StringID str = rti->
max_speed > 0 ? STR_TOOLBAR_RAILTYPE_VELOCITY : STR_JUST_STRING;
1317 iconitem->SetDimension(d);
1322 list.emplace_back(item);
1325 if (list.size() == 0) {
1333 DropDownList GetScenRoadTypeDropDownList(RoadTramTypes rtts)
1347 for (
const auto &rt : _sorted_roadtypes) {
1348 if (!
HasBit(used_roadtypes, rt))
continue;
1352 for (
const auto &rt : _sorted_roadtypes) {
1353 if (!
HasBit(used_roadtypes, rt))
continue;
1357 StringID str = rti->
max_speed > 0 ? STR_TOOLBAR_RAILTYPE_VELOCITY : STR_JUST_STRING;
1359 item->SetDimension(d);
1362 list.emplace_back(item);
1365 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.
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
@ 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.
static void PlaceRoad_Bridge(TileIndex tile, Window *w)
Callback to start placing a bridge.
static constexpr bool IsInsideMM(const T x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
Point size
Size, in tile "units", of the white/red selection area.
@ ROADTYPE_END
Used for iterations.
StringID err_build_road
Building a normal piece of road.
int Height() const
Get height of Rect.
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.
void CcRoadStop(Commands cmd, const CommandCost &result, TileIndex tile, uint8 width, uint8 length, RoadStopType, bool is_drive_through, DiagDirection dir, RoadType, StationID, bool)
Command callback for building road stops.
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
RoadStopType
Types of RoadStops.
@ ROADSTOP_TRUCK
A standard stop for trucks.
Dimensions (a width and height) of a rectangle in 2D.
@ 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.
Commands
List of commands.
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.
static constexpr DoCommandFlag CommandFlagsToDCFlags(CommandFlags cmd_flags)
Extracts the DC flags needed for DoCommand from the flags returned by GetCommandFlags.
Axis
Allow incrementing of DiagDirDiff variables.
@ 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)
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.
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.
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
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.
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
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.
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.
@ INVALID_ROADTYPE
flag for invalid roadtype
CursorID road_nwse
Cursor for building rail in Y direction.
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.
@ 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.
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)
SoundSettings sound
sound effect settings
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.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
@ HT_DIAGONAL
Also allow 'diagonal rectangles'. Only usable in combination with HT_RECT or HT_POINT.
uint Horizontal() const
Get total horizontal padding of RectPadding.
uint16 w
The width of the area.
SpriteID auto_road
button for the autoroad construction
@ WC_TRUCK_STATION
Build truck station; Window numbers:
@ ES_NOT_HANDLED
The passed event is not handled.
bool Failed() const
Did this command fail?
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.
static int ScaleSpriteTrad(int value)
Scale traditional pixel dimensions to GUI zoom level, for drawing sprites.
Represents the covered area of e.g.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
void ShowSelectStationIfNeeded(TileArea ta, StationPickerCmdProc proc)
Show the station selection window when needed.
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:
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.
static void PlaceRoad_BusStation(TileIndex tile)
Callback for placing a bus station.
@ 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.
static void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, RoadStopType stop_type, bool adjacent, RoadType rt, StringID err_msg)
Place a new road stop.
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.
bool link_terraform_toolbar
display terraform toolbar when displaying rail, road, water and airport toolbars
@ DRD_NONE
None of the directions are disallowed.
uint Vertical() const
Get total vertical padding of RectPadding.
@ 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.
static DiagDirection GetTunnelBridgeDirection(TileIndex t)
Get the direction pointing to the other end.
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
@ 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
@ ROADSTOP_BUS
A standard stop for buses.
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:
struct RoadTypeInfo::@40 gui_sprites
struct containing the sprites for the road GUI.
@ INVALID_AXIS
Flag for an invalid Axis.
@ 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.
struct RoadTypeInfo::@41 cursor
Cursors associated with the road type.
@ WC_SCEN_LAND_GEN
Landscape generation (in Scenario Editor); Window numbers:
@ SCT_NON_PASSENGERS_ONLY
Draw all non-passenger class cargoes.
TileIndex tile
The base tile of the area.
CursorID autoroad
Cursor for autorail tool.
void CloseWindowByClass(WindowClass cls)
Close all windows of a given class.
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.
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.
RoadType
The different roadtypes we support.
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.
void CcBuildRoadTunnel(Commands cmd, const CommandCost &result, TileIndex start_tile)
Callback executed after a build road tunnel command has been called.
int top
y position of top edge of the window
void ToggleWidgetLoweredState(byte widget_index)
Invert the lowered/raised status of a widget.
bool click_beep
Beep on a random selection of buttons.
#define lengthof(x)
Return the length of an fixed size array.
@ VPM_X_LIMITED
Drag only in X axis with limited size.
@ ROAD_NONE
No road-part is build.
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)
void CloseWindowById(WindowClass cls, WindowNumber number, bool force)
Close a window by its class and window number (if it is open).
Window * ShowBuildRoadToolbar(RoadType roadtype)
Open the build road toolbar window.
static bool IsNormalRoadTile(TileIndex t)
Return whether a tile is a normal road tile.
@ TRANSPORT_ROAD
Transport by road vehicle.
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.
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.
int Width() const
Get width of Rect.
@ 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.
@ DRD_NORTHBOUND
All northbound traffic is disallowed.
GUISettings gui
settings related to the GUI
@ DDSP_BUILD_TRUCKSTOP
Road stop placement (trucks)
Data about how and where to blit pixels.
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.
struct RoadTypeInfo::@42 strings
Strings associated with the rail type.
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.
virtual void Close()
Hide the window and all its child windows, and mark them for a later deletion.