mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r20878) -Codechange: Make AyStarMain_ClosedList_Add a method.
This commit is contained in:
parent
b06c08cfc4
commit
04b0671343
@ -38,12 +38,12 @@ static PathNode *AyStarMain_ClosedList_IsInList(AyStar *aystar, const AyStarNode
|
|||||||
|
|
||||||
/* This adds a node to the ClosedList
|
/* This adds a node to the ClosedList
|
||||||
* It makes a copy of the data */
|
* It makes a copy of the data */
|
||||||
static void AyStarMain_ClosedList_Add(AyStar *aystar, const PathNode *node)
|
void AyStar::ClosedListAdd(const PathNode *node)
|
||||||
{
|
{
|
||||||
/* Add a node to the ClosedList */
|
/* Add a node to the ClosedList */
|
||||||
PathNode *new_node = MallocT<PathNode>(1);
|
PathNode *new_node = MallocT<PathNode>(1);
|
||||||
*new_node = *node;
|
*new_node = *node;
|
||||||
Hash_Set(&aystar->ClosedListHash, node->node.tile, node->node.direction, new_node);
|
Hash_Set(&this->ClosedListHash, node->node.tile, node->node.direction, new_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checks if a node is in the OpenList
|
/* Checks if a node is in the OpenList
|
||||||
@ -168,7 +168,7 @@ int AyStar::Loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add the node to the ClosedList */
|
/* Add the node to the ClosedList */
|
||||||
AyStarMain_ClosedList_Add(this, ¤t->path);
|
this->ClosedListAdd(¤t->path);
|
||||||
|
|
||||||
/* Load the neighbours */
|
/* Load the neighbours */
|
||||||
this->GetNeighbours(this, current);
|
this->GetNeighbours(this, current);
|
||||||
|
@ -163,6 +163,8 @@ struct AyStar {
|
|||||||
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 *OpenListIsInList(const AyStarNode *node);
|
||||||
OpenListNode *OpenListPop();
|
OpenListNode *OpenListPop();
|
||||||
|
|
||||||
|
void ClosedListAdd(const PathNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* AYSTAR_H */
|
#endif /* AYSTAR_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user