summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-04-04 11:36:42 +0000
committeralberth <alberth@openttd.org>2010-04-04 11:36:42 +0000
commit7f5a0751e26489a5074357c2710d12c60d74300f (patch)
tree5bcc3d5f56be32f0d4a123540fb24363a4ebb400
parent6934e6fe7d5940c36b8542b340e2566a95939e9c (diff)
downloadopenttd-7f5a0751e26489a5074357c2710d12c60d74300f.tar.xz
(svn r19559) -Codechange: Rename CheckBridge_Stuff() to CheckBridgeAvailability().
-rw-r--r--src/bridge.h2
-rw-r--r--src/bridge_gui.cpp4
-rw-r--r--src/tunnelbridge_cmd.cpp9
3 files changed, 10 insertions, 5 deletions
diff --git a/src/bridge.h b/src/bridge.h
index 4916e2484..ba4a07a6e 100644
--- a/src/bridge.h
+++ b/src/bridge.h
@@ -67,7 +67,7 @@ static inline const BridgeSpec *GetBridgeSpec(BridgeType i)
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();
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index 85b2e7b48..9e8632c1f 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -375,7 +375,7 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
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 start, TileIndex end, TransportType transpo
/* 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;
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 4bfbf9b1b..6eb1377a5 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -163,7 +163,12 @@ static CommandCost CheckBridgeSlopeSouth(Axis axis, Slope *tileh, uint *z)
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_tile, DoCommandFlag flags, uint32 p1, u
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);
}