|
OpenTTD Source
1.10.0-RC1
|
GUI for building roads. More...
#include "stdafx.h"#include "gui.h"#include "window_gui.h"#include "station_gui.h"#include "terraform_gui.h"#include "viewport_func.h"#include "command_func.h"#include "road_cmd.h"#include "station_func.h"#include "window_func.h"#include "vehicle_func.h"#include "sound_func.h"#include "company_func.h"#include "tunnelbridge.h"#include "tunnelbridge_map.h"#include "tilehighlight_func.h"#include "company_base.h"#include "hotkeys.h"#include "road_gui.h"#include "zoom_func.h"#include "engine_base.h"#include "strings_func.h"#include "core/geometry_func.hpp"#include "date_func.h"#include "widgets/road_widget.h"#include "table/strings.h"#include "safeguards.h"Go to the source code of this file.
Data Structures | |
| struct | BuildRoadToolbarWindow |
| Road toolbar window handler. More... | |
| struct | BuildRoadDepotWindow |
| struct | BuildRoadStationWindow |
Typedefs | |
| typedef void | OnButtonClick(Window *w) |
Enumerations | |
| enum | RoadFlags { RF_NONE = 0x00, RF_START_HALFROAD_Y = 0x01, RF_END_HALFROAD_Y = 0x02, RF_DIR_Y = 0x04, RF_DIR_X = RF_NONE, RF_START_HALFROAD_X = 0x08, RF_END_HALFROAD_X = 0x10 } |
| Define the values of the RoadFlags. More... | |
Functions | |
| static void | ShowRVStationPicker (Window *parent, RoadStopType rs) |
| static void | ShowRoadDepotPicker (Window *parent) |
| void | CcPlaySound_SPLAT_OTHER (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd) |
| static void | PlaceRoad_Bridge (TileIndex tile, Window *w) |
| Callback to start placing a bridge. More... | |
| 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. More... | |
| void | ConnectRoadToStructure (TileIndex tile, DiagDirection direction) |
| If required, connects a new structure to an existing road or tram by building the missing roadbit. More... | |
| void | CcRoadDepot (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd) |
| void | CcRoadStop (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd) |
| Command callback for building road stops. More... | |
| static void | PlaceRoadStop (TileIndex start_tile, TileIndex end_tile, uint32 p2, uint32 cmd) |
| Place a new road stop. More... | |
| static void | PlaceRoad_BusStation (TileIndex tile) |
| Callback for placing a bus station. More... | |
| static void | PlaceRoad_TruckStation (TileIndex tile) |
| Callback for placing a truck station. More... | |
| static void | ToggleRoadButton_Remove (Window *w) |
| Toggles state of the Remove button of Build road toolbar. More... | |
| static bool | RoadToolbar_CtrlChanged (Window *w) |
| Updates the Remove button because of Ctrl state change. More... | |
| static EventState | RoadTramToolbarGlobalHotkeys (int hotkey, RoadType last_build) |
| Handler for global hotkeys of the BuildRoadToolbarWindow. More... | |
| static EventState | RoadToolbarGlobalHotkeys (int hotkey) |
| static EventState | TramToolbarGlobalHotkeys (int hotkey) |
| Window * | ShowBuildRoadToolbar (RoadType roadtype) |
| Open the build road toolbar window. More... | |
| Window * | ShowBuildRoadScenToolbar (RoadType roadtype) |
| Show the road building toolbar in the scenario editor. More... | |
| void | InitializeRoadGui () |
| void | InitializeRoadGUI () |
| I really don't know why rail_gui.cpp has this too, shouldn't be included in the other one? | |
| DropDownList | GetRoadTypeDropDownList (RoadTramTypes rtts, bool for_replacement, bool all_option) |
| DropDownList | GetScenRoadTypeDropDownList (RoadTramTypes rtts) |
Variables | |
| static bool | _remove_button_clicked |
| static bool | _one_way_button_clicked |
| static RoadFlags | _place_road_flag |
| static RoadType | _cur_roadtype |
| static DiagDirection | _road_depot_orientation |
| static DiagDirection | _road_station_picker_orientation |
| static Hotkey | roadtoolbar_hotkeys [] |
| static Hotkey | tramtoolbar_hotkeys [] |
| static const NWidgetPart | _nested_build_road_widgets [] |
| static WindowDesc | _build_road_desc (WDP_ALIGN_TOOLBAR, "toolbar_road", 0, 0, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_road_widgets, lengthof(_nested_build_road_widgets), &BuildRoadToolbarWindow::road_hotkeys) |
| static const NWidgetPart | _nested_build_tramway_widgets [] |
| static WindowDesc | _build_tramway_desc (WDP_ALIGN_TOOLBAR, "toolbar_tramway", 0, 0, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_tramway_widgets, lengthof(_nested_build_tramway_widgets), &BuildRoadToolbarWindow::tram_hotkeys) |
| static const NWidgetPart | _nested_build_road_scen_widgets [] |
| static WindowDesc | _build_road_scen_desc (WDP_AUTO, "toolbar_road_scen", 0, 0, WC_SCEN_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_road_scen_widgets, lengthof(_nested_build_road_scen_widgets), &BuildRoadToolbarWindow::road_hotkeys) |
| static const NWidgetPart | _nested_build_tramway_scen_widgets [] |
| static WindowDesc | _build_tramway_scen_desc (WDP_AUTO, "toolbar_tram_scen", 0, 0, WC_SCEN_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_tramway_scen_widgets, lengthof(_nested_build_tramway_scen_widgets), &BuildRoadToolbarWindow::tram_hotkeys) |
| static const NWidgetPart | _nested_build_road_depot_widgets [] |
| static WindowDesc | _build_road_depot_desc (WDP_AUTO, nullptr, 0, 0, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_build_road_depot_widgets, lengthof(_nested_build_road_depot_widgets)) |
| static const NWidgetPart | _nested_road_station_picker_widgets [] |
| Widget definition of the build road station window. | |
| static WindowDesc | _road_station_picker_desc (WDP_AUTO, nullptr, 0, 0, WC_BUS_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_road_station_picker_widgets, lengthof(_nested_road_station_picker_widgets)) |
| static const NWidgetPart | _nested_tram_station_picker_widgets [] |
| Widget definition of the build tram station window. More... | |
| static WindowDesc | _tram_station_picker_desc (WDP_AUTO, nullptr, 0, 0, WC_BUS_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_tram_station_picker_widgets, lengthof(_nested_tram_station_picker_widgets)) |
GUI for building roads.
Definition in file road_gui.cpp.
| enum RoadFlags |
Define the values of the RoadFlags.
Definition at line 51 of file road_gui.cpp.
| 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.
| result | Whether the build succeeded. |
| start_tile | Starting tile of the tunnel. |
| p1 | bit 0-3 railtype or roadtypes bit 8-9 transport type |
| p2 | unused |
| cmd | unused |
Definition at line 99 of file road_gui.cpp.
References _settings_client, SoundSettings::confirm, ClientSettings::sound, and CommandCost::Succeeded().
| void CcRoadStop | ( | const CommandCost & | result, |
| TileIndex | tile, | ||
| uint32 | p1, | ||
| uint32 | p2, | ||
| uint32 | cmd | ||
| ) |
Command callback for building road stops.
| result | Result of the build road stop command. |
| tile | Start tile. |
| p1 | bit 0..7: Width of the road stop. bit 8..15: Length of the road stop. |
| p2 | bit 0: 0 For bus stops, 1 for truck stops. bit 1: 0 For normal stops, 1 for drive-through. bit 2: Allow stations directly adjacent to other stations. bit 3..4: Entrance direction (DiagDirection) for normal stops. bit 3: Axis of the road for drive-through stops. bit 5..9: The roadtype. bit 16..31: Station ID to join (NEW_STATION if build new one). |
| cmd | Unused. |
Definition at line 158 of file road_gui.cpp.
References _settings_client, SoundSettings::confirm, CommandCost::Failed(), GB(), and ClientSettings::sound.
| void ConnectRoadToStructure | ( | TileIndex | tile, |
| DiagDirection | direction | ||
| ) |
If required, connects a new structure to an existing road or tram by building the missing roadbit.
| tile | Tile containing the structure to connect. |
| direction | Direction to check. |
Definition at line 121 of file road_gui.cpp.
References GetRoadBits(), IsNormalRoadTile(), and TileOffsByDiagDir().
Callback to start placing a bridge.
| tile | Start tile of the bridge. |
Definition at line 78 of file road_gui.cpp.
References DDSP_BUILD_BRIDGE, GetOtherTunnelBridgeEnd(), IsBridgeTile(), Window::OnPlaceMouseUp(), VPM_X_OR_Y, and VpStartPlaceSizing().
|
static |
Callback for placing a bus station.
| tile | Position to place the station. |
Definition at line 203 of file road_gui.cpp.
References _remove_button_clicked, DDSP_REMOVE_BUSSTOP, VPM_X_AND_Y, and VpStartPlaceSizing().
|
static |
Callback for placing a truck station.
| tile | Position to place the station. |
Definition at line 221 of file road_gui.cpp.
References _remove_button_clicked, DDSP_REMOVE_TRUCKSTOP, VPM_X_AND_Y, and VpStartPlaceSizing().
|
static |
Place a new road stop.
| start_tile | First tile of the area. |
| end_tile | Last tile of the area. |
| p2 | bit 0: 0 For bus stops, 1 for truck stops. bit 2: Allow stations directly adjacent to other stations. bit 5..10: The roadtypes. |
| cmd | Command to use. |
Definition at line 183 of file road_gui.cpp.
|
static |
Updates the Remove button because of Ctrl state change.
| w | window the button belongs to |
Definition at line 254 of file road_gui.cpp.
References Window::IsWidgetDisabled(), Window::IsWidgetLowered(), ToggleRoadButton_Remove(), WID_ROT_AUTOROAD, WID_ROT_REMOVE, and WID_ROT_ROAD_X.
Referenced by BuildRoadToolbarWindow::OnCTRLStateChange().
|
static |
Handler for global hotkeys of the BuildRoadToolbarWindow.
| hotkey | Hotkey |
| last_build | Last build road type |
Definition at line 720 of file road_gui.cpp.
Show the road building toolbar in the scenario editor.
nullptr if the toolbar was already open. Definition at line 954 of file road_gui.cpp.
References DeleteWindowById(), TRANSPORT_ROAD, and WC_SCEN_BUILD_TOOLBAR.
Open the build road toolbar window.
If the terraform toolbar is linked to the toolbar, that window is also opened.
Definition at line 867 of file road_gui.cpp.
References _local_company, DeleteWindowByClass(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), ValParamRoadType(), and WC_BUILD_TOOLBAR.
|
static |
Toggles state of the Remove button of Build road toolbar.
| w | window the button belongs to |
Definition at line 241 of file road_gui.cpp.
References _remove_button_clicked, Window::IsWidgetLowered(), Window::SetWidgetDirty(), Window::ToggleWidgetLoweredState(), and WID_ROT_REMOVE.
Referenced by RoadToolbar_CtrlChanged().
|
static |
Definition at line 1011 of file road_gui.cpp.
|
static |
Definition at line 878 of file road_gui.cpp.
|
static |
Definition at line 915 of file road_gui.cpp.
|
static |
Widget definition of the build tram station window.
Definition at line 1210 of file road_gui.cpp.
|
static |
Definition at line 742 of file road_gui.cpp.
|
static |
Definition at line 759 of file road_gui.cpp.