diff -r 3b40a41f90d2 -r 6ce400c0a2f4 yapf/yapf_rail.cpp --- a/yapf/yapf_rail.cpp Mon Jan 01 10:26:12 2007 +0000 +++ b/yapf/yapf_rail.cpp Mon Jan 01 16:07:21 2007 +0000 @@ -49,7 +49,7 @@ FORCEINLINE bool FindNearestDepotTwoWay(Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed) { // set origin and destination nodes - Yapf().SetOrigin(t1, TrackdirToTrackdirBits(td1), t2, TrackdirToTrackdirBits(td2), reverse_penalty, true); + Yapf().SetOrigin(t1, td1, t2, td2, reverse_penalty, true); Yapf().SetDestination(v); Yapf().SetMaxCost(YAPF_TILE_LENGTH * max_distance); @@ -113,14 +113,7 @@ FORCEINLINE Trackdir ChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs, bool *path_not_found) { // set origin and destination nodes - if (v->tile == tile) { - // probably bridge head - trackdirs = (TrackdirBits)(GetTileTrackStatus(tile, TRANSPORT_RAIL) & TRACKDIR_BIT_MASK); - trackdirs &= DiagdirReachesTrackdirs(ReverseDiagDir(TrackdirToExitdir(ReverseTrackdir(GetVehicleTrackdir(v))))); - Yapf().SetOrigin(tile, trackdirs, INVALID_TILE, INVALID_TRACKDIR_BIT, 1, true); - } else { - Yapf().SetOrigin(v->tile, TrackdirToTrackdirBits(GetVehicleTrackdir(v)), INVALID_TILE, INVALID_TRACKDIR_BIT, 1, true); - } + Yapf().SetOrigin(v->tile, GetVehicleTrackdir(v), INVALID_TILE, INVALID_TRACKDIR, 1, true); Yapf().SetDestination(v); // find the best path @@ -142,8 +135,8 @@ pNode = pNode->m_parent; } // return trackdir from the best origin node (one of start nodes) - Node& best_next_node = (v->tile == tile ? *pNode : *pPrev); - assert(v->tile == tile || best_next_node.GetTile() == tile); + Node& best_next_node = *pPrev; + assert(best_next_node.GetTile() == tile); next_trackdir = best_next_node.GetTrackdir(); } return next_trackdir; @@ -159,7 +152,7 @@ { // create pathfinder instance // set origin and destination nodes - Yapf().SetOrigin(t1, TrackdirToTrackdirBits(td1), t2, TrackdirToTrackdirBits(td2), 1, false); + Yapf().SetOrigin(t1, td1, t2, td2, 1, false); Yapf().SetDestination(v); // find the best path