summaryrefslogtreecommitdiff
path: root/src/pathfinder/yapf/yapf_node.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pathfinder/yapf/yapf_node.hpp')
-rw-r--r--src/pathfinder/yapf/yapf_node.hpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/pathfinder/yapf/yapf_node.hpp b/src/pathfinder/yapf/yapf_node.hpp
index 39f393381..e1b41c615 100644
--- a/src/pathfinder/yapf/yapf_node.hpp
+++ b/src/pathfinder/yapf/yapf_node.hpp
@@ -54,9 +54,8 @@ struct CYapfNodeT {
int m_cost;
int m_estimate;
- inline void Set(Node *parent, TileIndex tile, Trackdir td, bool is_choice)
+ inline void Set(Node *parent, bool is_choice)
{
- m_key.Set(tile, td);
m_hash_next = NULL;
m_parent = parent;
m_cost = 0;
@@ -65,8 +64,6 @@ struct CYapfNodeT {
inline Node *GetHashNext() {return m_hash_next;}
inline void SetHashNext(Node *pNext) {m_hash_next = pNext;}
- inline TileIndex GetTile() const {return m_key.m_tile;}
- inline Trackdir GetTrackdir() const {return m_key.m_td;}
inline const Tkey_& GetKey() const {return m_key;}
inline int GetCost() const {return m_cost;}
inline int GetCostEstimate() const {return m_estimate;}
@@ -81,4 +78,21 @@ struct CYapfNodeT {
}
};
+/** Yapf Node base for trackdir based specialisation. */
+template <class Tkey_, class Tnode>
+struct CYapfNodeTrackT : public CYapfNodeT<Tkey_, Tnode>
+{
+ typedef CYapfNodeT<Tkey_, Tnode> Base;
+ typedef Tnode Node;
+
+ inline void Set(Node *parent, TileIndex tile, Trackdir td, bool is_choice)
+ {
+ Base::Set(parent, is_choice);
+ this->m_key.Set(tile, td);
+ }
+
+ inline TileIndex GetTile() const { return this->m_key.m_tile; }
+ inline Trackdir GetTrackdir() const { return this->m_key.m_td; }
+};
+
#endif /* YAPF_NODE_HPP */