34 #include "table/strings.h" 38 static void ShowBuildDockStationPicker(
Window *parent);
39 static void ShowBuildDocksDepotPicker(
Window *parent);
41 static Axis _ship_depot_direction;
45 if (result.
Failed())
return;
83 if (length > max_length)
break;
86 if (tile_to != NULL) *tile_to = endtile;
118 if (!gui_scope)
return;
163 if (_game_mode != GM_EDITOR)
return;
178 switch (this->last_clicked_widget) {
196 uint32 p2 = (uint32)INVALID_STATION << 16;
221 default: NOT_REACHED();
233 switch (select_proc) {
294 const uint16 _dockstoolbar_aqueduct_keys[] = {
'B',
'8', 0};
296 static Hotkey dockstoolbar_hotkeys[] = {
335 _nested_build_docks_toolbar_widgets,
lengthof(_nested_build_docks_toolbar_widgets),
336 &BuildDocksToolbarWindow::hotkeys
351 return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc,
TRANSPORT_WATER);
376 WDP_AUTO,
"toolbar_water_scen", 0, 0,
379 _nested_build_docks_scen_toolbar_widgets,
lengthof(_nested_build_docks_scen_toolbar_widgets)
420 SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
481 _nested_build_dock_station_widgets,
lengthof(_nested_build_dock_station_widgets)
491 static void UpdateDocksDirection()
493 if (_ship_depot_direction !=
AXIS_X) {
505 UpdateDocksDirection();
543 UpdateDocksDirection();
550 static const NWidgetPart _nested_build_docks_depot_widgets[] = {
574 _nested_build_docks_depot_widgets,
lengthof(_nested_build_docks_depot_widgets)
578 static void ShowBuildDocksDepotPicker(
Window *parent)
584 void InitializeDockGui()
586 _ship_depot_direction =
AXIS_X;
EventState
State of handling an event.
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you've selected it...
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.
Select station (when joining stations); Window numbers:
bool link_terraform_toolbar
display terraform toolbar when displaying rail, road, water and airport toolbars
ResizeInfo resize
Resize information.
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
void CheckRedrawStationCoverage(const Window *w)
Check whether we need to redraw the station coverage text.
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.
Window * parent
Parent window.
virtual void OnPaint()
The window must be repainted.
All data for a single hotkey.
High level window description.
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
Landscape generation (in Scenario Editor); Window numbers:
Flag for an invalid DiagDirection.
int32 TileIndexDiff
An offset value between to tiles.
void DrawWidgets() const
Paint all widgets of a window.
bool station_show_coverage
whether to highlight coverage area
Scenario build toolbar; Window numbers:
Hotkey related functions.
'Coverage highlight' label.
void ShowSelectStationIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the station selection window when needed.
Contains enums and function declarations connected with stations GUI.
Normal amount of vertical space between two paragraphs of text.
The passed event is not handled.
void SetTileSelectSize(int w, int h)
Highlight w by h tiles at the cursor.
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets,...)
Sets the enabled/disabled status of a list of widgets.
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
Functions related to vehicles.
static uint TileX(TileIndex tile)
Get the X component of a tile.
Window * ShowBuildDocksToolbar()
Open the build water toolbar window.
static TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
Adds a DiagDir to a tile.
int top
y position of top edge of the window
Build depot; Window numbers:
virtual void OnPaint()
The window must be repainted.
virtual void OnTick()
Called once per (game) tick.
void VpSetPresizeRange(TileIndex from, TileIndex to)
Highlights all tiles between a set of two tiles.
static EventState DockToolbarGlobalHotkeys(int hotkey)
Handler for global hotkeys of the BuildDocksToolbarWindow.
bool CanBuildVehicleInfrastructure(VehicleType type)
Check whether we can build infrastructure for the given vehicle type.
bool persistent_buildingtools
keep the building tools active after usage
Common return value for all commands.
void RaiseWidget(byte widget_index)
Marks a widget as raised.
static const NWidgetPart _nested_build_dock_station_widgets[]
Nested widget parts of a build dock station window.
StationSettings station
settings related to station management
Functions, definitions and such used only by the GUI.
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Functions related to (drawing on) viewports.
Data structure for an opened window.
bool _ctrl_pressed
Is Ctrl pressed?
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.
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)
This window is used for construction; close it whenever changing company.
SoundSettings sound
sound effect settings
static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to=NULL)
Gets the other end of the aqueduct, if possible.
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
static DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Structure for buffering the build command when selecting a station to join.
Functions related to the gfx engine.
Functions related to slopes.
ClientSettings _settings_client
The current settings for this game.
bool Succeeded() const
Did this command succeed?
Definition of base types and functions in a cross-platform compatible way.
#define TILE_ADDXY(tile, x, y)
Adds a given offset to a tile.
A number of safeguards to prevent using unsafe methods.
List of hotkeys for a window.
rectangle (stations, depots, ...)
static bool IsValidDiagDirection(DiagDirection d)
Checks if an integer value is a valid DiagDirection.
void LowerWidget(byte widget_index)
Marks a widget as lowered.
uint16 max_bridge_length
maximum length of bridges
static WindowDesc _build_docks_scen_toolbar_desc(WDP_AUTO, "toolbar_water_scen", 0, 0, WC_SCEN_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_docks_scen_toolbar_widgets, lengthof(_nested_build_docks_scen_toolbar_widgets))
Window definition for the build docks in scenario editor window.
Build station; Window numbers:
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
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.
Build bridge; Window numbers:
static T min(const T a, const T b)
Returns the minimum of two values.
uint DistanceFromEdgeDir(TileIndex tile, DiagDirection dir)
Gets the distance to the edge of the map in given direction.
Also allow 'diagonal rectangles'. Only usable in combination with HT_RECT or HT_POINT.
static DiagDirection GetInclinedSlopeDirection(Slope s)
Returns the direction of an inclined slope.
Functions related to sound.
void DeleteWindowByClass(WindowClass cls)
Delete all windows of a given class.
bool Failed() const
Did this command fail?
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Build toolbar; Window numbers:
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).
Northern part of a depot.
Catchment for docks with "modified catchment" enabled.
Functions related to companies.
area of land in X and Y directions
void CcBuildBridge(const CommandCost &result, TileIndex end_tile, uint32 p1, uint32 p2)
Callback executed after a build Bridge CMD has been called.
GUISettings gui
settings related to the GUI
Align toward the toolbar.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
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.
bool modified_catchment
different-size catchment areas
static const NWidgetPart _nested_build_docks_toolbar_widgets[]
Nested widget parts of docks toolbar, game version.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Functions related to zooming.
Southern part of a depot.
bool confirm
Play sound effect on succesful constructions or other actions.
Functions related to commands.
Coordinates of a point in 2D.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-NULL) Titem.
special mode used for highlighting while dragging (and for tunnels/docks)
ConstructionSettings construction
construction of things in-game
static const NWidgetPart _nested_build_docks_scen_toolbar_widgets[]
Nested widget parts of docks toolbar, scenario editor version.
Offset at right to draw the frame rectangular area.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
#define CMD_MSG(x)
Used to combine a StringID with the command.
int32 WindowNumber
Number to differentiate different windows of the same class.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows)...
WindowNumber window_number
Window number within the window class.
Functions related to tile highlights.
Window functions not directly related to making/drawing windows.
Find a place automatically.
Functions related to water (management)
#define TILE_ADD(x, y)
Adds to tiles together.
GUI functions that shouldn't be here.
Window * ShowBuildDocksScenToolbar()
Open the build water toolbar window for the scenario editor.
void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen)
Resize the window.
Dimensions (a width and height) of a rectangle in 2D.
bool click_beep
Beep on a random selection of buttons.
Offset at left to draw the frame rectangular area.
This file contains all sprite-related enums and defines.
Axis
Allow incrementing of DiagDirDiff variables.
'Off' button of coverage high light.
Base class for windows opened from a toolbar.
BuildDockStationWidgets
Widget numbers of the build-dock GUI.
'On' button of coverage high light.