train_cmd.c
changeset 1758 68668114f92e
parent 1757 b179d50241dc
child 1766 7c048e309f18
equal deleted inserted replaced
1757:b179d50241dc 1758:68668114f92e
  1296 
  1296 
  1297 	// stop  searching if we've found a destination that is closer already.
  1297 	// stop  searching if we've found a destination that is closer already.
  1298 	return length >= tfdd->best_length;
  1298 	return length >= tfdd->best_length;
  1299 }
  1299 }
  1300 
  1300 
  1301 // returns the tile of a depot to goto to. The given vehicle must be on track,
  1301 // returns the tile of a depot to goto to. The given vehicle must not be
  1302 // so not crashed, in a depot, etc.
  1302 // crashed!
  1303 static TrainFindDepotData FindClosestTrainDepot(Vehicle *v)
  1303 static TrainFindDepotData FindClosestTrainDepot(Vehicle *v)
  1304 {
  1304 {
  1305 	int i;
  1305 	int i;
  1306 	TrainFindDepotData tfdd;
  1306 	TrainFindDepotData tfdd;
  1307 	uint tile = v->tile;
  1307 	uint tile = v->tile;
       
  1308 
       
  1309 	assert(!(v->vehstatus & VS_CRASHED));
  1308 
  1310 
  1309 	tfdd.owner = v->owner;
  1311 	tfdd.owner = v->owner;
  1310 	tfdd.best_length = (uint)-1;
  1312 	tfdd.best_length = (uint)-1;
  1311 
  1313 
  1312 	if (IsTileDepotType(tile, TRANSPORT_RAIL)){
  1314 	if (IsTileDepotType(tile, TRANSPORT_RAIL)){