mirror of https://github.com/OpenTTD/OpenTTD
(svn r20880) -Codechange: Make Hash_Size a method.
parent
a7ffc9a268
commit
6ea5643e40
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue