1
0
Fork 0

Codechange: Cleaned up and renamed NodeList

pull/13077/head
Koen Bussemaker 2024-11-09 16:45:12 +01:00 committed by Kuhnovic
parent bbc1f7b3dc
commit 3e195df3c7
15 changed files with 124 additions and 136 deletions

View File

@ -25,11 +25,11 @@
void AyStar::OpenListAdd(PathNode *parent, const AyStarNode *node, int f, int g) void AyStar::OpenListAdd(PathNode *parent, const AyStarNode *node, int f, int g)
{ {
/* Add a new Node to the OpenList */ /* Add a new Node to the OpenList */
PathNode *new_node = this->nodes.CreateNewNode(); PathNode &new_node = this->nodes.CreateNewNode();
new_node->Set(parent, node->tile, node->td, true); new_node.Set(parent, node->tile, node->td, true);
new_node->estimate = f; new_node.estimate = f;
new_node->cost = g; new_node.cost = g;
this->nodes.InsertOpenNode(*new_node); this->nodes.InsertOpenNode(new_node);
} }
/** /**

View File

@ -136,7 +136,7 @@ struct AyStar {
void CheckTile(AyStarNode *current, PathNode *parent); void CheckTile(AyStarNode *current, PathNode *parent);
protected: protected:
CNodeList_HashTableT<PathNode, 8, 10> nodes; NodeList<PathNode, 8, 10> nodes;
void OpenListAdd(PathNode *parent, const AyStarNode *node, int f, int g); void OpenListAdd(PathNode *parent, const AyStarNode *node, int f, int g);
}; };

View File

@ -15,38 +15,28 @@
/** /**
* Hash table based node list multi-container class. * Hash table based node list multi-container class.
* Implements open list, closed list and priority queue for A-star * Implements open list, closed list and priority queue for A-star pathfinder.
* path finder.
*/ */
template <class Titem_, int Thash_bits_open_, int Thash_bits_closed_> template <class Titem, int Thash_bits_open, int Thash_bits_closed>
class CNodeList_HashTableT { class NodeList {
public: public:
typedef Titem_ Titem; ///< Make #Titem_ visible from outside of class. using Item = Titem;
typedef typename Titem_::Key Key; ///< Make Titem_::Key a property of this class. using Key = typename Titem::Key;
using CItemArray = std::deque<Titem_>; ///< Type that we will use as item container.
typedef HashTable<Titem_, Thash_bits_open_ > COpenList; ///< How pointers to open nodes will be stored.
typedef HashTable<Titem_, Thash_bits_closed_> CClosedList; ///< How pointers to closed nodes will be stored.
typedef CBinaryHeapT<Titem_> CPriorityQueue; ///< How the priority queue will be managed.
protected: protected:
CItemArray items; ///< Here we store full item data (Titem_). std::deque<Titem> items; ///< Storage of the nodes.
COpenList open_nodes; ///< Hash table of pointers to open item data. HashTable<Titem, Thash_bits_open> open_nodes; ///< Hash table of pointers to open nodes.
CClosedList closed_nodes; ///< Hash table of pointers to closed item data. HashTable<Titem, Thash_bits_closed> closed_nodes; ///< Hash table of pointers to closed nodes.
CPriorityQueue open_queue; ///< Priority queue of pointers to open item data. CBinaryHeapT<Titem> open_queue; ///< Priority queue of pointers to open nodes.
Titem *new_node; ///< New open node under construction. Titem *new_node; ///< New node under construction.
public: public:
/** default constructor */ /** default constructor */
CNodeList_HashTableT() : open_queue(2048) NodeList() : open_queue(2048)
{ {
this->new_node = nullptr; this->new_node = nullptr;
} }
/** destructor */
~CNodeList_HashTableT()
{
}
/** return number of open nodes */ /** return number of open nodes */
inline int OpenCount() inline int OpenCount()
{ {
@ -59,15 +49,21 @@ public:
return this->closed_nodes.Count(); return this->closed_nodes.Count();
} }
/** return the total number of nodes. */
inline int TotalCount()
{
return this->items.Length();
}
/** allocate new data item from items */ /** allocate new data item from items */
inline Titem_ *CreateNewNode() inline Titem &CreateNewNode()
{ {
if (this->new_node == nullptr) this->new_node = &this->items.emplace_back(); if (this->new_node == nullptr) this->new_node = &this->items.emplace_back();
return this->new_node; return *this->new_node;
} }
/** Notify the nodelist that we don't want to discard the given node. */ /** Notify the nodelist that we don't want to discard the given node. */
inline void FoundBestNode(Titem_ &item) inline void FoundBestNode(Titem &item)
{ {
/* for now it is enough to invalidate m_new_node if it is our given node */ /* for now it is enough to invalidate m_new_node if it is our given node */
if (&item == this->new_node) { if (&item == this->new_node) {
@ -77,7 +73,7 @@ public:
} }
/** insert given item as open node (into m_open and m_open_queue) */ /** insert given item as open node (into m_open and m_open_queue) */
inline void InsertOpenNode(Titem_ &item) inline void InsertOpenNode(Titem &item)
{ {
assert(this->closed_nodes.Find(item.GetKey()) == nullptr); assert(this->closed_nodes.Find(item.GetKey()) == nullptr);
this->open_nodes.Push(item); this->open_nodes.Push(item);
@ -88,7 +84,7 @@ public:
} }
/** return the best open node */ /** return the best open node */
inline Titem_ *GetBestOpenNode() inline Titem *GetBestOpenNode()
{ {
if (!this->open_queue.IsEmpty()) { if (!this->open_queue.IsEmpty()) {
return this->open_queue.Begin(); return this->open_queue.Begin();
@ -97,10 +93,10 @@ public:
} }
/** remove and return the best open node */ /** remove and return the best open node */
inline Titem_ *PopBestOpenNode() inline Titem *PopBestOpenNode()
{ {
if (!this->open_queue.IsEmpty()) { if (!this->open_queue.IsEmpty()) {
Titem_ *item = this->open_queue.Shift(); Titem *item = this->open_queue.Shift();
this->open_nodes.Pop(*item); this->open_nodes.Pop(*item);
return item; return item;
} }
@ -108,49 +104,42 @@ public:
} }
/** return the open node specified by a key or nullptr if not found */ /** return the open node specified by a key or nullptr if not found */
inline Titem_ *FindOpenNode(const Key &key) inline Titem *FindOpenNode(const Key &key)
{ {
Titem_ *item = this->open_nodes.Find(key); return this->open_nodes.Find(key);
return item;
} }
/** remove and return the open node specified by a key */ /** remove and return the open node specified by a key */
inline Titem_ &PopOpenNode(const Key &key) inline Titem &PopOpenNode(const Key &key)
{ {
Titem_ &item = this->open_nodes.Pop(key); Titem &item = this->open_nodes.Pop(key);
size_t idxPop = this->open_queue.FindIndex(item); size_t index = this->open_queue.FindIndex(item);
this->open_queue.Remove(idxPop); this->open_queue.Remove(index);
return item; return item;
} }
/** close node */ /** close node */
inline void InsertClosedNode(Titem_ &item) inline void InsertClosedNode(Titem &item)
{ {
assert(this->open_nodes.Find(item.GetKey()) == nullptr); assert(this->open_nodes.Find(item.GetKey()) == nullptr);
this->closed_nodes.Push(item); this->closed_nodes.Push(item);
} }
/** return the closed node specified by a key or nullptr if not found */ /** return the closed node specified by a key or nullptr if not found */
inline Titem_ *FindClosedNode(const Key &key) inline Titem *FindClosedNode(const Key &key)
{ {
Titem_ *item = this->closed_nodes.Find(key); return this->closed_nodes.Find(key);
return item;
}
/** The number of items. */
inline int TotalCount()
{
return this->items.Length();
} }
/** Get a particular item. */ /** Get a particular item. */
inline Titem_ &ItemAt(int idx) inline Titem &ItemAt(int index)
{ {
return this->items[idx]; return this->items[index];
} }
/** Helper for creating output of this array. */ /** Helper for creating output of this array. */
template <class D> void Dump(D &dmp) const template <class D>
void Dump(D &dmp) const
{ {
dmp.WriteStructT("data", &this->items); dmp.WriteStructT("data", &this->items);
} }

View File

@ -28,7 +28,7 @@
* NodeList needs to have defined local type Titem - defines the pathfinder node type. * NodeList needs to have defined local type Titem - defines the pathfinder node type.
* Node needs to define local type Key - the node key in the collection () * Node needs to define local type Key - the node key in the collection ()
* *
* For node list you can use template class CNodeList_HashTableT, for which * For node list you can use template class NodeList, for which
* you need to declare only your node type. Look at test_yapf.h for an example. * you need to declare only your node type. Look at test_yapf.h for an example.
* *
* *
@ -48,13 +48,12 @@
template <class Types> template <class Types>
class CYapfBaseT { class CYapfBaseT {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList NodeList; ///< our node list typedef typename Types::NodeList NodeList; ///< our node list
typedef typename Types::VehicleType VehicleType; ///< the type of vehicle typedef typename Types::VehicleType VehicleType; ///< the type of vehicle
typedef typename NodeList::Titem Node; ///< this will be our node type typedef typename NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
NodeList nodes; ///< node list multi-container NodeList nodes; ///< node list multi-container
@ -156,7 +155,7 @@ public:
*/ */
inline Node &CreateNewNode() inline Node &CreateNewNode()
{ {
Node &node = *this->nodes.CreateNewNode(); Node &node = this->nodes.CreateNewNode();
return node; return node;
} }

View File

@ -22,9 +22,9 @@ template <class Types>
class CYapfOriginTileT class CYapfOriginTileT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
protected: protected:
TileIndex origin_tile; ///< origin tile TileIndex origin_tile; ///< origin tile
@ -62,9 +62,9 @@ template <class Types>
class CYapfOriginTileTwoWayT class CYapfOriginTileTwoWayT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
protected: protected:
TileIndex origin_tile; ///< first origin tile TileIndex origin_tile; ///< first origin tile
@ -120,9 +120,9 @@ template <class Types>
class CYapfDestinationTileT class CYapfDestinationTileT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
protected: protected:
TileIndex dest_tile; ///< destination tile TileIndex dest_tile; ///< destination tile

View File

@ -24,8 +24,8 @@ template <class Types>
class CYapfSegmentCostCacheNoneT class CYapfSegmentCostCacheNoneT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
/** /**
* Called by YAPF to attach cached or local segment cost data to the given node. * Called by YAPF to attach cached or local segment cost data to the given node.
@ -105,9 +105,9 @@ struct CSegmentCostCacheT : public CSegmentCostCacheBase {
template <class Types> template <class Types>
class CYapfSegmentCostCacheGlobalT { class CYapfSegmentCostCacheGlobalT {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
typedef typename Node::CachedData CachedData; typedef typename Node::CachedData CachedData;
typedef typename CachedData::Key CacheKey; typedef typename CachedData::Key CacheKey;
typedef CSegmentCostCacheT<CachedData> Cache; typedef CSegmentCostCacheT<CachedData> Cache;

View File

@ -20,10 +20,10 @@
template <class Types> template <class Types>
class CYapfCostRailT : public CYapfCostBase { class CYapfCostRailT : public CYapfCostBase {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
typedef typename Node::CachedData CachedData; typedef typename Node::CachedData CachedData;
protected: protected:

View File

@ -39,9 +39,9 @@ public:
template <class Types> template <class Types>
class CYapfDestinationAnyDepotRailT : public CYapfDestinationRailBase { class CYapfDestinationAnyDepotRailT : public CYapfDestinationRailBase {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
/** to access inherited path finder */ /** to access inherited path finder */
Tpf &Yapf() Tpf &Yapf()
@ -75,9 +75,9 @@ public:
template <class Types> template <class Types>
class CYapfDestinationAnySafeTileRailT : public CYapfDestinationRailBase { class CYapfDestinationAnySafeTileRailT : public CYapfDestinationRailBase {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
typedef typename Types::TrackFollower TrackFollower; ///< TrackFollower. Need to typedef for gcc 2.95 typedef typename Types::TrackFollower TrackFollower; ///< TrackFollower. Need to typedef for gcc 2.95
/** to access inherited path finder */ /** to access inherited path finder */
@ -113,9 +113,9 @@ public:
template <class Types> template <class Types>
class CYapfDestinationTileOrStationRailT : public CYapfDestinationRailBase { class CYapfDestinationTileOrStationRailT : public CYapfDestinationRailBase {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
protected: protected:
TileIndex dest_tile; TileIndex dest_tile;

View File

@ -215,7 +215,7 @@ typedef CYapfRailNodeT<CYapfNodeKeyExitDir> CYapfRailNodeExitDir;
typedef CYapfRailNodeT<CYapfNodeKeyTrackDir> CYapfRailNodeTrackDir; typedef CYapfRailNodeT<CYapfNodeKeyTrackDir> CYapfRailNodeTrackDir;
/* Default NodeList types */ /* Default NodeList types */
typedef CNodeList_HashTableT<CYapfRailNodeExitDir , 8, 10> CRailNodeListExitDir; typedef NodeList<CYapfRailNodeExitDir , 8, 10> CRailNodeListExitDir;
typedef CNodeList_HashTableT<CYapfRailNodeTrackDir, 8, 10> CRailNodeListTrackDir; typedef NodeList<CYapfRailNodeTrackDir, 8, 10> CRailNodeListTrackDir;
#endif /* YAPF_NODE_RAIL_HPP */ #endif /* YAPF_NODE_RAIL_HPP */

View File

@ -36,7 +36,7 @@ typedef CYapfRoadNodeT<CYapfNodeKeyExitDir> CYapfRoadNodeExitDir;
typedef CYapfRoadNodeT<CYapfNodeKeyTrackDir> CYapfRoadNodeTrackDir; typedef CYapfRoadNodeT<CYapfNodeKeyTrackDir> CYapfRoadNodeTrackDir;
/* Default NodeList types */ /* Default NodeList types */
typedef CNodeList_HashTableT<CYapfRoadNodeExitDir , 8, 10> CRoadNodeListExitDir; typedef NodeList<CYapfRoadNodeExitDir , 8, 10> CRoadNodeListExitDir;
typedef CNodeList_HashTableT<CYapfRoadNodeTrackDir, 8, 10> CRoadNodeListTrackDir; typedef NodeList<CYapfRoadNodeTrackDir, 8, 10> CRoadNodeListTrackDir;
#endif /* YAPF_NODE_ROAD_HPP */ #endif /* YAPF_NODE_ROAD_HPP */

View File

@ -36,7 +36,7 @@ typedef CYapfShipNodeT<CYapfNodeKeyExitDir> CYapfShipNodeExitDir;
typedef CYapfShipNodeT<CYapfNodeKeyTrackDir> CYapfShipNodeTrackDir; typedef CYapfShipNodeT<CYapfNodeKeyTrackDir> CYapfShipNodeTrackDir;
/* Default NodeList types */ /* Default NodeList types */
typedef CNodeList_HashTableT<CYapfShipNodeExitDir , 10, 12> CShipNodeListExitDir; typedef NodeList<CYapfShipNodeExitDir , 10, 12> CShipNodeListExitDir;
typedef CNodeList_HashTableT<CYapfShipNodeTrackDir, 10, 12> CShipNodeListTrackDir; typedef NodeList<CYapfShipNodeTrackDir, 10, 12> CShipNodeListTrackDir;
#endif /* YAPF_NODE_SHIP_HPP */ #endif /* YAPF_NODE_SHIP_HPP */

View File

@ -36,9 +36,9 @@ template <class Types>
class CYapfReserveTrack class CYapfReserveTrack
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
protected: protected:
/** to access inherited pathfinder */ /** to access inherited pathfinder */
@ -203,10 +203,10 @@ template <class Types>
class CYapfFollowAnyDepotRailT class CYapfFollowAnyDepotRailT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
protected: protected:
/** to access inherited path finder */ /** to access inherited path finder */
@ -294,10 +294,10 @@ template <class Types>
class CYapfFollowAnySafeTileRailT : public CYapfReserveTrack<Types> class CYapfFollowAnySafeTileRailT : public CYapfReserveTrack<Types>
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
protected: protected:
/** to access inherited path finder */ /** to access inherited path finder */
@ -376,10 +376,10 @@ template <class Types>
class CYapfFollowRailT : public CYapfReserveTrack<Types> class CYapfFollowRailT : public CYapfReserveTrack<Types>
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
protected: protected:
/** to access inherited path finder */ /** to access inherited path finder */

View File

@ -21,8 +21,8 @@ class CYapfCostRoadT
public: public:
typedef typename Types::Tpf Tpf; ///< pathfinder (derived from THIS class) typedef typename Types::Tpf Tpf; ///< pathfinder (derived from THIS class)
typedef typename Types::TrackFollower TrackFollower; ///< track follower helper typedef typename Types::TrackFollower TrackFollower; ///< track follower helper
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
protected: protected:
int max_cost; int max_cost;
@ -187,10 +187,10 @@ template <class Types>
class CYapfDestinationAnyDepotRoadT class CYapfDestinationAnyDepotRoadT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
/** to access inherited path finder */ /** to access inherited path finder */
Tpf &Yapf() Tpf &Yapf()
@ -225,10 +225,10 @@ template <class Types>
class CYapfDestinationTileRoadT class CYapfDestinationTileRoadT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
protected: protected:
TileIndex dest_tile; TileIndex dest_tile;
@ -326,10 +326,10 @@ template <class Types>
class CYapfFollowRoadT class CYapfFollowRoadT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Types::NodeList::Item Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables typedef typename Node::Key Key; ///< key to hash tables
protected: protected:
/** to access inherited path finder */ /** to access inherited path finder */

View File

@ -28,10 +28,10 @@ template <class Types>
class CYapfDestinationTileWaterT class CYapfDestinationTileWaterT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class). typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class).
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< this will be our node type. typedef typename Types::NodeList::Item Node; ///< this will be our node type.
typedef typename Node::Key Key; ///< key to hash tables. typedef typename Node::Key Key; ///< key to hash tables.
protected: protected:
TileIndex dest_tile; TileIndex dest_tile;
@ -127,10 +127,10 @@ template <class Types>
class CYapfFollowShipT class CYapfFollowShipT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class). typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class).
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< this will be our node type. typedef typename Types::NodeList::Item Node; ///< this will be our node type.
typedef typename Node::Key Key; ///< key to hash tables. typedef typename Node::Key Key; ///< key to hash tables.
protected: protected:
/** to access inherited path finder */ /** to access inherited path finder */
@ -327,10 +327,10 @@ template <class Types>
class CYapfCostShipT class CYapfCostShipT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class). typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class).
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< this will be our node type. typedef typename Types::NodeList::Item Node; ///< this will be our node type.
typedef typename Node::Key Key; ///< key to hash tables. typedef typename Node::Key Key; ///< key to hash tables.
/** to access inherited path finder */ /** to access inherited path finder */
Tpf &Yapf() Tpf &Yapf()

View File

@ -89,9 +89,9 @@ template <class Types>
class CYapfOriginRegionT class CYapfOriginRegionT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class). typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class).
typedef typename Types::NodeList::Titem Node; ///< This will be our node type. typedef typename Types::NodeList::Item Node; ///< This will be our node type.
typedef typename Node::Key Key; ///< Key to hash tables. typedef typename Node::Key Key; ///< Key to hash tables.
protected: protected:
inline Tpf &Yapf() { return *static_cast<Tpf*>(this); } inline Tpf &Yapf() { return *static_cast<Tpf*>(this); }
@ -126,9 +126,9 @@ template <class Types>
class CYapfDestinationRegionT class CYapfDestinationRegionT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class). typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class).
typedef typename Types::NodeList::Titem Node; ///< This will be our node type. typedef typename Types::NodeList::Item Node; ///< This will be our node type.
typedef typename Node::Key Key; ///< Key to hash tables. typedef typename Node::Key Key; ///< Key to hash tables.
protected: protected:
Key dest; Key dest;
@ -166,10 +166,10 @@ template <class Types>
class CYapfFollowRegionT class CYapfFollowRegionT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class). typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class).
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< This will be our node type. typedef typename Types::NodeList::Item Node; ///< This will be our node type.
typedef typename Node::Key Key; ///< Key to hash tables. typedef typename Node::Key Key; ///< Key to hash tables.
protected: protected:
inline Tpf &Yapf() { return *static_cast<Tpf*>(this); } inline Tpf &Yapf() { return *static_cast<Tpf*>(this); }
@ -238,10 +238,10 @@ template <class Types>
class CYapfCostRegionT class CYapfCostRegionT
{ {
public: public:
typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class). typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class).
typedef typename Types::TrackFollower TrackFollower; typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList::Titem Node; ///< This will be our node type. typedef typename Types::NodeList::Item Node; ///< This will be our node type.
typedef typename Node::Key Key; ///< Key to hash tables. typedef typename Node::Key Key; ///< Key to hash tables.
protected: protected:
/** To access inherited path finder. */ /** To access inherited path finder. */
@ -293,7 +293,7 @@ struct CYapfRegion_TypesT
typedef CYapfCostRegionT<Types> PfCost; ///< Cost provider. typedef CYapfCostRegionT<Types> PfCost; ///< Cost provider.
}; };
typedef CNodeList_HashTableT<CYapfRegionNodeT<CYapfRegionPatchNodeKey>, 12, 12> CRegionNodeListWater; typedef NodeList<CYapfRegionNodeT<CYapfRegionPatchNodeKey>, 12, 12> CRegionNodeListWater;
struct CYapfRegionWater : CYapfT<CYapfRegion_TypesT<CYapfRegionWater, CRegionNodeListWater>> struct CYapfRegionWater : CYapfT<CYapfRegion_TypesT<CYapfRegionWater, CRegionNodeListWater>>
{ {