summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-02-28 18:15:19 +0000
committeralberth <alberth@openttd.org>2010-02-28 18:15:19 +0000
commit63dd6ce6b0d6508ad3c07263b583b0090b2d4cba (patch)
tree4d49d60b5c90925642ee3309054c5f22836ade02 /src/vehicle.cpp
parent986d15ef73106270701616373b778e0332e40555 (diff)
downloadopenttd-63dd6ce6b0d6508ad3c07263b583b0090b2d4cba.tar.xz
(svn r19291) -Codechange: Rename HasVehicleOnTunnelBridge() to TunnelBridgeIsFree() and return a CommandCost status.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 1a72220a8..9c32c14a6 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -437,9 +437,9 @@ static Vehicle *GetVehicleTunnelBridgeProc(Vehicle *v, void *data)
* @param tile first end
* @param endtile second end
* @param ignore Ignore this vehicle when searching
- * @return true if the bridge has a vehicle
+ * @return Succeeded command (if tunnel/bridge is free) or failed command (if a vehicle is using the tunnel/bridge).
*/
-bool HasVehicleOnTunnelBridge(TileIndex tile, TileIndex endtile, const Vehicle *ignore)
+CommandCost TunnelBridgeIsFree(TileIndex tile, TileIndex endtile, const Vehicle *ignore)
{
/* Value v is not safe in MP games, however, it is used to generate a local
* error message only (which may be different for different machines).
@@ -448,8 +448,8 @@ bool HasVehicleOnTunnelBridge(TileIndex tile, TileIndex endtile, const Vehicle *
Vehicle *v = VehicleFromPos(tile, (void *)ignore, &GetVehicleTunnelBridgeProc, true);
if (v == NULL) v = VehicleFromPos(endtile, (void *)ignore, &GetVehicleTunnelBridgeProc, true);
- if (v != NULL) _error_message = STR_ERROR_TRAIN_IN_THE_WAY + v->type;
- return v != NULL;
+ if (v != NULL) return_cmd_error(STR_ERROR_TRAIN_IN_THE_WAY + v->type);
+ return CommandCost();
}