mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-07 06:46:43 +00:00
(svn r8426) -Fix
Slightly simplify the code which determines whether to build a rail or a road bridge
This commit is contained in:
parent
e0df42b3a3
commit
020c352ebf
@ -174,7 +174,6 @@ bool CheckBridge_Stuff(byte bridge_type, uint bridge_len)
|
|||||||
int32 CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
|
int32 CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
int bridge_type;
|
int bridge_type;
|
||||||
TransportType transport;
|
|
||||||
RailType railtype;
|
RailType railtype;
|
||||||
uint x;
|
uint x;
|
||||||
uint y;
|
uint y;
|
||||||
@ -202,12 +201,10 @@ int32 CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
|
|
||||||
// type of bridge
|
// type of bridge
|
||||||
if (HASBIT(p2, 15)) {
|
if (HASBIT(p2, 15)) {
|
||||||
railtype = RAILTYPE_BEGIN; // ??
|
railtype = INVALID_RAILTYPE; // road bridge
|
||||||
transport = TRANSPORT_ROAD;
|
|
||||||
} else {
|
} else {
|
||||||
if (!ValParamRailtype(GB(p2, 8, 8))) return CMD_ERROR;
|
if (!ValParamRailtype(GB(p2, 8, 8))) return CMD_ERROR;
|
||||||
railtype = (RailType)GB(p2, 8, 8);
|
railtype = (RailType)GB(p2, 8, 8);
|
||||||
transport = TRANSPORT_RAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x = TileX(end_tile);
|
x = TileX(end_tile);
|
||||||
@ -305,7 +302,7 @@ int32 CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
DiagDirection dir = AxisToDiagDir(direction);
|
DiagDirection dir = AxisToDiagDir(direction);
|
||||||
|
|
||||||
if (transport == TRANSPORT_RAIL) {
|
if (railtype != INVALID_RAILTYPE) {
|
||||||
MakeRailBridgeRamp(tile_start, _current_player, bridge_type, dir, railtype);
|
MakeRailBridgeRamp(tile_start, _current_player, bridge_type, dir, railtype);
|
||||||
MakeRailBridgeRamp(tile_end, _current_player, bridge_type, ReverseDiagDir(dir), railtype);
|
MakeRailBridgeRamp(tile_end, _current_player, bridge_type, ReverseDiagDir(dir), railtype);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user