|
@@ -693,12 +693,22 @@ static int32 ClearTile_TunnelBridge(Tile
|
|
|
return DoClearBridge(tile, flags);
|
|
|
}
|
|
|
|
|
|
return CMD_ERROR;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Switches the rail type for a tunnel or a bridgehead. As the railtype
|
|
|
* on the bridge are determined by the one of the bridgehead, this
|
|
|
* functions converts the railtype on the entire bridge.
|
|
|
* @param tile The tile on which the railtype is to be convert.
|
|
|
* @param totype The railtype we want to convert to
|
|
|
* @param exec Switches between test and execute mode
|
|
|
* @return The cost and state of the operation
|
|
|
* @retval CMD_ERROR An error occured during the operation.
|
|
|
*/
|
|
|
int32 DoConvertTunnelBridgeRail(TileIndex tile, RailType totype, bool exec)
|
|
|
{
|
|
|
TileIndex endtile;
|
|
|
|
|
|
if (IsTunnel(tile) && GetTunnelTransportType(tile) == TRANSPORT_RAIL) {
|
|
|
uint length;
|
|
@@ -721,13 +731,13 @@ int32 DoConvertTunnelBridgeRail(TileInde
|
|
|
MarkTileDirtyByTile(endtile);
|
|
|
|
|
|
track = AxisToTrack(DiagDirToAxis(GetTunnelDirection(tile)));
|
|
|
YapfNotifyTrackLayoutChange(tile, track);
|
|
|
YapfNotifyTrackLayoutChange(endtile, track);
|
|
|
}
|
|
|
return (length + 1) * (_price.build_rail >> 1);
|
|
|
return (length + 1) * (_price.build_rail / 2);
|
|
|
} else if (IsBridge(tile) && GetBridgeTransportType(tile) == TRANSPORT_RAIL) {
|
|
|
|
|
|
if (!CheckTileOwnership(tile)) return CMD_ERROR;
|
|
|
|
|
|
endtile = GetOtherBridgeEnd(tile);
|
|
|
|
|
@@ -755,13 +765,13 @@ int32 DoConvertTunnelBridgeRail(TileInde
|
|
|
delta = TileOffsByDiagDir(GetBridgeRampDirection(tile));
|
|
|
for (tile += delta; tile != endtile; tile += delta) {
|
|
|
MarkTileDirtyByTile(tile); // TODO encapsulate this into a function
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return (DistanceManhattan(tile, endtile) + 1) * (_price.build_rail >> 1);
|
|
|
return (DistanceManhattan(tile, endtile) + 1) * (_price.build_rail / 2);
|
|
|
} else {
|
|
|
return CMD_ERROR;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|