summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 5a00eb1e8..e06137342 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -218,55 +218,6 @@ void ShowNewGrfVehicleError(EngineID engine, StringID part1, StringID part2, GRF
DEBUG(grf, 0, "%s", buffer + 3);
}
-/** Callback that returns 'real' vehicles lower or at height \c *(byte*)data .
- * @param v Vehicle to examine.
- * @param data Pointer to height data.
- * @return \a v if conditions are met, else \c NULL.
- */
-static Vehicle *EnsureNoVehicleProcZ(Vehicle *v, void *data)
-{
- byte z = *(byte*)data;
-
- if (v->type == VEH_DISASTER || (v->type == VEH_AIRCRAFT && v->subtype == AIR_SHADOW)) return NULL;
- if (v->z_pos > z) return NULL;
-
- _error_message = STR_ERROR_TRAIN_IN_THE_WAY + v->type;
- return v;
-}
-
-/* Ensure there is no vehicle at the ground at the given position.
- * @param tile Position to examine.
- * @return A vehicle has been found.
- */
-bool EnsureNoVehicleOnGround(TileIndex tile)
-{
- byte z = GetTileMaxZ(tile);
- return !HasVehicleOnPos(tile, &z, &EnsureNoVehicleProcZ);
-}
-
-/** Procedure called for every vehicle found in tunnel/bridge in the hash map */
-static Vehicle *GetVehicleTunnelBridgeProc(Vehicle *v, void *data)
-{
- if (v->type != VEH_TRAIN && v->type != VEH_ROAD && v->type != VEH_SHIP) return NULL;
- if (v == (const Vehicle *)data) return NULL;
-
- _error_message = STR_ERROR_TRAIN_IN_THE_WAY + v->type;
- return v;
-}
-
-/**
- * Finds vehicle in tunnel / bridge
- * @param tile first end
- * @param endtile second end
- * @param ignore Ignore this vehicle when searching
- * @return true if the bridge has a vehicle
- */
-bool HasVehicleOnTunnelBridge(TileIndex tile, TileIndex endtile, const Vehicle *ignore)
-{
- return HasVehicleOnPos(tile, (void *)ignore, &GetVehicleTunnelBridgeProc) ||
- HasVehicleOnPos(endtile, (void *)ignore, &GetVehicleTunnelBridgeProc);
-}
-
/**
* Vehicle constructor.
* @param type Type of the new vehicle.
@@ -440,6 +391,55 @@ bool HasVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
return VehicleFromPos(tile, data, proc, true) != NULL;
}
+/** Callback that returns 'real' vehicles lower or at height \c *(byte*)data .
+ * @param v Vehicle to examine.
+ * @param data Pointer to height data.
+ * @return \a v if conditions are met, else \c NULL.
+ */
+static Vehicle *EnsureNoVehicleProcZ(Vehicle *v, void *data)
+{
+ byte z = *(byte*)data;
+
+ if (v->type == VEH_DISASTER || (v->type == VEH_AIRCRAFT && v->subtype == AIR_SHADOW)) return NULL;
+ if (v->z_pos > z) return NULL;
+
+ _error_message = STR_ERROR_TRAIN_IN_THE_WAY + v->type;
+ return v;
+}
+
+/* Ensure there is no vehicle at the ground at the given position.
+ * @param tile Position to examine.
+ * @return A vehicle has been found.
+ */
+bool EnsureNoVehicleOnGround(TileIndex tile)
+{
+ byte z = GetTileMaxZ(tile);
+ return !HasVehicleOnPos(tile, &z, &EnsureNoVehicleProcZ);
+}
+
+/** Procedure called for every vehicle found in tunnel/bridge in the hash map */
+static Vehicle *GetVehicleTunnelBridgeProc(Vehicle *v, void *data)
+{
+ if (v->type != VEH_TRAIN && v->type != VEH_ROAD && v->type != VEH_SHIP) return NULL;
+ if (v == (const Vehicle *)data) return NULL;
+
+ _error_message = STR_ERROR_TRAIN_IN_THE_WAY + v->type;
+ return v;
+}
+
+/**
+ * Finds vehicle in tunnel / bridge
+ * @param tile first end
+ * @param endtile second end
+ * @param ignore Ignore this vehicle when searching
+ * @return true if the bridge has a vehicle
+ */
+bool HasVehicleOnTunnelBridge(TileIndex tile, TileIndex endtile, const Vehicle *ignore)
+{
+ return HasVehicleOnPos(tile, (void *)ignore, &GetVehicleTunnelBridgeProc) ||
+ HasVehicleOnPos(endtile, (void *)ignore, &GetVehicleTunnelBridgeProc);
+}
+
static void UpdateNewVehiclePosHash(Vehicle *v, bool remove)
{