summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index a26180837..3c90018be 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -446,6 +446,18 @@ static const Depot* FindClosestRoadDepot(const Vehicle* v)
return NULL; /* Target not found */
}
+bool RoadVehicle::FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse)
+{
+ const Depot *depot = FindClosestRoadDepot(this);
+
+ if (depot == NULL) return false;
+
+ if (location != NULL) *location = depot->xy;
+ if (destination != NULL) *destination = depot->index;
+
+ return true;
+}
+
/** Send a road vehicle to the depot.
* @param tile unused
* @param flags operation to perform