|
@@ -126,13 +126,13 @@ public:
|
|
|
{
|
|
|
bool bDest = (n.m_key.m_tile == m_destTile) && ((m_destTrackdirs & TrackdirToTrackdirBits(n.GetTrackdir())) != TRACKDIR_BIT_NONE);
|
|
|
return bDest;
|
|
|
}
|
|
|
|
|
|
/** Called by YAPF to calculate cost estimate. Calculates distance to the destination
|
|
|
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
|
|
|
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
|
|
|
inline bool PfCalcEstimate(Node& n)
|
|
|
{
|
|
|
int dx = abs(TileX(n.GetTile()) - TileX(m_destTile));
|
|
|
int dy = abs(TileY(n.GetTile()) - TileY(m_destTile));
|
|
|
assert(dx >= 0 && dy >= 0);
|
|
|
int dd = min(dx, dy);
|
|
@@ -141,15 +141,15 @@ public:
|
|
|
n.m_estimate = n.m_cost + d /*+ d / 8*/;
|
|
|
return true;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/** YAPF template that uses Ttypes template argument to determine all YAPF
|
|
|
* components (base classes) from which the actual YAPF is composed.
|
|
|
* For example classes consult: CYapfRail_TypesT template and its instantiations:
|
|
|
* CYapfRail1, CYapfRail2, CYapfRail3, CYapfAnyDepotRail1, CYapfAnyDepotRail2, CYapfAnyDepotRail3 */
|
|
|
* components (base classes) from which the actual YAPF is composed.
|
|
|
* For example classes consult: CYapfRail_TypesT template and its instantiations:
|
|
|
* CYapfRail1, CYapfRail2, CYapfRail3, CYapfAnyDepotRail1, CYapfAnyDepotRail2, CYapfAnyDepotRail3 */
|
|
|
template <class Ttypes>
|
|
|
class CYapfT
|
|
|
: public Ttypes::PfBase ///< Instance of CYapfBaseT - main YAPF loop and support base class
|
|
|
, public Ttypes::PfCost ///< Cost calculation provider base class
|
|
|
, public Ttypes::PfCache ///< Segment cost cache provider
|
|
|
, public Ttypes::PfOrigin ///< Origin (tile or two-tile origin)
|