(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.

This commit is contained in:
rubidium
2008-04-11 08:14:43 +00:00
parent 3a0cb23548
commit 62bdc381e7
9 changed files with 73 additions and 4 deletions

View File

@@ -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