summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-10-02 19:34:32 +0000
committeralberth <alberth@openttd.org>2010-10-02 19:34:32 +0000
commita7ffc9a268c74e7daed1ffe895f696b1a8727466 (patch)
tree719bbb2beb50f1654cf317c4f60e6a30f2da53af
parent4f8af5d3360d5d5c180063e2e2fad2b6e746ae9f (diff)
downloadopenttd-a7ffc9a268c74e7daed1ffe895f696b1a8727466.tar.xz
(svn r20879) -Codechange: Make AyStarMain_ClosedList_IsInList a method.
-rw-r--r--src/pathfinder/npf/aystar.cpp8
-rw-r--r--src/pathfinder/npf/aystar.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/src/pathfinder/npf/aystar.cpp b/src/pathfinder/npf/aystar.cpp
index 0af74d2bc..60b3c05d2 100644
--- a/src/pathfinder/npf/aystar.cpp
+++ b/src/pathfinder/npf/aystar.cpp
@@ -31,9 +31,9 @@
/* This looks in the Hash if a node exists in ClosedList
* If so, it returns the PathNode, else NULL */
-static PathNode *AyStarMain_ClosedList_IsInList(AyStar *aystar, const AyStarNode *node)
+PathNode *AyStar::ClosedListIsInList(const AyStarNode *node)
{
- return (PathNode*)Hash_Get(&aystar->ClosedListHash, node->tile, node->direction);
+ return (PathNode*)Hash_Get(&this->ClosedListHash, node->tile, node->direction);
}
/* This adds a node to the ClosedList
@@ -92,7 +92,7 @@ void AyStar::CheckTile(AyStarNode *current, OpenListNode *parent)
OpenListNode *check;
/* Check the new node against the ClosedList */
- if (AyStarMain_ClosedList_IsInList(this, current) != NULL) return;
+ if (this->ClosedListIsInList(current) != NULL) return;
/* Calculate the G-value for this node */
new_g = this->CalculateG(this, current, parent);
@@ -114,7 +114,7 @@ void AyStar::CheckTile(AyStarNode *current, OpenListNode *parent)
new_f = new_g + new_h;
/* Get the pointer to the parent in the ClosedList (the currentone is to a copy of the one in the OpenList) */
- closedlist_parent = AyStarMain_ClosedList_IsInList(this, &parent->path.node);
+ closedlist_parent = this->ClosedListIsInList(&parent->path.node);
/* Check if this item is already in the OpenList */
check = this->OpenListIsInList(current);
diff --git a/src/pathfinder/npf/aystar.h b/src/pathfinder/npf/aystar.h
index 152af1b41..38101cc91 100644
--- a/src/pathfinder/npf/aystar.h
+++ b/src/pathfinder/npf/aystar.h
@@ -165,6 +165,7 @@ struct AyStar {
OpenListNode *OpenListPop();
void ClosedListAdd(const PathNode *node);
+ PathNode *ClosedListIsInList(const AyStarNode *node);
};
#endif /* AYSTAR_H */