src/train_cmd.cpp
changeset 10126 bed2d9d38577
parent 10098 00ebbccc6181
child 10127 ab5e35f77e87
--- a/src/train_cmd.cpp	Thu Apr 10 22:18:33 2008 +0000
+++ b/src/train_cmd.cpp	Fri Apr 11 08:14:43 2008 +0000
@@ -2084,6 +2084,18 @@
 	return tfdd;
 }
 
+bool Train::FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse)
+{
+	TrainFindDepotData tfdd = FindClosestTrainDepot(this, 0);
+	if (tfdd.best_length == (uint)-1) return false;
+
+	if (location    != NULL) *location    = tfdd.tile;
+	if (destination != NULL) *destination = GetDepotByTile(tfdd.tile)->index;
+	if (reverse     != NULL) *reverse     = tfdd.reverse;
+
+	return true;
+}
+
 /** Send a train to a depot
  * @param tile unused
  * @param flags type of operation