diff src/roadveh_cmd.cpp @ 8890:b1d45af72e04 draft

(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
author rubidium <rubidium@openttd.org>
date Fri, 11 Apr 2008 08:14:43 +0000
parents 1300bc87c872
children 384f81a7ba31
line wrap: on
line diff
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -446,6 +446,18 @@
 	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