(svn r21142) -Codechange: replace magic bridge length constants with proper constants (uni657)
This commit is contained in:
@@ -173,7 +173,7 @@ static CommandCost CheckBridgeSlopeSouth(Axis axis, Slope *tileh, uint *z)
|
||||
CommandCost CheckBridgeAvailability(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags)
|
||||
{
|
||||
if (flags & DC_QUERY_COST) {
|
||||
if (bridge_len <= (_settings_game.construction.longbridges ? 100U : 16U)) return CommandCost();
|
||||
if (bridge_len <= (_settings_game.construction.longbridges ? MAX_BRIDGE_LENGTH_LONGBRIDGES : MAX_BRIDGE_LENGTH)) return CommandCost();
|
||||
return_cmd_error(STR_ERROR_BRIDGE_TOO_LONG);
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ CommandCost CheckBridgeAvailability(BridgeType bridge_type, uint bridge_len, DoC
|
||||
if (b->avail_year > _cur_year) return CMD_ERROR;
|
||||
|
||||
uint max = b->max_length;
|
||||
if (max >= 16 && _settings_game.construction.longbridges) max = 100;
|
||||
if (max >= MAX_BRIDGE_LENGTH && _settings_game.construction.longbridges) max = MAX_BRIDGE_LENGTH_LONGBRIDGES;
|
||||
|
||||
if (b->min_length > bridge_len) return CMD_ERROR;
|
||||
if (bridge_len <= max) return CommandCost();
|
||||
@@ -257,7 +257,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
|
||||
CommandCost ret = CheckBridgeAvailability(bridge_type, bridge_len, flags);
|
||||
if (ret.Failed()) return ret;
|
||||
} else {
|
||||
if (bridge_len > (_settings_game.construction.longbridges ? 100U : 16U)) return_cmd_error(STR_ERROR_BRIDGE_TOO_LONG);
|
||||
if (bridge_len > (_settings_game.construction.longbridges ? MAX_BRIDGE_LENGTH_LONGBRIDGES : MAX_BRIDGE_LENGTH)) return_cmd_error(STR_ERROR_BRIDGE_TOO_LONG);
|
||||
}
|
||||
|
||||
uint z_start;
|
||||
|
Reference in New Issue
Block a user