Changeset - r14942:db3a0ed92d44
[Not reviewed]
master
0 3 0
alberth - 15 years ago 2010-04-04 11:36:42
alberth@openttd.org
(svn r19559) -Codechange: Rename CheckBridge_Stuff() to CheckBridgeAvailability().
3 files changed with 10 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/bridge.h
Show inline comments
 
@@ -67,7 +67,7 @@ static inline const BridgeSpec *GetBridg
 

	
 
void DrawBridgeMiddle(const TileInfo *ti);
 

	
 
bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags = DC_NONE);
 
bool CheckBridgeAvailability(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags = DC_NONE);
 
int CalcBridgeLenCostFactor(int x);
 

	
 
void ResetBridges();
src/bridge_gui.cpp
Show inline comments
 
@@ -375,7 +375,7 @@ void ShowBuildBridgeWindow(TileIndex sta
 
		case TRANSPORT_RAIL: last_bridge_type = _last_railbridge_type; break;
 
		default: break; // water ways and air routes don't have bridge types
 
	}
 
	if (_ctrl_pressed && CheckBridge_Stuff(last_bridge_type, bridge_len)) {
 
	if (_ctrl_pressed && CheckBridgeAvailability(last_bridge_type, bridge_len)) {
 
		DoCommandP(end, start, type | last_bridge_type, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE), CcBuildBridge);
 
		return;
 
	}
 
@@ -396,7 +396,7 @@ void ShowBuildBridgeWindow(TileIndex sta
 

	
 
		/* loop for all bridgetypes */
 
		for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) {
 
			if (CheckBridge_Stuff(brd_type, bridge_len)) {
 
			if (CheckBridgeAvailability(brd_type, bridge_len)) {
 
				/* bridge is accepted, add to list */
 
				BuildBridgeData *item = bl->Append();
 
				item->index = brd_type;
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -163,7 +163,12 @@ static CommandCost CheckBridgeSlopeSouth
 
	return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
 
}
 

	
 
bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags)
 
/** Is a bridge of the specified type and length available?
 
 * @param bridge_type Wanted type of bridge.
 
 * @param bridge_len  Wanted length of the bridge.
 
 * @return The requested bridge is available.
 
 */
 
bool CheckBridgeAvailability(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags)
 
{
 
	if (flags & DC_QUERY_COST) {
 
		return bridge_len <= (_settings_game.construction.longbridges ? 100U : 16U);
 
@@ -243,7 +248,7 @@ CommandCost CmdBuildBridge(TileIndex end
 
	uint bridge_len = GetTunnelBridgeLength(tile_start, tile_end);
 
	if (transport_type != TRANSPORT_WATER) {
 
		/* set and test bridge length, availability */
 
		if (!CheckBridge_Stuff(bridge_type, bridge_len, flags)) return_cmd_error(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE);
 
		if (!CheckBridgeAvailability(bridge_type, bridge_len, flags)) return_cmd_error(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE);
 
	} else {
 
		if (bridge_len > (_settings_game.construction.longbridges ? 100U : 16U)) return_cmd_error(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE);
 
	}
0 comments (0 inline, 0 general)