summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pathfinder/npf/aystar.cpp4
-rw-r--r--src/pathfinder/npf/queue.cpp8
-rw-r--r--src/pathfinder/npf/queue.h7
3 files changed, 10 insertions, 9 deletions
diff --git a/src/pathfinder/npf/aystar.cpp b/src/pathfinder/npf/aystar.cpp
index 01057ea73..571754002 100644
--- a/src/pathfinder/npf/aystar.cpp
+++ b/src/pathfinder/npf/aystar.cpp
@@ -33,7 +33,7 @@
* If so, it returns the PathNode, else NULL */
PathNode *AyStar::ClosedListIsInList(const AyStarNode *node)
{
- return (PathNode*)Hash_Get(&this->ClosedListHash, node->tile, node->direction);
+ return (PathNode*)this->ClosedListHash.Get(node->tile, node->direction);
}
/* This adds a node to the ClosedList
@@ -50,7 +50,7 @@ void AyStar::ClosedListAdd(const PathNode *node)
* If so, it returns the OpenListNode, else NULL */
OpenListNode *AyStar::OpenListIsInList(const AyStarNode *node)
{
- return (OpenListNode*)Hash_Get(&this->OpenListHash, node->tile, node->direction);
+ return (OpenListNode*)this->OpenListHash.Get(node->tile, node->direction);
}
/* Gets the best node from OpenList
diff --git a/src/pathfinder/npf/queue.cpp b/src/pathfinder/npf/queue.cpp
index f1ac7af36..473f50c70 100644
--- a/src/pathfinder/npf/queue.cpp
+++ b/src/pathfinder/npf/queue.cpp
@@ -502,9 +502,13 @@ void *Hash_Set(Hash *h, uint key1, uint key2, void *value)
return NULL;
}
-void *Hash_Get(const Hash *h, uint key1, uint key2)
+/**
+ * Gets the value associated with the given key pair, or NULL when it is not
+ * present.
+ */
+void *Hash::Get(uint key1, uint key2) const
{
- HashNode *node = Hash_FindNode(h, key1, key2, NULL);
+ HashNode *node = Hash_FindNode(this, key1, key2, NULL);
#ifdef HASH_DEBUG
debug("Found node: %p", node);
diff --git a/src/pathfinder/npf/queue.h b/src/pathfinder/npf/queue.h
index 92509fdb5..6d42bae92 100644
--- a/src/pathfinder/npf/queue.h
+++ b/src/pathfinder/npf/queue.h
@@ -86,6 +86,8 @@ struct Hash {
* there are any Nodes in the bucket */
bool *buckets_in_use;
+ void *Get(uint key1, uint key2) const;
+
/**
* Gets the current size of the hash.
*/
@@ -108,11 +110,6 @@ void *Hash_Delete(Hash *h, uint key1, uint key2);
* Returns the old value if the value was replaced, NULL when it was not yet present.
*/
void *Hash_Set(Hash *h, uint key1, uint key2, void *value);
-/**
- * Gets the value associated with the given key pair, or NULL when it is not
- * present.
- */
-void *Hash_Get(const Hash *h, uint key1, uint key2);
/* Call these function to create/destroy a hash */