1
0
Fork 0

(svn r20879) -Codechange: Make AyStarMain_ClosedList_IsInList a method.

release/1.1
alberth 2010-10-02 19:34:32 +00:00
parent 4f8af5d336
commit a7ffc9a268
2 changed files with 5 additions and 4 deletions

View File

@ -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);

View File

@ -165,6 +165,7 @@ struct AyStar {
OpenListNode *OpenListPop();
void ClosedListAdd(const PathNode *node);
PathNode *ClosedListIsInList(const AyStarNode *node);
};
#endif /* AYSTAR_H */