本文整理汇总了C++中AStarNode::mark_for_deletion方法的典型用法代码示例。如果您正苦于以下问题:C++ AStarNode::mark_for_deletion方法的具体用法?C++ AStarNode::mark_for_deletion怎么用?C++ AStarNode::mark_for_deletion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AStarNode
的用法示例。
在下文中一共展示了AStarNode::mark_for_deletion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: delete_node
/*
* Remove a parent from a node and delete it if it runs out of parents
* @param pos: The position of the node to remove
* @param parent_pos: The parent of the position to remove
* (only remove a position/parent combo)
* @param del_mem: True if the node should be deleted here, false if it should
* simply be marked for deletion (so the OPEN list heap does not contain deleted nodes)
* @return 0 if the node is not found,
* 1 if it is found but not deleted, 2 if it is found and deleted
*/
int AStarNodeList::delete_node(Position* pos, Coord* parent_coord, bool del_mem)
{
/* Find the node iterator */
AStarNode* found = list->find(pos);
/* Make sure the node exists */
if (found == NULL)
return 0;
/* If the node has no more parents after the deletion of this parent */
if (found->del_parent(parent_coord) == 0)
{
/* Position check = Position(0, 5, 5);
if (check == *pos)
{
std::cout << "PRE DELETION" << std::endl;
print_list();
}*/
/* remove it from the list */
list->erase(pos);
/* Delete the node pointed to by the list or mark it for deletion */
if (del_mem == true)
delete found;
else
found->mark_for_deletion();
/*
if (check == *pos)
{
std::cout << "POST DELETION" << std::endl;
print_list();
}
*/
return 2;
}
/* The node was found but not deleted */
return 1;
}