diff options
author | alberth <alberth@openttd.org> | 2010-10-02 19:29:00 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-10-02 19:29:00 +0000 |
commit | 9b21dfaeb0183d6e7813480d04e371827b1a073d (patch) | |
tree | e33a67b04e79f476ffb512b7cf7b45d5d58f3a0d /src/pathfinder/npf/aystar.cpp | |
parent | a8af2c97c1921fd6b87c8120d389052c261b6e17 (diff) | |
download | openttd-9b21dfaeb0183d6e7813480d04e371827b1a073d.tar.xz |
(svn r20874) -Codechange: Make init_AyStar a method.
Diffstat (limited to 'src/pathfinder/npf/aystar.cpp')
-rw-r--r-- | src/pathfinder/npf/aystar.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/pathfinder/npf/aystar.cpp b/src/pathfinder/npf/aystar.cpp index b563a20d2..951ce9f32 100644 --- a/src/pathfinder/npf/aystar.cpp +++ b/src/pathfinder/npf/aystar.cpp @@ -277,15 +277,20 @@ void AyStar::AddStartNode(AyStarNode *start_node, uint g) AyStarMain_OpenList_Add(this, NULL, start_node, 0, g); } -void init_AyStar(AyStar *aystar, Hash_HashProc hash, uint num_buckets) +/** + * Initialize an #AyStar. You should fill all appropriate fields before + * calling #Init (see the declaration of #AyStar for which fields are + * internal. + */ +void AyStar::Init(Hash_HashProc hash, uint num_buckets) { /* Allocated the Hash for the OpenList and ClosedList */ - init_Hash(&aystar->OpenListHash, hash, num_buckets); - init_Hash(&aystar->ClosedListHash, hash, num_buckets); + init_Hash(&this->OpenListHash, hash, num_buckets); + init_Hash(&this->ClosedListHash, hash, num_buckets); /* Set up our sorting queue * BinaryHeap allocates a block of 1024 nodes * When that one gets full it reserves another one, till this number * That is why it can stay this high */ - aystar->OpenListQueue.Init(102400); + this->OpenListQueue.Init(102400); } |