summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-03-05 21:20:22 +0000
committeralberth <alberth@openttd.org>2010-03-05 21:20:22 +0000
commitc395b93acd69106df6005e66264d9114e0198440 (patch)
tree5cab6ad9aa5c0ff7ee6ddb129ed9b8d439bbedbe /src/vehicle.cpp
parent0bfd06245b57aa1276cc321fc8d841fd655f7b79 (diff)
downloadopenttd-c395b93acd69106df6005e66264d9114e0198440.tar.xz
(svn r19319) -Codechange: EnsureNoVehicleOnGround() returns a CommandCost.
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 bba6a5219..05df6ad9f 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -408,9 +408,9 @@ static Vehicle *EnsureNoVehicleProcZ(Vehicle *v, void *data)
/* Ensure there is no vehicle at the ground at the given position.
* @param tile Position to examine.
- * @return A vehicle has been found.
+ * @return Succeeded command (ground is free) or failed command (a vehicle is found).
*/
-bool EnsureNoVehicleOnGround(TileIndex tile)
+CommandCost EnsureNoVehicleOnGround(TileIndex tile)
{
byte z = GetTileMaxZ(tile);
@@ -419,8 +419,8 @@ bool EnsureNoVehicleOnGround(TileIndex tile)
* Such a message does not affect MP synchronisation.
*/
Vehicle *v = VehicleFromPos(tile, &z, &EnsureNoVehicleProcZ, 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();
}
/** Procedure called for every vehicle found in tunnel/bridge in the hash map */