Changeset - r16168:2f238bf05ef6
[Not reviewed]
master
0 2 0
alberth - 14 years ago 2010-10-02 19:33:23
alberth@openttd.org
(svn r20878) -Codechange: Make AyStarMain_ClosedList_Add a method.
2 files changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/pathfinder/npf/aystar.cpp
Show inline comments
 
@@ -38,12 +38,12 @@ static PathNode *AyStarMain_ClosedList_I
 

	
 
/* This adds a node to the ClosedList
 
 *  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 */
 
	PathNode *new_node = MallocT<PathNode>(1);
 
	*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
 
@@ -168,7 +168,7 @@ int AyStar::Loop()
 
	}
 

	
 
	/* Add the node to the ClosedList */
 
	AyStarMain_ClosedList_Add(this, &current->path);
 
	this->ClosedListAdd(&current->path);
 

	
 
	/* Load the neighbours */
 
	this->GetNeighbours(this, current);
src/pathfinder/npf/aystar.h
Show inline comments
 
@@ -163,6 +163,8 @@ struct AyStar {
 
	void OpenListAdd(PathNode *parent, const AyStarNode *node, int f, int g);
 
	OpenListNode *OpenListIsInList(const AyStarNode *node);
 
	OpenListNode *OpenListPop();
 

	
 
	void ClosedListAdd(const PathNode *node);
 
};
 

	
 
#endif /* AYSTAR_H */
0 comments (0 inline, 0 general)