mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r20877) -Codechange: Make AyStarMain_OpenList_IsInList a method.
This commit is contained in:
parent
a71d4cae11
commit
b06c08cfc4
@ -48,9 +48,9 @@ static void AyStarMain_ClosedList_Add(AyStar *aystar, const PathNode *node)
|
|||||||
|
|
||||||
/* Checks if a node is in the OpenList
|
/* Checks if a node is in the OpenList
|
||||||
* If so, it returns the OpenListNode, else NULL */
|
* If so, it returns the OpenListNode, else NULL */
|
||||||
static OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, const AyStarNode *node)
|
OpenListNode *AyStar::OpenListIsInList(const AyStarNode *node)
|
||||||
{
|
{
|
||||||
return (OpenListNode*)Hash_Get(&aystar->OpenListHash, node->tile, node->direction);
|
return (OpenListNode*)Hash_Get(&this->OpenListHash, node->tile, node->direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gets the best node from OpenList
|
/* Gets the best node from OpenList
|
||||||
@ -117,7 +117,7 @@ void AyStar::CheckTile(AyStarNode *current, OpenListNode *parent)
|
|||||||
closedlist_parent = AyStarMain_ClosedList_IsInList(this, &parent->path.node);
|
closedlist_parent = AyStarMain_ClosedList_IsInList(this, &parent->path.node);
|
||||||
|
|
||||||
/* Check if this item is already in the OpenList */
|
/* Check if this item is already in the OpenList */
|
||||||
check = AyStarMain_OpenList_IsInList(this, current);
|
check = this->OpenListIsInList(current);
|
||||||
if (check != NULL) {
|
if (check != NULL) {
|
||||||
uint i;
|
uint i;
|
||||||
/* Yes, check if this g value is lower.. */
|
/* Yes, check if this g value is lower.. */
|
||||||
|
@ -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 *OpenListIsInList(const AyStarNode *node);
|
||||||
OpenListNode *OpenListPop();
|
OpenListNode *OpenListPop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user