yapf/yapf_common.hpp
changeset 3978 bfd412e43038
parent 3914 f5118020cd84
child 4549 60410aa1aa88
equal deleted inserted replaced
3977:edb5b94e2094 3978:bfd412e43038
    28 	}
    28 	}
    29 
    29 
    30 	/// Called when YAPF needs to place origin nodes into open list
    30 	/// Called when YAPF needs to place origin nodes into open list
    31 	void PfSetStartupNodes()
    31 	void PfSetStartupNodes()
    32 	{
    32 	{
       
    33 		bool is_choice = (KillFirstBit2x64(m_orgTrackdirs) != 0);
    33 		for (TrackdirBits tdb = m_orgTrackdirs; tdb != TRACKDIR_BIT_NONE; tdb = (TrackdirBits)KillFirstBit2x64(tdb)) {
    34 		for (TrackdirBits tdb = m_orgTrackdirs; tdb != TRACKDIR_BIT_NONE; tdb = (TrackdirBits)KillFirstBit2x64(tdb)) {
    34 			Trackdir td = (Trackdir)FindFirstBit2x64(tdb);
    35 			Trackdir td = (Trackdir)FindFirstBit2x64(tdb);
    35 			Node& n1 = Yapf().CreateNewNode();
    36 			Node& n1 = Yapf().CreateNewNode();
    36 			n1.Set(NULL, m_orgTile, td);
    37 			n1.Set(NULL, m_orgTile, td, is_choice);
    37 			Yapf().AddStartupNode(n1);
    38 			Yapf().AddStartupNode(n1);
    38 		}
    39 		}
    39 	}
    40 	}
    40 };
    41 };
    41 
    42 
    74 	/// Called when YAPF needs to place origin nodes into open list
    75 	/// Called when YAPF needs to place origin nodes into open list
    75 	void PfSetStartupNodes()
    76 	void PfSetStartupNodes()
    76 	{
    77 	{
    77 		if (m_orgTile != INVALID_TILE && m_orgTd != INVALID_TRACKDIR) {
    78 		if (m_orgTile != INVALID_TILE && m_orgTd != INVALID_TRACKDIR) {
    78 			Node& n1 = Yapf().CreateNewNode();
    79 			Node& n1 = Yapf().CreateNewNode();
    79 			n1.Set(NULL, m_orgTile, m_orgTd);
    80 			n1.Set(NULL, m_orgTile, m_orgTd, false);
    80 			Yapf().AddStartupNode(n1);
    81 			Yapf().AddStartupNode(n1);
    81 		}
    82 		}
    82 		if (m_revTile != INVALID_TILE && m_revTd != INVALID_TRACKDIR) {
    83 		if (m_revTile != INVALID_TILE && m_revTd != INVALID_TRACKDIR) {
    83 			Node& n2 = Yapf().CreateNewNode();
    84 			Node& n2 = Yapf().CreateNewNode();
    84 			n2.Set(NULL, m_revTile, m_revTd);
    85 			n2.Set(NULL, m_revTile, m_revTd, false);
    85 			n2.m_cost = m_reverse_penalty;
    86 			n2.m_cost = m_reverse_penalty;
    86 			Yapf().AddStartupNode(n2);
    87 			Yapf().AddStartupNode(n2);
    87 		}
    88 		}
    88 	}
    89 	}
    89 
    90