OpenTTD Source 20241224-master-gf74b0cf984
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 (DoCommandFlag flags, TileIndex tile_end, TileIndex tile_start, TransportType transport_type, BridgeType bridge_type, uint8_t road_rail_type)
 Build a Bridge.
 
CommandCost CmdBuildTunnel (DoCommandFlag 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
resultWhether the build succeeded
end_tileEnd tile of the bridge.
tile_startstart tile
transport_typetransport 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 ( DoCommandFlag  flags,
TileIndex  tile_end,
TileIndex  tile_start,
TransportType  transport_type,
BridgeType  bridge_type,
uint8_t  road_rail_type 
)

Build a Bridge.

Parameters
flagstype of operation
tile_endend tile
tile_startstart tile
transport_typetransport type.
bridge_typebridge type (hi bh)
road_rail_typerail type or road types.
Returns
the cost of this operation or an error

Definition at line 261 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, GameSettings::construction, DC_EXEC, DC_QUERY_COST, DiagDirToAxis(), DirtyCompanyInfrastructureWindows(), DistanceSquare(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), ObjectSpec::flags, GetBridgeAxis(), GetBridgeHeight(), GetBridgeSpec(), GetBridgeType(), ObjectSpec::GetByTile(), CommandCost::GetCost(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), GetNorthernBridgeEnd(), GetOtherBridgeEnd(), GetRailType(), GetRoadOwner(), GetTileMaxZ(), GetTileOwner(), GetTileSlopeZ(), GetTileType(), GetTileZ(), GetTunnelBridgeDirection(), GetTunnelBridgeLength(), GetTunnelBridgeTransportType(), HasTunnelBridgeReservation(), ObjectSpec::height, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Company::infrastructure, INVALID_DIAGDIR, INVALID_RAILTYPE, INVALID_ROADTYPE, CompanyProperties::is_ai, IsBridgeAbove(), IsBridgeTile(), IsCoast(), IsPlainRail(), IsRoadDepot(), IsTileOwner(), IsTunnel(), IsValidTile(), IsWater(), MakeAqueductBridgeRamp(), MakeRailBridgeRamp(), MakeRoadBridgeRamp(), MarkBridgeDirty(), ConstructionSettings::max_bridge_height, ConstructionSettings::max_bridge_length, MP_CLEAR, MP_OBJECT, MP_RAILWAY, MP_ROAD, MP_TUNNELBRIDGE, MP_WATER, OBJECT_FLAG_ALLOW_UNDER_BRIDGE, OWNER_DEITY, OWNER_NONE, OWNER_TOWN, CompanyInfrastructure::rail, RailBuildCost(), RATING_TUNNEL_BRIDGE_UP_STEP, ReverseDiagDir(), CompanyInfrastructure::road, RoadBuildCost(), SetBridgeMiddle(), SetDParam(), SetTunnelBridgeReservation(), SLOPE_FLAT, TownCache::squared_town_zone_radius, Swap(), TileOffsByAxis(), TileX(), TileY(), TRANSPORT_RAIL, TRANSPORT_ROAD, TRANSPORT_WATER, TUNNELBRIDGE_TRACKBIT_FACTOR, TunnelBridgeClearCost(), ValParamRailType(), ValParamRoadType(), CompanyInfrastructure::water, Town::xy, and YapfNotifyTrackLayoutChange().

◆ CmdBuildTunnel()

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

Build Tunnel.

Parameters
flagstype of operation
start_tilestart tile of tunnel
transport_typetransport type
road_rail_typerailtype or roadtype
Returns
the cost of this operation or an error

Definition at line 624 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, DC_EXEC, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, DiagDirToAxis(), DiagDirToDiagTrack(), DirtyCompanyInfrastructureWindows(), DistanceSquare(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), FindClearedObject(), ClearedObjectArea::first_tile, CommandCost::GetCost(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::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, TileOffsByDiagDir(), TileX(), TileY(), TRANSPORT_RAIL, TRANSPORT_ROAD, TUNNELBRIDGE_TRACKBIT_FACTOR, ValParamRailType(), ValParamRoadType(), Cheat::value, Town::xy, and YapfNotifyTrackLayoutChange().