|
@@ -23,24 +23,25 @@
|
|
|
#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
|
|
|
| | | | | | | */
|
|
@@ -1407,24 +1408,48 @@ static uint32 VehicleEnter_TunnelBridge(
|
|
|
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 */
|