This file deals with tunnels and bridges (non-gui stuff). More...
#include "stdafx.h"
#include "newgrf_object.h"
#include "viewport_func.h"
#include "cmd_helper.h"
#include "command_func.h"
#include "town.h"
#include "train.h"
#include "ship.h"
#include "roadveh.h"
#include "water_map.h"
#include "pathfinder/yapf/yapf_cache.h"
#include "newgrf_sound.h"
#include "autoslope.h"
#include "tunnelbridge_map.h"
#include "strings_func.h"
#include "date_func.h"
#include "functions.h"
#include "vehicle_func.h"
#include "sound_func.h"
#include "tunnelbridge.h"
#include "cheat_type.h"
#include "elrail_func.h"
#include "pbs.h"
#include "company_base.h"
#include "newgrf_railtype.h"
#include "object_base.h"
#include "water.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "table/bridge_land.h"
Go to the source code of this file.
Functions | |
void | ResetBridges () |
Reset the data been eventually changed by the grf loaded. | |
int | CalcBridgeLenCostFactor (int length) |
Calculate the price factor for building a long bridge. | |
Foundation | GetBridgeFoundation (Slope tileh, Axis axis) |
bool | HasBridgeFlatRamp (Slope tileh, Axis axis) |
Determines if the track on a bridge ramp is flat or goes up/down. | |
static const PalSpriteID * | GetBridgeSpriteTable (int index, BridgePieces table) |
static CommandCost | CheckBridgeSlopeNorth (Axis axis, Slope *tileh, uint *z) |
Determines the foundation for the north bridge head, and tests if the resulting slope is valid. | |
static CommandCost | CheckBridgeSlopeSouth (Axis axis, Slope *tileh, uint *z) |
Determines the foundation for the south bridge head, and tests if the resulting slope is valid. | |
CommandCost | CheckBridgeAvailability (BridgeType bridge_type, uint bridge_len, DoCommandFlag flags) |
Is a bridge of the specified type and length available? | |
CommandCost | CmdBuildBridge (TileIndex end_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Build a Bridge. | |
CommandCost | CmdBuildTunnel (TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Build Tunnel. | |
static CommandCost | CheckAllowRemoveTunnelBridge (TileIndex tile) |
Are we allowed to remove the tunnel or bridge at tile? | |
static CommandCost | DoClearTunnel (TileIndex tile, DoCommandFlag flags) |
Remove a tunnel from the game, update town rating, etc. | |
static CommandCost | DoClearBridge (TileIndex tile, DoCommandFlag flags) |
Remove a bridge from the game, update town rating, etc. | |
static CommandCost | ClearTile_TunnelBridge (TileIndex tile, DoCommandFlag flags) |
Remove a tunnel or a bridge from the game. | |
static void | DrawPillar (const PalSpriteID *psid, int x, int y, int z, int w, int h, const SubSprite *subsprite) |
Draw a single pillar sprite. | |
static int | DrawPillarColumn (int z_bottom, int z_top, const PalSpriteID *psid, int x, int y, int w, int h) |
Draw two bridge pillars (north and south). | |
static void | DrawBridgePillars (const PalSpriteID *psid, const TileInfo *ti, Axis axis, bool drawfarpillar, int x, int y, int z_bridge) |
Draws the pillars under high bridges. | |
static void | DrawBridgeTramBits (int x, int y, byte z, int offset, bool overlay, bool head) |
Draws the trambits over an already drawn (lower end) of a bridge. | |
static void | DrawTile_TunnelBridge (TileInfo *ti) |
Draws a tunnel of bridge tile. | |
static BridgePieces | CalcBridgePiece (uint north, uint south) |
Compute bridge piece. | |
void | DrawBridgeMiddle (const TileInfo *ti) |
static uint | GetSlopeZ_TunnelBridge (TileIndex tile, uint x, uint y) |
static Foundation | GetFoundation_TunnelBridge (TileIndex tile, Slope tileh) |
static void | GetTileDesc_TunnelBridge (TileIndex tile, TileDesc *td) |
static void | TileLoop_TunnelBridge (TileIndex tile) |
static TrackStatus | GetTileTrackStatus_TunnelBridge (TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) |
static void | ChangeTileOwner_TunnelBridge (TileIndex tile, Owner old_owner, Owner new_owner) |
static VehicleEnterTileStatus | VehicleEnter_TunnelBridge (Vehicle *v, TileIndex tile, int x, int y) |
static CommandCost | TerraformTile_TunnelBridge (TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) |
Variables | |
BridgeSpec | _bridge [MAX_BRIDGES] |
TileIndex | _build_tunnel_endtile |
static const int | BRIDGE_Z_START = 3 |
static const byte | TUNNEL_SOUND_FRAME = 1 |
Frame when the 'enter tunnel' sound should be played. | |
const byte | _tunnel_visibility_frame [DIAGDIR_END] = {12, 8, 8, 12} |
Frame when a vehicle should be hidden in a tunnel with a certain direction. | |
const TileTypeProcs | _tile_type_tunnelbridge_procs |
This file deals with tunnels and bridges (non-gui stuff).
Definition in file tunnelbridge_cmd.cpp.
int CalcBridgeLenCostFactor | ( | int | length | ) |
Calculate the price factor for building a long bridge.
Basically the cost delta is 1,1, 1, 2,2, 3,3,3, 4,4,4,4, 5,5,5,5,5, 6,6,6,6,6,6, 7,7,7,7,7,7,7, 8,8,8,8,8,8,8,8,
length | Length of the bridge. |
Definition at line 77 of file tunnelbridge_cmd.cpp.
Referenced by CmdBuildBridge(), AIBridge::GetPrice(), and ShowBuildBridgeWindow().
static BridgePieces CalcBridgePiece | ( | uint | north, | |
uint | south | |||
) | [static] |
Compute bridge piece.
Computes the bridge piece to display depending on the position inside the bridge. bridges pieces sequence (middle parts). Note that it is not covering the bridge heads, which are always referenced by the same sprite table. bridge len 1: BRIDGE_PIECE_NORTH bridge len 2: BRIDGE_PIECE_NORTH BRIDGE_PIECE_SOUTH bridge len 3: BRIDGE_PIECE_NORTH BRIDGE_PIECE_MIDDLE_ODD BRIDGE_PIECE_SOUTH bridge len 4: BRIDGE_PIECE_NORTH BRIDGE_PIECE_INNER_NORTH BRIDGE_PIECE_INNER_SOUTH BRIDGE_PIECE_SOUTH bridge len 5: BRIDGE_PIECE_NORTH BRIDGE_PIECE_INNER_NORTH BRIDGE_PIECE_MIDDLE_EVEN BRIDGE_PIECE_INNER_SOUTH BRIDGE_PIECE_SOUTH bridge len 6: BRIDGE_PIECE_NORTH BRIDGE_PIECE_INNER_NORTH BRIDGE_PIECE_INNER_SOUTH BRIDGE_PIECE_INNER_NORTH BRIDGE_PIECE_INNER_SOUTH BRIDGE_PIECE_SOUTH bridge len 7: BRIDGE_PIECE_NORTH BRIDGE_PIECE_INNER_NORTH BRIDGE_PIECE_INNER_SOUTH BRIDGE_PIECE_MIDDLE_ODD BRIDGE_PIECE_INNER_NORTH BRIDGE_PIECE_INNER_SOUTH BRIDGE_PIECE_SOUTH #0 - always as first, #1 - always as last (if len>1) #2,#3 are to pair in order for odd bridges: #5 is going in the bridge middle if on even position, #4 on odd (counting from 0)
north | Northernmost tile of bridge | |
south | Southernmost tile of bridge |
Definition at line 1195 of file tunnelbridge_cmd.cpp.
static CommandCost CheckAllowRemoveTunnelBridge | ( | TileIndex | tile | ) | [inline, static] |
Are we allowed to remove the tunnel or bridge at tile?
tile | End point of the tunnel or bridge. |
Definition at line 642 of file tunnelbridge_cmd.cpp.
References _current_company, _settings_game, CheckOwnership(), CheckTileOwnership(), GameSettings::construction, ConstructionSettings::extra_dynamite, GetRoadOwner(), GetRoadTypes(), GetTileOwner(), GetTunnelBridgeTransportType(), HasBit(), Cheats::magic_bulldozer, OWNER_NONE, OWNER_TOWN, OWNER_WATER, ROADTYPE_ROAD, ROADTYPE_TRAM, CommandCost::Succeeded(), TRANSPORT_RAIL, TRANSPORT_ROAD, TRANSPORT_WATER, and Cheat::value.
Referenced by DoClearBridge(), and DoClearTunnel().
CommandCost CheckBridgeAvailability | ( | BridgeType | bridge_type, | |
uint | bridge_len, | |||
DoCommandFlag | flags | |||
) |
Is a bridge of the specified type and length available?
bridge_type | Wanted type of bridge. | |
bridge_len | Wanted length of the bridge. |
Definition at line 175 of file tunnelbridge_cmd.cpp.
References _cur_year, _settings_game, BridgeSpec::avail_year, CMD_ERROR, GameSettings::construction, DC_QUERY_COST, ConstructionSettings::longbridges, max(), MAX_BRIDGE_LENGTH, MAX_BRIDGE_LENGTH_LONGBRIDGES, MAX_BRIDGES, BridgeSpec::max_length, BridgeSpec::min_length, and return_cmd_error.
Referenced by CmdBuildBridge(), and ShowBuildBridgeWindow().
static CommandCost CheckBridgeSlopeNorth | ( | Axis | axis, | |
Slope * | tileh, | |||
uint * | z | |||
) | [static] |
Determines the foundation for the north bridge head, and tests if the resulting slope is valid.
axis | Axis of the bridge | |
tileh | Slope of the tile under the north bridge head; returns slope on top of foundation | |
z | TileZ corresponding to tileh, gets modified as well |
Definition at line 135 of file tunnelbridge_cmd.cpp.
References ApplyFoundationToSlope(), AXIS_X, CMD_ERROR, EXPENSES_CONSTRUCTION, FOUNDATION_NONE, SLOPE_FLAT, SLOPE_NE, and SLOPE_NW.
Referenced by CmdBuildBridge().
static CommandCost CheckBridgeSlopeSouth | ( | Axis | axis, | |
Slope * | tileh, | |||
uint * | z | |||
) | [static] |
Determines the foundation for the south bridge head, and tests if the resulting slope is valid.
axis | Axis of the bridge | |
tileh | Slope of the tile under the south bridge head; returns slope on top of foundation | |
z | TileZ corresponding to tileh, gets modified as well |
Definition at line 156 of file tunnelbridge_cmd.cpp.
References ApplyFoundationToSlope(), AXIS_X, CMD_ERROR, EXPENSES_CONSTRUCTION, FOUNDATION_NONE, SLOPE_FLAT, SLOPE_SE, and SLOPE_SW.
Referenced by CmdBuildBridge().
static CommandCost ClearTile_TunnelBridge | ( | TileIndex | tile, | |
DoCommandFlag | flags | |||
) | [static] |
Remove a tunnel or a bridge from the game.
Definition at line 826 of file tunnelbridge_cmd.cpp.
References DC_AUTO, DoClearBridge(), DoClearTunnel(), IsTunnel(), and return_cmd_error.
CommandCost CmdBuildBridge | ( | TileIndex | end_tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Build a Bridge.
end_tile | end tile | |
flags | type of operation | |
p1 | packed start tile coords (~ dx) | |
p2 | various bitstuffed elements
| |
text | unused |
Definition at line 207 of file tunnelbridge_cmd.cpp.
References _current_company, _settings_game, CommandCost::AddCost(), AddSideToSignalBuffer(), AXIS_X, AXIS_Y, AxisToDiagDir(), AxisToTrack(), ConstructionSettings::build_on_slopes, CalcBridgeLenCostFactor(), CheckBridgeAvailability(), CheckBridgeSlopeNorth(), CheckBridgeSlopeSouth(), ClosestTownFromTile(), CMD_ERROR, CMD_LANDSCAPE_CLEAR, GameSettings::construction, DC_EXEC, DC_QUERY_COST, DiagDirToAxis(), DoCommand(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), ObjectSpec::flags, GB(), GetBridgeAxis(), GetBridgeHeight(), GetBridgeType(), ObjectSpec::GetByTile(), CommandCost::GetCost(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), GetNorthernBridgeEnd(), GetOtherBridgeEnd(), GetRailType(), GetRoadTypes(), GetTileMaxZ(), GetTileOwner(), GetTileSlope(), GetTileType(), GetTunnelBridgeDirection(), GetTunnelBridgeLength(), GetTunnelBridgeTransportType(), HasExactlyOneBit(), HasRoadTypesAvail(), HasTunnelBridgeReservation(), ObjectSpec::height, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_DIAGDIR, INVALID_RAILTYPE, CompanyProperties::is_ai, IsBridgeAbove(), IsBridgeTile(), IsCoast(), IsPlainRail(), IsRoadDepot(), IsTileOwner(), IsTunnel(), IsValidTile(), IsWater(), ConstructionSettings::longbridges, MakeAqueductBridgeRamp(), MakeRailBridgeRamp(), MakeRoadBridgeRamp(), MarkTileDirtyByTile(), MAX_BRIDGE_LENGTH, MAX_BRIDGE_LENGTH_LONGBRIDGES, MayHaveBridgeAbove(), MP_CLEAR, MP_OBJECT, MP_RAILWAY, MP_ROAD, MP_TUNNELBRIDGE, MP_WATER, OBJECT_FLAG_ALLOW_UNDER_BRIDGE, OWNER_TOWN, RailBuildCost(), return_cmd_error, ReverseDiagDir(), ROADTYPES_NONE, SetBridgeMiddle(), SetDParam(), SetTunnelBridgeReservation(), SLOPE_FLAT, Swap(), TILE_HEIGHT, TileDiffXY(), TileX(), TileY(), TRANSPORT_RAIL, TRANSPORT_ROAD, TRANSPORT_WATER, ValParamRailtype(), and YapfNotifyTrackLayoutChange().
CommandCost CmdBuildTunnel | ( | TileIndex | start_tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Build Tunnel.
start_tile | start tile of tunnel | |
flags | type of operation | |
p1 | bit 0-3 railtype or roadtypes bit 8-9 transport type | |
p2 | unused | |
text | unused |
Definition at line 502 of file tunnelbridge_cmd.cpp.
References _current_company, CommandCost::AddCost(), AddSideToSignalBuffer(), ClearedObjectArea::area, AXIS_Y, CMD_ERROR, CMD_LANDSCAPE_CLEAR, CMD_TERRAFORM_LAND, ComplementSlope(), Cheats::crossing_tunnels, DC_EXEC, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, DiagDirToAxis(), DiagDirToDiagTrack(), DoCommand(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), FindClearedObject(), ClearedObjectArea::first_tile, CommandCost::GetCost(), GetInclinedSlopeDirection(), GetTileSlope(), HasExactlyOneBit(), HasRoadTypesAvail(), HasTileWaterGround(), INVALID_DIAGDIR, INVALID_RAILTYPE, INVALID_TILE, IsTunnelInWayDir(), IsValidTile(), MakeRailTunnel(), MakeRoadTunnel(), MapMaxX(), RailBuildCost(), return_cmd_error, ReverseDiagDir(), ROADTYPES_NONE, TileOffsByDiagDir(), TileX(), TileY(), TRANSPORT_RAIL, TRANSPORT_ROAD, ValParamRailtype(), Cheat::value, and YapfNotifyTrackLayoutChange().
static CommandCost DoClearBridge | ( | TileIndex | tile, | |
DoCommandFlag | flags | |||
) | [static] |
Remove a bridge from the game, update town rating, etc.
Definition at line 749 of file tunnelbridge_cmd.cpp.
References AddSideToSignalBuffer(), ChangeTownRating(), CheckAllowRemoveTunnelBridge(), CheckforTownRating(), ClearBridgeMiddle(), ClosestTownFromTile(), DC_EXEC, DiagDirToDiagTrack(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), FreeTrainTrackReservation(), GetBridgeHeight(), GetOtherBridgeEnd(), GetRoadside(), GetTileMaxZ(), GetTileOwner(), GetTrainForReservation(), GetTunnelBridgeDirection(), GetTunnelBridgeLength(), GetTunnelBridgeTransportType(), HasTunnelBridgeReservation(), IsNormalRoadTile(), IsTileOwner(), MarkTileDirtyByTile(), OWNER_TOWN, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM, ReverseDiagDir(), ROADSIDE_PAVED, ROADSIDE_TREES, SetRoadside(), TILE_HEIGHT, TileOffsByDiagDir(), TRANSPORT_RAIL, TRANSPORT_WATER, TryPathReserve(), TUNNELBRIDGE_REMOVE, TunnelBridgeIsFree(), and YapfNotifyTrackLayoutChange().
Referenced by ClearTile_TunnelBridge().
static CommandCost DoClearTunnel | ( | TileIndex | tile, | |
DoCommandFlag | flags | |||
) | [static] |
Remove a tunnel from the game, update town rating, etc.
Definition at line 682 of file tunnelbridge_cmd.cpp.
References AddSideToSignalBuffer(), ChangeTownRating(), CheckAllowRemoveTunnelBridge(), CheckforTownRating(), ClosestTownFromTile(), DC_EXEC, DiagDirToDiagTrack(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), FreeTrainTrackReservation(), GetOtherTunnelEnd(), GetTileOwner(), GetTrainForReservation(), GetTunnelBridgeDirection(), GetTunnelBridgeLength(), GetTunnelBridgeTransportType(), HasTunnelBridgeReservation(), IsTileOwner(), OWNER_TOWN, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM, ReverseDiagDir(), TRANSPORT_RAIL, TryPathReserve(), TUNNELBRIDGE_REMOVE, TunnelBridgeIsFree(), and YapfNotifyTrackLayoutChange().
Referenced by ClearTile_TunnelBridge().
static void DrawBridgePillars | ( | const PalSpriteID * | psid, | |
const TileInfo * | ti, | |||
Axis | axis, | |||
bool | drawfarpillar, | |||
int | x, | |||
int | y, | |||
int | z_bridge | |||
) | [static] |
Draws the pillars under high bridges.
psid | Image and palette of a bridge pillar. | |
ti | TileInfo of current bridge-middle-tile. | |
axis | Orientation of bridge. | |
drawfarpillar | Whether to draw the pillar at the back | |
x | Sprite X position of front pillar. | |
y | Sprite Y position of front pillar. | |
z_bridge | Absolute height of bridge bottom. |
< bounding box size of pillars along bridge direction
< sprite position offset of back facing pillar
< big number compared to sprite size
Definition at line 884 of file tunnelbridge_cmd.cpp.
References AxisToDiagDir(), DrawPillar(), DrawPillarColumn(), GetSlopeZOnEdge(), max(), OtherAxis(), ReverseDiagDir(), PalSpriteID::sprite, TILE_HEIGHT, TileInfo::tileh, and TileInfo::z.
static void DrawBridgeTramBits | ( | int | x, | |
int | y, | |||
byte | z, | |||
int | offset, | |||
bool | overlay, | |||
bool | head | |||
) | [static] |
Draws the trambits over an already drawn (lower end) of a bridge.
x | the x of the bridge | |
y | the y of the bridge | |
z | the z of the bridge | |
offset | number representing whether to level or sloped and the direction | |
overlay | do we want to still see the road? | |
head | are we drawing bridge head? |
Definition at line 940 of file tunnelbridge_cmd.cpp.
References AddSortableSpriteToDraw(), EndSpriteCombine(), IsInvisibilitySet(), IsTransparencySet(), StartSpriteCombine(), TO_BRIDGES, and TO_CATENARY.
Referenced by DrawTile_TunnelBridge().
static void DrawPillar | ( | const PalSpriteID * | psid, | |
int | x, | |||
int | y, | |||
int | z, | |||
int | w, | |||
int | h, | |||
const SubSprite * | subsprite | |||
) | [inline, static] |
Draw a single pillar sprite.
psid | Pillarsprite | |
x | Pillar X | |
y | Pillar Y | |
z | Pillar Z | |
w | Bounding box size in X direction | |
h | Bounding box size in Y direction | |
subsprite | Optional subsprite for drawing halfpillars |
< Start offset of pillar wrt. bridge (downwards)
Definition at line 847 of file tunnelbridge_cmd.cpp.
References AddSortableSpriteToDraw(), BB_HEIGHT_UNDER_BRIDGE, IsTransparencySet(), PalSpriteID::pal, PalSpriteID::sprite, TILE_HEIGHT, and TO_BRIDGES.
Referenced by DrawBridgePillars(), and DrawPillarColumn().
static int DrawPillarColumn | ( | int | z_bottom, | |
int | z_top, | |||
const PalSpriteID * | psid, | |||
int | x, | |||
int | y, | |||
int | w, | |||
int | h | |||
) | [static] |
Draw two bridge pillars (north and south).
z_bottom | Bottom Z | |
z_top | Top Z | |
psid | Pillarsprite | |
x | Pillar X | |
y | Pillar Y | |
w | Bounding box size in X direction | |
h | Bounding box size in Y direction |
Definition at line 864 of file tunnelbridge_cmd.cpp.
References DrawPillar(), and TILE_HEIGHT.
Referenced by DrawBridgePillars().
static void DrawTile_TunnelBridge | ( | TileInfo * | ti | ) | [static] |
Draws a tunnel of bridge tile.
For tunnels, this is rather simple, as you only needa draw the entrance. Bridges are a bit more complex. base_offset is where the sprite selection comes into play and it works a bit like a bitmask.
For bridge heads:
ti | TileInfo of the structure to draw
Please note that in this code, "roads" are treated as railtype 1, whilst the real railtypes are 0, 2 and 3 |
Definition at line 991 of file tunnelbridge_cmd.cpp.
References _settings_client, AddSortableSpriteToDraw(), AXIS_X, RailtypeInfo::base_sprites, BB_Z_SEPARATOR, RailtypeInfo::bridge_offset, DiagDirToAxis(), DrawBridgeTramBits(), DrawCatenary(), DrawCatenaryOnTunnel(), DrawFoundation(), DrawGroundSprite(), EndSpriteCombine(), GetBridgeType(), GetRailType(), GetRailTypeInfo(), GetRoadTypes(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), GetWaterClass(), ClientSettings::gui, HasBit(), HasBridgeFlatRamp(), HasCatenaryDrawn(), HasTileWaterClass(), HasTunnelBridgeReservation(), HasTunnelBridgeSnowOrDesert(), IsInvisibilitySet(), IsTransparencySet(), IsTunnel(), PalSpriteID::pal, ROADTYPE_ROAD, ROADTYPE_TRAM, ROADTYPES_TRAM, RTBO_SLOPE, RTBO_X, RTBO_Y, RTSG_BRIDGE, RTSG_TUNNEL, GUISettings::show_track_reservation, RailtypeInfo::single_sloped, RailtypeInfo::single_x, RailtypeInfo::single_y, SLOPE_FLAT, SlopeToSpriteOffset(), PalSpriteID::sprite, StartSpriteCombine(), TileInfo::tile, TILE_HEIGHT, TILE_SIZE, TileInfo::tileh, TileOffsByDiagDir(), TO_CATENARY, TRANSPORT_RAIL, TRANSPORT_ROAD, TRANSPORT_WATER, RailtypeInfo::tunnel, WATER_CLASS_SEA, TileInfo::x, TileInfo::y, and TileInfo::z.
Determines if the track on a bridge ramp is flat or goes up/down.
tileh | Slope of the tile under the bridge head | |
axis | Orientation of bridge |
Definition at line 108 of file tunnelbridge_cmd.cpp.
References ApplyFoundationToSlope(), and SLOPE_FLAT.
Referenced by DrawTile_TunnelBridge().
void ResetBridges | ( | ) |
Reset the data been eventually changed by the grf loaded.
Definition at line 55 of file tunnelbridge_cmd.cpp.
References MAX_BRIDGES.
Referenced by ResetNewGRFData().
const TileTypeProcs _tile_type_tunnelbridge_procs |
{ DrawTile_TunnelBridge, GetSlopeZ_TunnelBridge, ClearTile_TunnelBridge, NULL, GetTileDesc_TunnelBridge, GetTileTrackStatus_TunnelBridge, NULL, NULL, TileLoop_TunnelBridge, ChangeTileOwner_TunnelBridge, NULL, VehicleEnter_TunnelBridge, GetFoundation_TunnelBridge, TerraformTile_TunnelBridge, }
const byte _tunnel_visibility_frame[DIAGDIR_END] = {12, 8, 8, 12} |
Frame when a vehicle should be hidden in a tunnel with a certain direction.
This differs per direction, because of visibility / bounding box issues. Note that direction, in this case, is the direction leading into the tunnel. When entering a tunnel, hide the vehicle when it reaches the given frame. When leaving a tunnel, show the vehicle when it is one frame further to the 'outside', i.e. at (TILE_SIZE-1) - (frame) + 1
const byte TUNNEL_SOUND_FRAME = 1 [static] |
Frame when the 'enter tunnel' sound should be played.
This is the second frame on a tile, so the sound is played shortly after entering the tunnel tile, while the vehicle is still visible.
Definition at line 1504 of file tunnelbridge_cmd.cpp.