|
@@ -11,48 +11,49 @@
|
|
|
#include "rail_map.h"
|
|
|
#include "road_map.h"
|
|
|
#include "table/sprites.h"
|
|
|
#include "table/strings.h"
|
|
|
#include "strings.h"
|
|
|
#include "functions.h"
|
|
|
#include "map.h"
|
|
|
#include "landscape.h"
|
|
|
#include "tile.h"
|
|
|
#include "tunnel_map.h"
|
|
|
#include "unmovable_map.h"
|
|
|
#include "vehicle.h"
|
|
|
#include "viewport.h"
|
|
|
#include "command.h"
|
|
|
#include "player.h"
|
|
|
#include "town.h"
|
|
|
#include "sound.h"
|
|
|
#include "variables.h"
|
|
|
#include "bridge.h"
|
|
|
#include "train.h"
|
|
|
#include "water_map.h"
|
|
|
#include "yapf/yapf.h"
|
|
|
#include "date.h"
|
|
|
#include "newgrf_sound.h"
|
|
|
#include "autoslope.h"
|
|
|
|
|
|
#include "table/bridge_land.h"
|
|
|
|
|
|
const Bridge orig_bridge[] = {
|
|
|
/*
|
|
|
year of availablity
|
|
|
| minimum length
|
|
|
| | maximum length
|
|
|
| | | price
|
|
|
| | | | maximum speed
|
|
|
| | | | | sprite to use in GUI string with description
|
|
|
| | | | | | | */
|
|
|
{ 0, 0, 16, 80, 32, 0xA24, PAL_NONE , STR_5012_WOODEN , NULL, 0 },
|
|
|
{ 0, 0, 2, 112, 48, 0xA26, PALETTE_TO_STRUCT_RED , STR_5013_CONCRETE , NULL, 0 },
|
|
|
{ 1930, 0, 5, 144, 64, 0xA25, PAL_NONE , STR_500F_GIRDER_STEEL , NULL, 0 },
|
|
|
{ 0, 2, 10, 168, 80, 0xA22, PALETTE_TO_STRUCT_CONCRETE, STR_5011_SUSPENSION_CONCRETE, NULL, 0 },
|
|
|
{ 1930, 3, 16, 185, 96, 0xA22, PAL_NONE , STR_500E_SUSPENSION_STEEL , NULL, 0 },
|
|
|
{ 1930, 3, 16, 192, 112, 0xA22, PALETTE_TO_STRUCT_YELLOW , STR_500E_SUSPENSION_STEEL , NULL, 0 },
|
|
|
{ 1930, 3, 7, 224, 160, 0xA23, PAL_NONE , STR_5010_CANTILEVER_STEEL , NULL, 0 },
|
|
|
{ 1930, 3, 8, 232, 208, 0xA23, PALETTE_TO_STRUCT_BROWN , STR_5010_CANTILEVER_STEEL , NULL, 0 },
|
|
|
{ 1930, 3, 9, 248, 240, 0xA23, PALETTE_TO_STRUCT_RED , STR_5010_CANTILEVER_STEEL , NULL, 0 },
|
|
|
{ 1930, 0, 2, 240, 256, 0xA27, PAL_NONE , STR_500F_GIRDER_STEEL , NULL, 0 },
|
|
|
{ 1995, 2, 16, 255, 320, 0xA28, PAL_NONE , STR_5014_TUBULAR_STEEL , NULL, 0 },
|
|
|
{ 2005, 2, 32, 380, 512, 0xA28, PALETTE_TO_STRUCT_YELLOW , STR_5014_TUBULAR_STEEL , NULL, 0 },
|
|
@@ -1395,43 +1396,67 @@ static uint32 VehicleEnter_TunnelBridge(
|
|
|
}
|
|
|
return VETSB_ENTERED_WORMHOLE;
|
|
|
} else if (DirToDiagDir(v->direction) == ReverseDiagDir(dir)) {
|
|
|
v->tile = tile;
|
|
|
if (v->type == VEH_TRAIN) {
|
|
|
if (v->u.rail.track == TRACK_BIT_WORMHOLE) {
|
|
|
v->u.rail.track = (DiagDirToAxis(dir) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y);
|
|
|
return VETSB_ENTERED_WORMHOLE;
|
|
|
}
|
|
|
} else {
|
|
|
if (v->u.road.state == RVSB_WORMHOLE) {
|
|
|
v->u.road.state = _road_exit_tunnel_state[dir];
|
|
|
v->u.road.frame = 0;
|
|
|
return VETSB_ENTERED_WORMHOLE;
|
|
|
}
|
|
|
}
|
|
|
return VETSB_CONTINUE;
|
|
|
}
|
|
|
}
|
|
|
return VETSB_CONTINUE;
|
|
|
}
|
|
|
|
|
|
static CommandCost TerraformTile_TunnelBridge(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
|
|
|
{
|
|
|
if (_patches.build_on_slopes && AutoslopeEnabled() && IsBridge(tile)) {
|
|
|
DiagDirection direction = GetBridgeRampDirection(tile);
|
|
|
Axis axis = DiagDirToAxis(direction);
|
|
|
CommandCost res;
|
|
|
|
|
|
/* Check if new slope is valid for bridges in general (so we can savely call GetBridgeFoundation()) */
|
|
|
if ((direction == DIAGDIR_NW) || (direction == DIAGDIR_NE)) {
|
|
|
res = CheckBridgeSlopeSouth(axis, tileh_new);
|
|
|
} else {
|
|
|
res = CheckBridgeSlopeNorth(axis, tileh_new);
|
|
|
}
|
|
|
|
|
|
if (!CmdFailed(res)) {
|
|
|
uint z_old;
|
|
|
Slope tileh_old = GetTileSlope(tile, &z_old);
|
|
|
|
|
|
z_old += ApplyFoundationToSlope(GetBridgeFoundation(tileh_old, axis), &tileh_old);
|
|
|
z_new += ApplyFoundationToSlope(GetBridgeFoundation(tileh_new, axis), &tileh_new);
|
|
|
|
|
|
/* Surface slope remains unchanged? */
|
|
|
if ((z_old == z_new) && (tileh_old == tileh_new)) return _price.terraform;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
|
|
}
|
|
|
|
|
|
extern const TileTypeProcs _tile_type_tunnelbridge_procs = {
|
|
|
DrawTile_TunnelBridge, /* draw_tile_proc */
|
|
|
GetSlopeZ_TunnelBridge, /* get_slope_z_proc */
|
|
|
ClearTile_TunnelBridge, /* clear_tile_proc */
|
|
|
GetAcceptedCargo_TunnelBridge, /* get_accepted_cargo_proc */
|
|
|
GetTileDesc_TunnelBridge, /* get_tile_desc_proc */
|
|
|
GetTileTrackStatus_TunnelBridge, /* get_tile_track_status_proc */
|
|
|
ClickTile_TunnelBridge, /* click_tile_proc */
|
|
|
AnimateTile_TunnelBridge, /* animate_tile_proc */
|
|
|
TileLoop_TunnelBridge, /* tile_loop_clear */
|
|
|
ChangeTileOwner_TunnelBridge, /* change_tile_owner_clear */
|
|
|
NULL, /* get_produced_cargo_proc */
|
|
|
VehicleEnter_TunnelBridge, /* vehicle_enter_tile_proc */
|
|
|
GetFoundation_TunnelBridge, /* get_foundation_proc */
|
|
|
TerraformTile_TunnelBridge, /* terraform_tile_proc */
|
|
|
};
|