diff options
author | alberth <alberth@openttd.org> | 2010-10-02 19:31:24 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-10-02 19:31:24 +0000 |
commit | 5e636d6a5c45f2fb1fa6a86fef2e2af2fe4a5b14 (patch) | |
tree | 2005af50160bbbd8f491d2005b68ad4c802937e7 /src | |
parent | 969139b34399e44aa8f6a44a96e3f38d37e1dd38 (diff) | |
download | openttd-5e636d6a5c45f2fb1fa6a86fef2e2af2fe4a5b14.tar.xz |
(svn r20876) -Codechange: Make AyStarMain_OpenList_Pop a method.
Diffstat (limited to 'src')
-rw-r--r-- | src/pathfinder/npf/aystar.cpp | 8 | ||||
-rw-r--r-- | src/pathfinder/npf/aystar.h | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/pathfinder/npf/aystar.cpp b/src/pathfinder/npf/aystar.cpp index 58f8af920..92c455d67 100644 --- a/src/pathfinder/npf/aystar.cpp +++ b/src/pathfinder/npf/aystar.cpp @@ -56,12 +56,12 @@ static OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, const AyStarNo /* Gets the best node from OpenList * returns the best node, or NULL of none is found * 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. */ - OpenListNode *res = (OpenListNode*)aystar->OpenListQueue.Pop(); + OpenListNode *res = (OpenListNode*)this->OpenListQueue.Pop(); 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; @@ -154,7 +154,7 @@ int AyStar::Loop() int i; /* Get the best node from OpenList */ - OpenListNode *current = AyStarMain_OpenList_Pop(this); + OpenListNode *current = this->OpenListPop(); /* If empty, drop an error */ if (current == NULL) return AYSTAR_EMPTY_OPENLIST; diff --git a/src/pathfinder/npf/aystar.h b/src/pathfinder/npf/aystar.h index 027fdb12c..a3662d847 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 *OpenListPop(); }; #endif /* AYSTAR_H */ |