|
OpenTTD Source 20251117-master-g7398d2e290
|
Graphical user interface for bridge construction. More...
#include "stdafx.h"#include "error.h"#include "command_func.h"#include "rail.h"#include "road.h"#include "strings_func.h"#include "window_func.h"#include "sound_func.h"#include "gfx_func.h"#include "tunnelbridge.h"#include "sortlist_type.h"#include "dropdown_func.h"#include "core/geometry_func.hpp"#include "tunnelbridge_map.h"#include "road_gui.h"#include "tunnelbridge_cmd.h"#include "widgets/bridge_widget.h"#include "table/strings.h"#include "safeguards.h"Go to the source code of this file.
Data Structures | |
| struct | BuildBridgeData |
| Carriage for the data we need if we want to build a bridge. More... | |
| class | BuildBridgeWindow |
| Window class for handling the bridge-build GUI. More... | |
Typedefs | |
| typedef GUIList< BuildBridgeData > | GUIBridgeList |
| List of bridges, used in BuildBridgeWindow. | |
Functions | |
| void | CcBuildBridge (Commands, const CommandCost &result, TileIndex end_tile, TileIndex tile_start, TransportType transport_type, BridgeType, uint8_t) |
| Callback executed after a build Bridge CMD has been called. | |
| void | ShowBuildBridgeWindow (TileIndex start, TileIndex end, TransportType transport_type, uint8_t road_rail_type) |
| Prepare the data for the build a bridge window. | |
Variables | |
| static BridgeType | _last_railbridge_type = 0 |
| The type of the last built rail bridge. | |
| static BridgeType | _last_roadbridge_type = 0 |
| The type of the last built road bridge. | |
| static constexpr std::initializer_list< NWidgetPart > | _nested_build_bridge_widgets |
| Widgets of the bridge gui. | |
| static WindowDesc | _build_bridge_desc (WDP_AUTO, "build_bridge", 200, 114, WC_BUILD_BRIDGE, WC_BUILD_TOOLBAR, WindowDefaultFlag::Construction, _nested_build_bridge_widgets) |
| Window definition for the rail bridge selection window. | |
Graphical user interface for bridge construction.
Definition in file bridge_gui.cpp.
| typedef GUIList<BuildBridgeData> GUIBridgeList |
List of bridges, used in BuildBridgeWindow.
Definition at line 47 of file bridge_gui.cpp.
| void CcBuildBridge | ( | Commands | cmd, |
| const CommandCost & | result, | ||
| TileIndex | end_tile, | ||
| TileIndex | tile_start, | ||
| TransportType | transport_type, | ||
| BridgeType | , | ||
| uint8_t | |||
| ) |
Callback executed after a build Bridge CMD has been called.
| result | Whether the build succeeded |
| end_tile | End tile of the bridge. |
| tile_start | start tile |
| transport_type | transport type. |
Definition at line 57 of file bridge_gui.cpp.
References _settings_client, SoundSettings::confirm, ConnectRoadToStructure(), CommandCost::Failed(), GetTunnelBridgeDirection(), ReverseDiagDir(), SND_27_CONSTRUCTION_BRIDGE, ClientSettings::sound, and TRANSPORT_ROAD.
Referenced by BuildDocksToolbarWindow::OnPlaceObject(), and ShowBuildBridgeWindow().
| void ShowBuildBridgeWindow | ( | TileIndex | start, |
| TileIndex | end, | ||
| TransportType | transport_type, | ||
| uint8_t | road_rail_type | ||
| ) |
Prepare the data for the build a bridge window.
If we can't build a bridge under the given conditions show an error message.
| start | The start tile of the bridge |
| end | The end tile of the bridge |
| transport_type | The transport type |
| road_rail_type | The road/rail type |
Definition at line 357 of file bridge_gui.cpp.
References _build_bridge_desc, _ctrl_pressed, _last_railbridge_type, _last_roadbridge_type, CalcBridgeLenCostFactor(), CcBuildBridge(), CheckBridgeAvailability(), CloseWindowByClass(), CommandFlagsToDCFlags(), CommandCost::Failed(), GetBridgeSpec(), CommandCost::GetCost(), GetEncodedString(), GetTunnelBridgeLength(), INVALID_ROADTYPE, IsBridgeTile(), MAX_BRIDGES, BridgeSpec::price, QueryCost, RailBuildCost(), RoadBuildCost(), ShowErrorMessage(), CommandCost::Succeeded(), TILE_SIZE, TileX(), TileY(), TRANSPORT_RAIL, TRANSPORT_ROAD, and WC_BUILD_BRIDGE.
Referenced by BuildRailToolbarWindow::OnPlaceMouseUp(), and BuildRoadToolbarWindow::OnPlaceMouseUp().
|
static |
The type of the last built rail bridge.
Definition at line 34 of file bridge_gui.cpp.
Referenced by ShowBuildBridgeWindow().
|
static |
The type of the last built road bridge.
Definition at line 36 of file bridge_gui.cpp.
Referenced by ShowBuildBridgeWindow().
|
staticconstexpr |
Widgets of the bridge gui.
Definition at line 312 of file bridge_gui.cpp.