src/yapf/yapf_node.hpp
changeset 7615 42bf748ad323
parent 6447 3b71e57fd22b
child 10429 1b99254f9607
equal deleted inserted replaced
7614:a70f01c9eb57 7615:42bf748ad323
    18 		m_exitdir = (m_td == INVALID_TRACKDIR) ? INVALID_DIAGDIR : TrackdirToExitdir(m_td);
    18 		m_exitdir = (m_td == INVALID_TRACKDIR) ? INVALID_DIAGDIR : TrackdirToExitdir(m_td);
    19 	}
    19 	}
    20 
    20 
    21 	FORCEINLINE int CalcHash() const {return m_exitdir | (m_tile << 2);}
    21 	FORCEINLINE int CalcHash() const {return m_exitdir | (m_tile << 2);}
    22 	FORCEINLINE bool operator == (const CYapfNodeKeyExitDir& other) const {return (m_tile == other.m_tile) && (m_exitdir == other.m_exitdir);}
    22 	FORCEINLINE bool operator == (const CYapfNodeKeyExitDir& other) const {return (m_tile == other.m_tile) && (m_exitdir == other.m_exitdir);}
       
    23 
       
    24 	void Dump(DumpTarget &dmp) const
       
    25 	{
       
    26 		dmp.WriteTile("m_tile", m_tile);
       
    27 		dmp.WriteEnumT("m_td", m_td);
       
    28 		dmp.WriteEnumT("m_exitdir", m_exitdir);
       
    29 	}
    23 };
    30 };
    24 
    31 
    25 struct CYapfNodeKeyTrackDir : public CYapfNodeKeyExitDir
    32 struct CYapfNodeKeyTrackDir : public CYapfNodeKeyExitDir
    26 {
    33 {
    27 	FORCEINLINE int CalcHash() const {return m_td | (m_tile << 4);}
    34 	FORCEINLINE int CalcHash() const {return m_td | (m_tile << 4);}
    55 	FORCEINLINE Trackdir GetTrackdir() const {return m_key.m_td;}
    62 	FORCEINLINE Trackdir GetTrackdir() const {return m_key.m_td;}
    56 	FORCEINLINE const Tkey_& GetKey() const {return m_key;}
    63 	FORCEINLINE const Tkey_& GetKey() const {return m_key;}
    57 	FORCEINLINE int GetCost() {return m_cost;}
    64 	FORCEINLINE int GetCost() {return m_cost;}
    58 	FORCEINLINE int GetCostEstimate() {return m_estimate;}
    65 	FORCEINLINE int GetCostEstimate() {return m_estimate;}
    59 	FORCEINLINE bool operator < (const Node& other) const {return m_estimate < other.m_estimate;}
    66 	FORCEINLINE bool operator < (const Node& other) const {return m_estimate < other.m_estimate;}
       
    67 
       
    68 	void Dump(DumpTarget &dmp) const
       
    69 	{
       
    70 		dmp.WriteStructT("m_key", &m_key);
       
    71 		dmp.WriteStructT("m_parent", m_parent);
       
    72 		dmp.WriteLine("m_cost = %d", m_cost);
       
    73 		dmp.WriteLine("m_estimate = %d", m_estimate);
       
    74 	}
    60 };
    75 };
    61 
    76 
    62 /** Yapf Node for ships */
    77 /** Yapf Node for ships */
    63 template <class Tkey_>
    78 template <class Tkey_>
    64 struct CYapfShipNodeT
    79 struct CYapfShipNodeT