(svn r20876) -Codechange: Make AyStarMain_OpenList_Pop a method.

pull/155/head
alberth 14 years ago
parent 7ed89d50d3
commit a71d4cae11

@ -56,12 +56,12 @@ static OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, const AyStarNo
/* Gets the best node from OpenList /* Gets the best node from OpenList
* returns the best node, or NULL of none is found * returns the best node, or NULL of none is found
* Also it deletes the node from the OpenList */ * Also it deletes the node from the OpenList */
static OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar) OpenListNode *AyStar::OpenListPop()
{ {
/* Return the item the Queue returns.. the best next OpenList item. */ /* Return the item the Queue returns.. the best next OpenList item. */
OpenListNode *res = (OpenListNode*)aystar->OpenListQueue.Pop(); OpenListNode *res = (OpenListNode*)this->OpenListQueue.Pop();
if (res != NULL) { if (res != NULL) {
Hash_Delete(&aystar->OpenListHash, res->path.node.tile, res->path.node.direction); Hash_Delete(&this->OpenListHash, res->path.node.tile, res->path.node.direction);
} }
return res; return res;
@ -154,7 +154,7 @@ int AyStar::Loop()
int i; int i;
/* Get the best node from OpenList */ /* Get the best node from OpenList */
OpenListNode *current = AyStarMain_OpenList_Pop(this); OpenListNode *current = this->OpenListPop();
/* If empty, drop an error */ /* If empty, drop an error */
if (current == NULL) return AYSTAR_EMPTY_OPENLIST; if (current == NULL) return AYSTAR_EMPTY_OPENLIST;

@ -161,6 +161,7 @@ struct AyStar {
Hash OpenListHash; Hash OpenListHash;
void OpenListAdd(PathNode *parent, const AyStarNode *node, int f, int g); void OpenListAdd(PathNode *parent, const AyStarNode *node, int f, int g);
OpenListNode *OpenListPop();
}; };
#endif /* AYSTAR_H */ #endif /* AYSTAR_H */

Loading…
Cancel
Save