|
@@ -29,12 +29,13 @@
|
|
|
#include "strings_func.h"
|
|
|
#include "date_func.h"
|
|
|
#include "functions.h"
|
|
|
#include "vehicle_func.h"
|
|
|
#include "sound_func.h"
|
|
|
#include "signal_func.h"
|
|
|
#include "tunnelbridge.h"
|
|
|
|
|
|
#include "table/sprites.h"
|
|
|
#include "table/strings.h"
|
|
|
#include "table/bridge_land.h"
|
|
|
|
|
|
const Bridge orig_bridge[] = {
|
|
@@ -157,23 +158,12 @@ static CommandCost CheckBridgeSlopeSouth
|
|
|
|
|
|
if (f == FOUNDATION_NONE) return CommandCost();
|
|
|
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
|
|
|
}
|
|
|
|
|
|
|
|
|
uint32 GetBridgeLength(TileIndex begin, TileIndex end)
|
|
|
{
|
|
|
int x1 = TileX(begin);
|
|
|
int y1 = TileY(begin);
|
|
|
int x2 = TileX(end);
|
|
|
int y2 = TileY(end);
|
|
|
|
|
|
return abs(x2 + y2 - x1 - y1) - 1;
|
|
|
}
|
|
|
|
|
|
bool CheckBridge_Stuff(byte bridge_type, uint bridge_len)
|
|
|
{
|
|
|
const Bridge *b = &_bridge[bridge_type];
|
|
|
uint max; // max possible length of a bridge (with patch 100)
|
|
|
|
|
|
if (bridge_type >= MAX_BRIDGES) return false;
|
|
@@ -630,13 +620,13 @@ static CommandCost DoClearTunnel(TileInd
|
|
|
YapfNotifyTrackLayoutChange(endtile, track);
|
|
|
} else {
|
|
|
DoClearSquare(tile);
|
|
|
DoClearSquare(endtile);
|
|
|
}
|
|
|
}
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, _price.clear_tunnel * (DistanceManhattan(tile, endtile) + 1));
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, _price.clear_tunnel * (GetTunnelBridgeLength(tile, endtile) + 2));
|
|
|
}
|
|
|
|
|
|
|
|
|
static CommandCost DoClearBridge(TileIndex tile, uint32 flags)
|
|
|
{
|
|
|
DiagDirection direction;
|
|
@@ -690,13 +680,13 @@ static CommandCost DoClearBridge(TileInd
|
|
|
Track track = AxisToTrack(DiagDirToAxis(direction));
|
|
|
YapfNotifyTrackLayoutChange(tile, track);
|
|
|
YapfNotifyTrackLayoutChange(endtile, track);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, (DistanceManhattan(tile, endtile) + 1) * _price.clear_bridge);
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, (GetTunnelBridgeLength(tile, endtile) + 2) * _price.clear_bridge);
|
|
|
}
|
|
|
|
|
|
static CommandCost ClearTile_TunnelBridge(TileIndex tile, byte flags)
|
|
|
{
|
|
|
if (IsTunnel(tile)) {
|
|
|
if (flags & DC_AUTO) return_cmd_error(STR_5006_MUST_DEMOLISH_TUNNEL_FIRST);
|
|
@@ -1015,14 +1005,14 @@ void DrawBridgeMiddle(const TileInfo* ti
|
|
|
|
|
|
rampnorth = GetNorthernBridgeEnd(ti->tile);
|
|
|
rampsouth = GetSouthernBridgeEnd(ti->tile);
|
|
|
|
|
|
axis = GetBridgeAxis(ti->tile);
|
|
|
piece = CalcBridgePiece(
|
|
|
DistanceManhattan(ti->tile, rampnorth),
|
|
|
DistanceManhattan(ti->tile, rampsouth)
|
|
|
GetTunnelBridgeLength(ti->tile, rampnorth) + 1,
|
|
|
GetTunnelBridgeLength(ti->tile, rampsouth) + 1
|
|
|
);
|
|
|
type = GetBridgeType(rampsouth);
|
|
|
|
|
|
if (GetTunnelBridgeTransportType(rampsouth) == TRANSPORT_RAIL) {
|
|
|
base_offset = GetRailTypeInfo(GetRailType(rampsouth))->bridge_offset;
|
|
|
} else {
|