70 static void ShowBuildTrainDepotPicker(
Window *parent);
71 static void ShowBuildWaypointPicker(
Window *parent);
94 static void GenericPlaceRail(
TileIndex tile,
int cmd)
100 CcPlaySound_SPLAT_RAIL);
134 if (result.
Failed())
return;
175 if (result.
Failed())
return;
190 VpSetPlaceSizingLimit(-1);
254 CcPlaySound_SPLAT_RAIL);
337 VpSetPlaceSizingLimit(-1);
353 static void DoRailroadTrack(
int mode)
359 CcPlaySound_SPLAT_RAIL);
362 static void HandleAutodirPlacement()
371 DoRailroadTrack(trackstat);
414 CcPlaySound_SPLAT_RAIL);
426 this->SetupRailToolbar(railtype);
445 if (!gui_scope)
return;
456 this->railtype = railtype;
476 this->SetupRailToolbar(railtype);
480 void UpdateRemoveWidgetStatus(
int clicked_widget)
482 switch (clicked_widget) {
498 this->SetWidgetDisabledState(
WID_RAT_REMOVE, !this->IsWidgetLowered(clicked_widget));
515 SetDParam(0, STR_TOOLBAR_RAILTYPE_VELOCITY);
532 this->last_user_action = widget;
537 this->last_user_action = widget;
542 this->last_user_action = widget;
547 this->last_user_action = widget;
552 this->last_user_action = widget;
557 this->last_user_action = widget;
562 ShowBuildTrainDepotPicker(
this);
563 this->last_user_action = widget;
568 this->last_user_action = widget;
571 ShowBuildWaypointPicker(
this);
578 this->last_user_action = widget;
583 this->last_user_action = widget;
593 this->last_user_action = widget;
598 this->last_user_action = widget;
607 this->last_user_action = widget;
610 default: NOT_REACHED();
612 this->UpdateRemoveWidgetStatus(widget);
624 switch (this->last_user_action) {
679 default: NOT_REACHED();
694 switch (select_proc) {
695 default: NOT_REACHED();
702 HandleAutodirPlacement();
724 HandleStationPlacement(start_tile, end_tile);
746 this->RaiseButtons();
782 extern RailType _last_built_railtype;
790 static Hotkey railtoolbar_hotkeys[] = {
809 static const NWidgetPart _nested_build_rail_widgets[] = {
854 _nested_build_rail_widgets,
lengthof(_nested_build_rail_widgets),
855 &BuildRailToolbarWindow::hotkeys
884 uint numtracks = ta.
w;
885 uint platlength = ta.
h;
940 this->vscroll = NULL;
943 this->CreateNestedTree();
968 if (!newstation || _railstation.
station_class >= (
int)StationClass::GetClassCount()) {
973 this->vscroll2 = NULL;
980 for (uint i = 0; i < StationClass::GetClassCount(); i++) {
1019 for (uint bits = 0; bits < 7; bits++) {
1021 if (statspec == NULL) {
1030 this->DrawWidgets();
1044 this->coverage_height += top - bottom;
1054 for (uint i = 0; i < StationClass::GetClassCount(); i++) {
1058 size->width =
max(size->width, d.width + padding.width);
1060 size->height = 5 * this->line_height;
1061 resize->height = this->line_height;
1074 StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data;
1079 const StationSpec *statspec = stclass->GetSpec(j);
1080 SetDParam(0, (statspec != NULL && statspec->
name != 0) ? statspec->
name : STR_STATION_CLASS_DFLT);
1084 size->width =
max(size->width, d.width + padding.width);
1096 size->height = this->coverage_height;
1110 switch (
GB(widget, 0, 16)) {
1113 if (
FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
1115 _cur_dpi = &tmp_dpi;
1127 if (
FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
1129 _cur_dpi = &tmp_dpi;
1142 for (uint i = 0; i < StationClass::GetClassCount(); i++) {
1144 if (this->vscroll->
IsVisible(statclass)) {
1156 byte type =
GB(widget, 16, 16);
1165 if (
FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
1167 _cur_dpi = &tmp_dpi;
1182 if (this->vscroll != NULL) {
1191 SetDParam(0, (statspec != NULL && statspec->
name != 0) ? statspec->
name : STR_STATION_CLASS_DFLT);
1197 switch (
GB(widget, 0, 16)) {
1226 for (uint i = 0; i < 7; i++) {
1261 for (uint i = 0; i < 7; i++) {
1286 for (uint i = 0; i < 7; i++) {
1295 for (uint i = 0; i < 7; i++) {
1324 if (y >= (
int)StationClass::GetClassCount())
return;
1325 for (uint i = 0; i < StationClass::GetClassCount(); i++) {
1334 this->CheckSelectedSize(stclass->GetSpec(_railstation.
station_type));
1351 int y =
GB(widget, 16, 16);
1360 this->CheckSelectedSize(statspec);
1377 static const NWidgetPart _nested_station_builder_widgets[] = {
1395 NWidget(
WWT_LABEL, COLOUR_DARK_GREEN),
SetMinimalSize(144, 11),
SetDataTip(STR_STATION_BUILD_ORIENTATION, STR_NULL),
SetPadding(1, 2, 0, 2),
1398 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_BRAS_PLATFORM_DIR_X),
SetMinimalSize(66, 60),
SetFill(0, 0),
SetDataTip(0x0, STR_STATION_BUILD_RAILROAD_ORIENTATION_TOOLTIP),
EndContainer(),
1400 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_BRAS_PLATFORM_DIR_Y),
SetMinimalSize(66, 60),
SetFill(0, 0),
SetDataTip(0x0, STR_STATION_BUILD_RAILROAD_ORIENTATION_TOOLTIP),
EndContainer(),
1403 NWidget(
WWT_LABEL, COLOUR_DARK_GREEN,
WID_BRAS_SHOW_NEWST_TYPE),
SetMinimalSize(144, 11),
SetDataTip(STR_ORANGE_STRING, STR_NULL),
SetPadding(1, 2, 4, 2),
1404 NWidget(
WWT_LABEL, COLOUR_DARK_GREEN),
SetMinimalSize(144, 11),
SetDataTip(STR_STATION_BUILD_NUMBER_OF_TRACKS, STR_NULL),
SetPadding(0, 2, 0, 2),
1416 NWidget(
WWT_LABEL, COLOUR_DARK_GREEN),
SetMinimalSize(144, 11),
SetDataTip(STR_STATION_BUILD_PLATFORM_LENGTH, STR_NULL),
SetPadding(2, 2, 0, 2),
1434 NWidget(
WWT_LABEL, COLOUR_DARK_GREEN),
SetMinimalSize(144, 11),
SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
SetPadding(3, 2, 0, 2),
1438 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
1440 SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
1448 NWidget(
NWID_MATRIX, COLOUR_DARK_GREEN,
WID_BRAS_MATRIX),
SetScrollbar(
WID_BRAS_MATRIX_SCROLL),
SetPIP(0, 2, 0),
SetPadding(2, 0, 0, 0),
1472 WDP_AUTO,
"build_station_rail", 350, 0,
1475 _nested_station_builder_widgets,
lengthof(_nested_station_builder_widgets)
1501 const NWidgetBase *widget = this->GetWidget<NWidgetBase>(widget_index);
1502 int x = widget->
pos_x - offset.x +
1503 (widget->
current_x - sprite_size.width + offset.x) / 2;
1508 x + this->IsWidgetLowered(widget_index),
1509 y + this->IsWidgetLowered(widget_index));
1516 this->OnInvalidateData();
1527 this->sig_sprite_size.width = 0;
1528 this->sig_sprite_size.height = 0;
1529 this->sig_sprite_bottom_offset = 0;
1533 for (uint lowered = 0; lowered < 2; lowered++) {
1536 this->sig_sprite_bottom_offset = max<int>(this->sig_sprite_bottom_offset, sprite_size.height);
1537 this->sig_sprite_size.width = max<int>(this->sig_sprite_size.width, sprite_size.width - offset.x);
1538 this->sig_sprite_size.height = max<int>(this->sig_sprite_size.height, sprite_size.height - offset.y);
1572 this->DrawSignalSprite(widget, sprite);
1625 this->InvalidateData();
1635 if (!gui_scope)
return;
1687 _nested_signal_builder_widgets,
lengthof(_nested_signal_builder_widgets)
1772 _nested_build_depot_widgets,
lengthof(_nested_build_depot_widgets)
1775 static void ShowBuildTrainDepotPicker(
Window *parent)
1783 this->CreateNestedTree();
1799 size->width += resize->width * 2;
1800 size->height += resize->height * 2;
1815 switch (
GB(widget, 0, 16)) {
1817 byte type =
GB(widget, 16, 16);
1830 switch (
GB(widget, 0, 16)) {
1832 byte type =
GB(widget, 16, 16);
1871 _nested_build_waypoint_widgets,
lengthof(_nested_build_waypoint_widgets)
1874 static void ShowBuildWaypointPicker(
Window *parent)
1893 extern RailType _last_built_railtype;
1907 extern RailType _last_built_railtype;
1912 memset(count, 0,
sizeof(count));
1922 if (count[r] >= count[rt]) rt = r;
2014 if (!
HasBit(used_railtypes, rt))
continue;
EventState
State of handling an event.
Functions related to OTTD's strings.
Window * ShowBuildRailToolbar(RailType railtype)
Open the build rail toolbar window for a specific rail type.
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you've selected it...
static void ShowSignalBuilder(Window *parent)
Open the signal selection window.
don't allow building on structures
static void Swap(T &a, T &b)
Type safe swap operation.
virtual void OnPaint()
The window must be repainted.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition of stuff that is very close to a company, like the company struct itself.
#define FOR_ALL_SORTED_RAILTYPES(var)
Loop header for iterating over railtypes, sorted by sortorder.
static const NWidgetPart _nested_signal_builder_widgets[]
Nested widget definition of the build signal window.
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
Select station (when joining stations); Window numbers:
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
static TransportType GetTunnelBridgeTransportType(TileIndex t)
Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bri...
RailTypes
The different roadtypes we support, but then a bitmask of them.
Data about how and where to blit pixels.
void DrawSignalSprite(byte widget_index, SpriteID image) const
Draw dynamic a signal-sprite in a button in the signal GUI Draw the sprite +1px to the right and down...
bool link_terraform_toolbar
display terraform toolbar when displaying rail, road, water and airport toolbars
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen...
void CheckRedrawStationCoverage(const Window *w)
Check whether we need to redraw the station coverage text.
Point pos
Location, in tile "units", of the northern tile of the selected area.
Offset at right of a matrix cell.
static void GenericPlaceSignals(TileIndex tile)
Build a new signal or edit/remove a present signal, use CmdBuildSingleSignal() or CmdRemoveSingleSign...
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
byte landscape
the landscape we're currently in
SignalType
Type of signal, i.e.
SpriteID auto_rail
button for the autorail construction
bool enable_signal_gui
show the signal GUI when the signal button is pressed
area of land of limited size
Maps accessors for stations.
RailType
Enumeration for all possible railtypes.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
All data for a single hotkey.
High level window description.
StringID toolbar_caption
Caption in the construction toolbar GUI for this rail type.
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
Landscape generation (in Scenario Editor); Window numbers:
static void PlaceRail_Bridge(TileIndex tile, Window *w)
Start placing a rail bridge.
bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station)
Draw representation of a station tile for GUI purposes.
bool station_show_coverage
whether to highlight coverage area
static Titem * Get(size_t index)
Returns Titem with given index.
static bool IsBridgeTile(TileIndex t)
checks if there is a bridge on this tile
Hotkey related functions.
Functions related to dates.
static bool IsInsideMM(const T x, const uint min, const uint max)
Checks if a value is in an interval.
SpriteID build_y_rail
button for building single rail in Y direction
uint GetSpecCount() const
Get the number of allocated specs within the class.
int sig_sprite_bottom_offset
Maximum extent of signal GUI sprite from reference point towards bottom.
void ShowSelectStationIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the station selection window when needed.
Contains enums and function declarations connected with stations GUI.
uint8 default_rail_type
the default rail type for the rail GUI
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
Normal amount of vertical space between two paragraphs of text.
remove signals along a track (by dragging)
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
byte station_type
Station type within the currently selected custom station class (if newstations is true ) ...
The passed event is not handled.
void SetTileSelectSize(int w, int h)
Highlight w by h tiles at the cursor.
Track
These are used to specify a single track.
void CheckSelectedSize(const StationSpec *statspec)
Verify whether the currently selected station size is allowed after selecting a new station class/typ...
static const CursorID ANIMCURSOR_BUILDSIGNALS
1292 - 1293 - build signal
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
Drag only in X axis with limited size.
similar to VMP_RAILDIRS, but with different cursor
bool ValParamRailtype(const RailType rail)
Validate functions for rail building.
byte drag_signals_density
many signals density
Drag only in Y axis with limited size.
Functions related to vehicles.
byte station_spread
amount a station may spread
Build depot; Window numbers:
void ToggleWidgetLoweredState(byte widget_index)
Invert the lowered/raised status of a widget.
add signals along a track (by dragging)
static bool IsStationAvailable(const StationSpec *statspec)
Check whether a station type can be build.
flag for invalid roadtype
Northeast, upper right on your monitor.
static void ShowStationBuilder(Window *parent)
Open station build window.
Offset at top of a matrix cell.
void VpSetPresizeRange(TileIndex from, TileIndex to)
Highlights all tiles between a set of two tiles.
Track in the left corner of the tile (west)
void ShowSelectWaypointIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the waypoint selection window when needed.
The client is spectating.
bool CanBuildVehicleInfrastructure(VehicleType type)
Check whether we can build infrastructure for the given vehicle type.
static bool RailToolbar_CtrlChanged(Window *w)
Updates the Remove button because of Ctrl state change.
byte GetDigitWidth(FontSize size)
Return the maximum width of single digit.
Standard non-electric rails.
bool persistent_buildingtools
keep the building tools active after usage
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
Common return value for all commands.
CursorID autorail
Cursor for autorail tool.
static T max(const T a, const T b)
Returns the maximum of two values.
void RaiseWidget(byte widget_index)
Marks a widget as raised.
Year _cur_year
Current year, starting at 0.
struct RailtypeInfo::@39 strings
Strings associated with the rail type.
uint16 w
The width of the area.
Dimension sig_sprite_size
Maximum size of signal GUI sprites.
Determine whether a newstation should be made available to build.
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
virtual void OnResize()
Called after the window got resized.
StringID menu_text
Name of this rail type in the main toolbar dropdown.
StationSettings station
settings related to station management
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.
CursorID rail_ew
Cursor for building rail in E-W direction.
Functions, definitions and such used only by the GUI.
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
This struct contains all the info that is needed to draw and construct tracks.
T * Append(uint to_add=1)
Append an item and return it.
bool newstations
Are custom station definitions available?
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
RailType GetBestRailtype(const CompanyID company)
Returns the "best" railtype a company can build.
Functions related to (drawing on) viewports.
static SignalType _cur_signal_type
set the signal type (for signal GUI)
static void BuildRailClick_Remove(Window *w)
The "remove"-button click proc of the build-rail toolbar.
SpriteID signals[SIGTYPE_END][2][2]
signal GUI sprites (type, variant, state)
Data structure for an opened window.
bool _ctrl_pressed
Is Ctrl pressed?
build a single rail track
TrackBits
Bitfield corresponding to Track.
Bottom offset of image in the button.
Point selstart
The location where the dragging started.
Struct containing information relating to NewGRF classes for stations and airports.
Point selend
The location where the drag currently ends.
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.
Axis GetAxisForNewWaypoint(TileIndex tile)
Get the axis for a new waypoint.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a give tiletype.
static const NWidgetPart _nested_build_depot_widgets[]
Nested widget definition of the build rail depot window.
Offset at bottom of a matrix cell.
Track along the y-axis (north-west to south-east)
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)
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
This window is used for construction; close it whenever changing company.
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
SoundSettings sound
sound effect settings
Header file for things common for tunnels and bridges.
static WindowDesc _station_builder_desc(WDP_AUTO, "build_station_rail", 350, 0, WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_station_builder_widgets, lengthof(_nested_station_builder_widgets))
High level window description of the station-build window (default & newGRF)
void SetRedErrorSquare(TileIndex tile)
Set a tile to display a red error square.
Default railtype: most used.
void ReinitGuiAfterToggleElrail(bool disable)
Re-initialize rail-build toolbar after toggling support for electric trains.
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
Structure for buffering the build command when selecting a station to join.
Track in the right corner of the tile (east)
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
Simple vector template class, with automatic delete.
GRFFilePropsBase< NUM_CARGO+3 > grf_prop
Properties related the the grf file.
ClientSettings _settings_client
The current settings for this game.
Default railtype: first available.
bool Succeeded() const
Did this command succeed?
static bool HasStationTileRail(TileIndex t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint...
Definition of base types and functions in a cross-platform compatible way.
Build waypoint; Window numbers:
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
A number of safeguards to prevent using unsafe methods.
SpriteID build_ns_rail
button for building single rail in N-S direction
uint8 default_signal_type
the signal type to build by default.
Track in the lower corner of the tile (south)
List of hotkeys for a window.
uint line_height
Height of a single line in the newstation selection matrix (WID_BRAS_NEWST_LIST widget).
static void ToggleRailButton_Remove(Window *w)
Toggles state of the Remove button of Build rail toolbar.
RailTypes introduces_railtypes
Bitmask of which other railtypes are introduced when this railtype is introduced. ...
rectangle (stations, depots, ...)
bool ResetSignalVariant(int32 p)
Updates the current signal variant used in the signal GUI to the one adequate to current year...
Year semaphore_build_before
build semaphore signals automatically before this year
static EventState RailToolbarGlobalHotkeys(int hotkey)
Handler for global hotkeys of the BuildRailToolbarWindow.
bool IsWidgetDisabled(byte widget_index) const
Gets the enabled/disabled status of a widget.
static void PlaceRail_Station(TileIndex tile)
Place a rail station.
Represents the covered area of e.g.
static const NWidgetPart _nested_build_waypoint_widgets[]
Nested widget definition for the build NewGRF rail waypoint window.
Offset at left of a matrix cell.
HighLightStyle drawstyle
Lower bits 0-3 are reserved for detailed highlight information.
uint16 max_speed
Maximum speed for vehicles travelling on this rail type.
CursorID rail_nwse
Cursor for building rail in Y direction.
TileIndex _build_tunnel_endtile
The end of a tunnel; as hidden return from the tunnel build command for GUI purposes.
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
byte station_numtracks
the number of platforms to default on for rail stations
Build station; Window numbers:
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
SpriteID convert_rail
button for converting rail
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
autorail (one piece), lower bits: direction
DiagDirection
Enumeration for diagonal directions.
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process)
highlighting tiles while only going over them with the mouse
Catchment for all stations with "modified catchment" disabled.
#define lengthof(x)
Return the length of an fixed size array.
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte road_rail_type)
Prepare the data for the build a bridge window.
Build bridge; Window numbers:
static T min(const T a, const T b)
Returns the minimum of two values.
Right offset of the image in the button.
static WindowDesc _signal_builder_desc(WDP_AUTO, "build_signal", 0, 0, WC_BUILD_SIGNAL, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_signal_builder_widgets, lengthof(_nested_signal_builder_widgets))
Signal selection window description.
virtual void OnTick()
Called once per (game) tick.
Types related to the drop down widget.
Also allow 'diagonal rectangles'. Only usable in combination with HT_RECT or HT_POINT.
Functions related to sound.
bool Convert8bitBooleanCallback(const GRFFile *grffile, uint16 cbid, uint16 cb_res)
Converts a callback result into a boolean.
Functions to cache sprites in memory.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
static SignalVariant _cur_signal_variant
set the signal variant (for signal GUI)
void DeleteWindowByClass(WindowClass cls)
Delete all windows of a given class.
bool Failed() const
Did this command fail?
drag only in horizontal direction
static const uint8 PC_BLACK
Black palette colour.
static void PlaceRail_Waypoint(TileIndex tile)
Place a rail waypoint.
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
static bool _convert_signal_button
convert signal button in the signal GUI pressed
static void PlaceExtraDepotRail(TileIndex tile, DiagDirection dir, Track track)
Try to add an additional rail-track at the entrance of a depot.
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
Returns information about trackdirs and signal states.
byte station_platlength
the platform length, in tiles, for rail stations
DropDownList * GetRailTypeDropDownList(bool for_replacement, bool all_option)
Create a drop down list for all the rail types of the local company.
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
bool drag_signals_fixed_distance
keep fixed distance between signals when dragging
StringID replace_text
Text used in the autoreplace GUI.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Build toolbar; Window numbers:
SpriteID build_depot
button for building depots
static TrackBits DiagdirReachesTracks(DiagDirection diagdir)
Returns all tracks that can be reached when entering a tile from a given (diagonal) direction...
CursorID depot
Cursor for building a depot.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Build signal toolbar; Window numbers:
static byte _cur_waypoint_type
Currently selected waypoint type.
static RailTileType GetRailTileType(TileIndex t)
Returns the RailTileType (normal with or without signals, waypoint or depot).
TileIndex tile
The base tile of the area.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset)
Mark a tile given by its index dirty for repaint.
Mask for the tile drag-type modes.
static TrackBits GetTrackBits(TileIndex tile)
Gets the track bits of the given tile.
static DiagDirection _build_depot_direction
Currently selected depot direction.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Draw only every second pixel, used for greying-out.
No window, redirects to WC_MAIN_WINDOW.
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
CursorID convert
Cursor for converting track.
static TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
Determines type of the wormhole and returns its other end.
Functions related to companies.
virtual void SetStringParameters(int widget) const
Initialize string parameters for a widget.
static TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
static bool _remove_button_clicked
Flag whether 'remove' toggle-button is currently enabled.
static uint MapSize()
Get the size of the map.
area of land in X and Y directions
Header file for NewGRF stations.
GUISettings gui
settings related to the GUI
Tunnel entry/exit and bridge heads.
Align toward the toolbar.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
CursorID rail_swne
Cursor for building rail in X direction.
static void HandleAutoSignalPlacement()
Build new signals or remove signals or (if only one tile marked) edit a signal.
uint32 TileIndex
The index/ID of a Tile.
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode)
This code is shared for the majority of the pushbuttons.
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
bool HasRailtypeAvail(const CompanyID company, const RailType railtype)
Finds out if a company has a certain railtype available.
RailTypes avail_railtypes
Rail types available to the company.
bool modified_catchment
different-size catchment areas
static bool IsLevelCrossingTile(TileIndex t)
Return whether a tile is a level crossing tile.
Top offset of image in the button.
Catchment for train stations with "modified catchment" enabled.
static bool IsValidAxis(Axis d)
Checks if an integer value is a valid Axis.
Old-fashioned semaphore signal.
Availability of station in construction window.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
Functions related to zooming.
SpriteID build_tunnel
button for building a tunnel
bool station_dragdrop
whether drag and drop is enabled for stations
uint8 cycle_signal_types
what signal types to cycle with the build signal tool.
Normal rail tile without signals.
static Track FindFirstTrack(TrackBits tracks)
Returns first Track from TrackBits or INVALID_TRACK.
static TrackBits TrackStatusToTrackBits(TrackStatus ts)
Returns the present-track-information of a TrackStatus.
#define MAX_DAY
The number of days till the last day.
StationClassID station_class
Currently selected custom station class (if newstations is true )
static NewGRFClass * Get(Tid cls_id)
Get a particular class.
uint coverage_height
Height of the coverage texts.
bool confirm
Play sound effect on succesful constructions or other actions.
virtual void SetStringParameters(int widget) const
Initialize string parameters for a widget.
Axis orientation
Currently selected rail station orientation.
Functions related to commands.
static RailType _cur_railtype
Rail type of the current build-rail toolbar.
Coordinates of a point in 2D.
remove a single rail track
struct RailtypeInfo::@37 gui_sprites
struct containing the sprites for the rail GUI.
used for autorail highlighting (longer stretches), lower bits: direction
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
void InitializeRailGUI()
Resets the rail GUI - sets default railtype to build and resets the signal GUI.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-NULL) Titem.
Scrollbar * vscroll2
Vertical scrollbar of the matrix with new stations.
special mode used for highlighting while dragging (and for tunnels/docks)
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
Scrollbar * vscroll
Vertical scrollbar of the new station list.
static const Track _place_depot_extra_track[12]
Additional pieces of track to add at the entrance of a depot.
Functions that have tunnels and bridges in common.
Functions related to waypoints.
drag only in vertical direction
Offset at right to draw the frame rectangular area.
const struct GRFFile * grffile
grf file that introduced this entity
SpriteID tunnel
tunnel sprites base
CursorID rail_ns
Cursor for building rail in N-S direction.
remove a (rectangle of) tiles from a rail station
Default railtype: last available.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
byte callback_mask
Bitmask of station callbacks that have to be called.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
byte disallowed_lengths
Bitmask of platform lengths available for the station.
#define CMD_MSG(x)
Used to combine a StringID with the command.
GameCreationSettings game_creation
settings used during the creation of a game (map)
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows)...
Specification of a rectangle with absolute coordinates of all edges.
The passed event is handled.
Flag for invalid railtype.
Functions related to tile highlights.
void CcBuildRailTunnel(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
Command callback for building a tunnel.
Window functions not directly related to making/drawing windows.
StringID name
Name of this station.
virtual void OnInvalidateData(int data=0, bool gui_scope=true)
Some data on this window has become invalid.
Find a place automatically.
Track along the x-axis (north-east to south-west)
SpriteID build_x_rail
button for building single rail in X direction
String list item with parameters.
static RailStationGUISettings _railstation
Settings of the station builder GUI.
void InitializeRailGui()
Initialize rail building GUI settings.
byte disallowed_platforms
Bitmask of number of platforms available for the station.
GUI functions that shouldn't be here.
static const DiagDirection _place_depot_extra_dir[12]
Direction to check for existing track pieces.
SignalVariant
Variant of the signal, i.e.
virtual void OnInit()
Notification that the nested widget tree gets initialized.
byte climates
Climates supported by the engine.
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
Draw a waypoint.
uint16 h
The height of the area.
static byte _waypoint_count
Number of waypoint types.
SpriteID build_ew_rail
button for building single rail in E-W direction
Left offset of the image in the button.
Track in the upper corner of the tile (north)
byte station_count
Number of custom stations (if newstations is true )
Fake keycode bit to indicate global hotkeys.
remove a (rectangle of) tiles from a rail waypoint
Dimensions (a width and height) of a rectangle in 2D.
RailTypes AddDateIntroducedRailTypes(RailTypes current, Date date)
Add the rail types that are to be introduced at the given date.
bool click_beep
Beep on a random selection of buttons.
Offset at left to draw the frame rectangular area.
Axis
Allow incrementing of DiagDirDiff variables.
Game options window; Window numbers:
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
Base class for windows opened from a toolbar.
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.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
AutoDeleteSmallVector< const DropDownListItem *, 4 > DropDownList
A drop down list is a collection of drop down list items.
static void SetDefaultRailGui()
Set the initial (default) railtype to use.
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
StringID name
Name of this class.