File diff r4548:6a33e364fba5 → r4549:76b9213799ac
yapf/unittest/test_yapf.h
Show inline comments
 
@@ -157,14 +157,14 @@ struct CYapfTestBaseT
 

	
 
	/// to access inherited path finder
 
	Tpf& Yapf() {return *static_cast<Tpf*>(this);}
 
	FORCEINLINE char TransportTypeChar() const {return 'T';}
 

	
 
	/** Called by YAPF to move from the given node to the next tile. For each
 
	*   reachable trackdir on the new tile creates new node, initializes it
 
	*   and adds it to the open list by calling Yapf().AddNewNode(n) */
 
	 *  reachable trackdir on the new tile creates new node, initializes it
 
	 *  and adds it to the open list by calling Yapf().AddNewNode(n) */
 
	FORCEINLINE void PfFollowNode(Node& org)
 
	{
 
		int x_org = org.m_key.m_x;
 
		int y_org = org.m_key.m_y;
 
		int z_org = Map::MapZ(x_org, y_org);
 
		DiagDirection exitdir = TrackdirToExitdir(org.m_key.m_td);
 
@@ -204,14 +204,14 @@ struct CYapfTestBaseT
 
		n1.m_key.m_td = m_td1;
 
		n1.m_key.m_exitdir = TrackdirToExitdir(n1.m_key.m_td);
 
		Yapf().AddStartupNode(n1);
 
	}
 

	
 
	/** Called by YAPF to calculate the cost from the origin to the given node.
 
	*   Calculates only the cost of given node, adds it to the parent node cost
 
	*   and stores the result into Node::m_cost member */
 
	 *  Calculates only the cost of given node, adds it to the parent node cost
 
	 *  and stores the result into Node::m_cost member */
 
	FORCEINLINE bool PfCalcCost(Node& n)
 
	{
 
		// base tile cost depending on distance
 
		int c = IsDiagonalTrackdir(n.m_key.m_td) ? 10 : 7;
 
		// additional penalty for curve
 
		if (n.m_parent != NULL && n.m_key.m_td != n.m_parent->m_key.m_td) c += 3;
 
@@ -222,13 +222,13 @@ struct CYapfTestBaseT
 
		// apply it
 
		n.m_cost = n.m_parent->m_cost + c;
 
		return true;
 
	}
 

	
 
	/** 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 */
 
	FORCEINLINE bool PfCalcEstimate(Node& n)
 
	{
 
		int dx = abs(n.m_key.m_x - m_x2);
 
		int dy = abs(n.m_key.m_y - m_y2);
 
		int dd = min(dx, dy);
 
		int dxy = abs(dx - dy);