summaryrefslogtreecommitdiff
path: root/src/pathfinder/npf
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-10-02 19:38:22 +0000
committeralberth <alberth@openttd.org>2010-10-02 19:38:22 +0000
commit6ea5643e400f8a18059ba74c2f2fd319389a6440 (patch)
tree6edf61071fabf784fb06bcb2f0a59eecee15529c /src/pathfinder/npf
parenta7ffc9a268c74e7daed1ffe895f696b1a8727466 (diff)
downloadopenttd-6ea5643e400f8a18059ba74c2f2fd319389a6440.tar.xz
(svn r20880) -Codechange: Make Hash_Size a method.
Diffstat (limited to 'src/pathfinder/npf')
-rw-r--r--src/pathfinder/npf/aystar.cpp2
-rw-r--r--src/pathfinder/npf/queue.cpp5
-rw-r--r--src/pathfinder/npf/queue.h12
3 files changed, 9 insertions, 10 deletions
diff --git a/src/pathfinder/npf/aystar.cpp b/src/pathfinder/npf/aystar.cpp
index 60b3c05d2..01057ea73 100644
--- a/src/pathfinder/npf/aystar.cpp
+++ b/src/pathfinder/npf/aystar.cpp
@@ -182,7 +182,7 @@ int AyStar::Loop()
/* Free the node */
free(current);
- if (this->max_search_nodes != 0 && Hash_Size(&this->ClosedListHash) >= this->max_search_nodes) {
+ if (this->max_search_nodes != 0 && this->ClosedListHash.GetSize() >= this->max_search_nodes) {
/* We've expanded enough nodes */
return AYSTAR_LIMIT_REACHED;
} else {
diff --git a/src/pathfinder/npf/queue.cpp b/src/pathfinder/npf/queue.cpp
index 0edac387f..f1ac7af36 100644
--- a/src/pathfinder/npf/queue.cpp
+++ b/src/pathfinder/npf/queue.cpp
@@ -511,8 +511,3 @@ void *Hash_Get(const Hash *h, uint key1, uint key2)
#endif
return (node != NULL) ? node->value : NULL;
}
-
-uint Hash_Size(const Hash *h)
-{
- return h->size;
-}
diff --git a/src/pathfinder/npf/queue.h b/src/pathfinder/npf/queue.h
index 897351ae6..92509fdb5 100644
--- a/src/pathfinder/npf/queue.h
+++ b/src/pathfinder/npf/queue.h
@@ -85,6 +85,14 @@ struct Hash {
/* A pointer to an array of numbuckets booleans, which will be true if
* there are any Nodes in the bucket */
bool *buckets_in_use;
+
+ /**
+ * Gets the current size of the hash.
+ */
+ uint FORCEINLINE GetSize() const
+ {
+ return this->size;
+ }
};
/* Call these function to manipulate a hash */
@@ -123,9 +131,5 @@ void delete_Hash(Hash *h, bool free_values);
* Cleans the hash, but keeps the memory allocated
*/
void clear_Hash(Hash *h, bool free_values);
-/**
- * Gets the current size of the Hash
- */
-uint Hash_Size(const Hash *h);
#endif /* QUEUE_H */