OpenTTD Source: src/tunnelbridge_cmd.h File Reference

OpenTTD Source 15.3

Functions
tunnelbridge_cmd.h File Reference

Command definitions related to tunnels and bridges. More...

`#include "command_type.h"`
`#include "transport_type.h"`
`#include "bridge.h"`

Go to the source code of this file.

## Functions
CommandCost | CmdBuildBridge (DoCommandFlags flags, TileIndex tile_end, TileIndex tile_start, TransportType transport_type, BridgeType bridge_type, uint8_t road_rail_type)
| Build a Bridge.
CommandCost | CmdBuildTunnel (DoCommandFlags flags, TileIndex start_tile, TransportType transport_type, uint8_t road_rail_type)
| Build Tunnel.
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.

## Detailed Description

Command definitions related to tunnels and bridges.

Definition in file tunnelbridge_cmd.h.

## Function Documentation

## ◆ CcBuildBridge()

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.

Parameters

  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().

## ◆ CmdBuildBridge()

CommandCost CmdBuildBridge | ( | DoCommandFlags | flags,
|  | TileIndex | tile_end,
|  | TileIndex | tile_start,
|  | TransportType | transport_type,
|  | BridgeType | bridge_type,
|  | uint8_t | road_rail_type
| ) |  |

Build a Bridge.

Parameters

  flags | type of operation
  tile_end | end tile
  tile_start | start tile
  transport_type | transport type.
  bridge_type | bridge type (hi bh)
  road_rail_type | rail type or road types.

Returns
  the cost of this operation or an error

Definition at line 310 of file tunnelbridge_cmd.cpp.

References _current_company, _local_company, _settings_game, CommandCost::AddCost(), AddSideToSignalBuffer(), AXIS_X, AXIS_Y, AxisToDiagDir(), AxisToTrack(), ConstructionSettings::build_on_slopes, Town::cache, CalcBridgeLenCostFactor(), CalcClosestTownFromTile(), ChangeTownRating(), CheckBridgeAvailability(), CheckBridgeSlope(), CheckForDockingTile(), ClosestTownFromTile(), CMD_ERROR, CommandCostWithParam(), GameSettings::construction, DirtyCompanyInfrastructureWindows(), DistanceSquare(), Execute, EXPENSES_CONSTRUCTION, CommandCost::Failed(), GetBridgeAxis(), GetBridgeHeight(), GetBridgeSpec(), GetBridgeType(), CommandCost::GetCost(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::GetIfValid(), GetNorthernBridgeEnd(), GetOtherBridgeEnd(), GetRailType(), GetRoadOwner(), GetTileMaxZ(), GetTileOwner(), GetTileSlopeZ(), GetTileZ(), GetTunnelBridgeLength(), GetTunnelBridgeTransportType(), HasTunnelBridgeReservation(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, Company::infrastructure, INVALID_DIAGDIR, INVALID_RAILTYPE, INVALID_ROADTYPE, CompanyProperties::is_ai, IsBridgeAbove(), IsBridgeTile(), IsTileOwner(), IsValidTile(), MakeAqueductBridgeRamp(), MakeRailBridgeRamp(), MakeRoadBridgeRamp(), MarkBridgeDirty(), ConstructionSettings::max_bridge_height, ConstructionSettings::max_bridge_length, OWNER_DEITY, OWNER_NONE, OWNER_TOWN, QueryCost, CompanyInfrastructure::rail, RailBuildCost(), RATING_TUNNEL_BRIDGE_UP_STEP, ReverseDiagDir(), CompanyInfrastructure::road, RoadBuildCost(), RTT_ROAD, RTT_TRAM, SetBridgeMiddle(), SetTunnelBridgeReservation(), SLOPE_FLAT, TownCache::squared_town_zone_radius, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TileDiffXY(), TileOffsByAxis(), TileX(), TileY(), to_underlying(), TRANSPORT_RAIL, TRANSPORT_ROAD, TRANSPORT_WATER, TUNNELBRIDGE_TRACKBIT_FACTOR, TunnelBridgeClearCost(), ValParamRailType(), ValParamRoadType(), CompanyInfrastructure::water, Town::xy, and YapfNotifyTrackLayoutChange().

## ◆ CmdBuildTunnel()

CommandCost CmdBuildTunnel | ( | DoCommandFlags | flags,
|  | TileIndex | start_tile,
|  | TransportType | transport_type,
|  | uint8_t | road_rail_type
| ) |  |

Build Tunnel.

Parameters

  flags | type of operation
  start_tile | start tile of tunnel
  transport_type | transport type
  road_rail_type | railtype or roadtype

Returns
  the cost of this operation or an error

Definition at line 647 of file tunnelbridge_cmd.cpp.

References _build_tunnel_endtile, _cheats, _current_company, _settings_game, CommandCost::AddCost(), AddSideToSignalBuffer(), AXIS_Y, Town::cache, CalcClosestTownFromTile(), CMD_ERROR, ComplementSlope(), GameSettings::construction, Cheats::crossing_tunnels, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, DiagDirToAxis(), DiagDirToDiagTrack(), DirtyCompanyInfrastructureWindows(), DistanceSquare(), Execute, EXPENSES_CONSTRUCTION, CommandCost::Failed(), FindClearedObject(), ClearedObjectArea::first_tile, CommandCost::GetCost(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::GetIfValid(), GetInclinedSlopeDirection(), GetTileSlopeZ(), HasTileWaterGround(), Company::infrastructure, INVALID_DIAGDIR, INVALID_RAILTYPE, INVALID_ROADTYPE, INVALID_TILE, IsTunnelInWayDir(), IsValidTile(), MakeRailTunnel(), MakeRoadTunnel(), ConstructionSettings::max_tunnel_length, Map::MaxX(), OWNER_DEITY, OWNER_NONE, OWNER_TOWN, CompanyInfrastructure::rail, RailBuildCost(), ReverseDiagDir(), CompanyInfrastructure::road, RoadBuildCost(), TownCache::squared_town_zone_radius, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TileOffsByDiagDir(), TileX(), TileY(), to_underlying(), TRANSPORT_RAIL, TRANSPORT_ROAD, TUNNELBRIDGE_TRACKBIT_FACTOR, ValParamRailType(), ValParamRoadType(), Cheat::value, Town::xy, and YapfNotifyTrackLayoutChange().