From a7ffc9a268c74e7daed1ffe895f696b1a8727466 Mon Sep 17 00:00:00 2001 From: alberth Date: Sat, 2 Oct 2010 19:34:32 +0000 Subject: (svn r20879) -Codechange: Make AyStarMain_ClosedList_IsInList a method. --- src/pathfinder/npf/aystar.cpp | 8 ++++---- src/pathfinder/npf/aystar.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/pathfinder') 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 */ -- cgit v1.2.3-54-g00ecf