summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-10-02 19:32:21 +0000
committeralberth <alberth@openttd.org>2010-10-02 19:32:21 +0000
commitfa661e4075e9c52840900b4b3837cba71149f358 (patch)
tree36601d03914ea97101e15399bbd52d370bc23a17 /src
parent5e636d6a5c45f2fb1fa6a86fef2e2af2fe4a5b14 (diff)
downloadopenttd-fa661e4075e9c52840900b4b3837cba71149f358.tar.xz
(svn r20877) -Codechange: Make AyStarMain_OpenList_IsInList a method.
Diffstat (limited to 'src')
-rw-r--r--src/pathfinder/npf/aystar.cpp6
-rw-r--r--src/pathfinder/npf/aystar.h1
2 files changed, 4 insertions, 3 deletions
diff --git a/src/pathfinder/npf/aystar.cpp b/src/pathfinder/npf/aystar.cpp
index 92c455d67..66f434366 100644
--- a/src/pathfinder/npf/aystar.cpp
+++ b/src/pathfinder/npf/aystar.cpp
@@ -48,9 +48,9 @@ static void AyStarMain_ClosedList_Add(AyStar *aystar, const PathNode *node)
/* Checks if a node is in the OpenList
* If so, it returns the OpenListNode, else NULL */
-static OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, const AyStarNode *node)
+OpenListNode *AyStar::OpenListIsInList(const AyStarNode *node)
{
- return (OpenListNode*)Hash_Get(&aystar->OpenListHash, node->tile, node->direction);
+ return (OpenListNode*)Hash_Get(&this->OpenListHash, node->tile, node->direction);
}
/* Gets the best node from OpenList
@@ -117,7 +117,7 @@ void AyStar::CheckTile(AyStarNode *current, OpenListNode *parent)
closedlist_parent = AyStarMain_ClosedList_IsInList(this, &parent->path.node);
/* Check if this item is already in the OpenList */
- check = AyStarMain_OpenList_IsInList(this, current);
+ check = this->OpenListIsInList(current);
if (check != NULL) {
uint i;
/* Yes, check if this g value is lower.. */
diff --git a/src/pathfinder/npf/aystar.h b/src/pathfinder/npf/aystar.h
index a3662d847..c5f433a7a 100644
--- a/src/pathfinder/npf/aystar.h
+++ b/src/pathfinder/npf/aystar.h
@@ -161,6 +161,7 @@ struct AyStar {
Hash OpenListHash;
void OpenListAdd(PathNode *parent, const AyStarNode *node, int f, int g);
+ OpenListNode *OpenListIsInList(const AyStarNode *node);
OpenListNode *OpenListPop();
};