yapf/yapf_road.cpp
changeset 5385 3868f2e6db9b
parent 4989 3d6541afbbaf
equal deleted inserted replaced
5384:10b6d955e1ac 5385:3868f2e6db9b
   426 }
   426 }
   427 
   427 
   428 Depot* YapfFindNearestRoadDepot(const Vehicle *v)
   428 Depot* YapfFindNearestRoadDepot(const Vehicle *v)
   429 {
   429 {
   430 	TileIndex tile = v->tile;
   430 	TileIndex tile = v->tile;
   431 	if (v->u.road.state == 255) tile = GetVehicleOutOfTunnelTile(v);
       
   432 	Trackdir trackdir = GetVehicleTrackdir(v);
   431 	Trackdir trackdir = GetVehicleTrackdir(v);
   433 	if ((GetTileTrackStatus(tile, TRANSPORT_ROAD) & TrackdirToTrackdirBits(trackdir)) == 0)
   432 	if ((GetTileTrackStatus(tile, TRANSPORT_ROAD) & TrackdirToTrackdirBits(trackdir)) == 0)
   434 		return NULL;
   433 		return NULL;
   435 
   434 
   436 	// handle the case when our vehicle is already in the depot tile
   435 	// handle the case when our vehicle is already in the depot tile