diff options
author | alberth <alberth@openttd.org> | 2010-10-02 19:33:23 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-10-02 19:33:23 +0000 |
commit | 4f8af5d3360d5d5c180063e2e2fad2b6e746ae9f (patch) | |
tree | 8cf1195943e6ae474872235eba3fd2029810028f /src/pathfinder/npf | |
parent | fa661e4075e9c52840900b4b3837cba71149f358 (diff) | |
download | openttd-4f8af5d3360d5d5c180063e2e2fad2b6e746ae9f.tar.xz |
(svn r20878) -Codechange: Make AyStarMain_ClosedList_Add a method.
Diffstat (limited to 'src/pathfinder/npf')
-rw-r--r-- | src/pathfinder/npf/aystar.cpp | 6 | ||||
-rw-r--r-- | src/pathfinder/npf/aystar.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/pathfinder/npf/aystar.cpp b/src/pathfinder/npf/aystar.cpp index 66f434366..0af74d2bc 100644 --- a/src/pathfinder/npf/aystar.cpp +++ b/src/pathfinder/npf/aystar.cpp @@ -38,12 +38,12 @@ static PathNode *AyStarMain_ClosedList_IsInList(AyStar *aystar, const AyStarNode /* This adds a node to the ClosedList * It makes a copy of the data */ -static void AyStarMain_ClosedList_Add(AyStar *aystar, const PathNode *node) +void AyStar::ClosedListAdd(const PathNode *node) { /* Add a node to the ClosedList */ PathNode *new_node = MallocT<PathNode>(1); *new_node = *node; - Hash_Set(&aystar->ClosedListHash, node->node.tile, node->node.direction, new_node); + Hash_Set(&this->ClosedListHash, node->node.tile, node->node.direction, new_node); } /* Checks if a node is in the OpenList @@ -168,7 +168,7 @@ int AyStar::Loop() } /* Add the node to the ClosedList */ - AyStarMain_ClosedList_Add(this, ¤t->path); + this->ClosedListAdd(¤t->path); /* Load the neighbours */ this->GetNeighbours(this, current); diff --git a/src/pathfinder/npf/aystar.h b/src/pathfinder/npf/aystar.h index c5f433a7a..152af1b41 100644 --- a/src/pathfinder/npf/aystar.h +++ b/src/pathfinder/npf/aystar.h @@ -163,6 +163,8 @@ struct AyStar { void OpenListAdd(PathNode *parent, const AyStarNode *node, int f, int g); OpenListNode *OpenListIsInList(const AyStarNode *node); OpenListNode *OpenListPop(); + + void ClosedListAdd(const PathNode *node); }; #endif /* AYSTAR_H */ |