本文整理汇总了C++中CNavigator::NodesAreNeighbors方法的典型用法代码示例。如果您正苦于以下问题:C++ CNavigator::NodesAreNeighbors方法的具体用法?C++ CNavigator::NodesAreNeighbors怎么用?C++ CNavigator::NodesAreNeighbors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNavigator
的用法示例。
在下文中一共展示了CNavigator::NodesAreNeighbors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
}
else
{//blocked by ent!
if ( setBlockedInfo )
{
self->NPC->aiFlags |= NPCAI_BLOCKED;
navigator.GetNodePosition( bestNode, NPCInfo->blockedDest );
}
//Only set blocked info first time
setBlockedInfo = qfalse;
if ( inGoalWP )
{//we headed for our goal and failed and our goal's WP and failed
if ( self->waypoint == self->NPC->goalEntity->waypoint )
{//our waypoint is our goal's waypoint, nothing we can do
//remember that this node is blocked
navigator.AddFailedNode( self, self->waypoint );
goto failed;
}
else
{//try going for our waypoint this time
//goalWPFailed = qtrue;
inGoalWP = qfalse;
}
}
else if ( bestNode != self->waypoint )
{//we headed toward our next waypoint (instead of our waypoint) and failed
if ( d_altRoutes->integer )
{//mark this edge failed and try our waypoint
//NOTE: don't assume there is something blocking the direct path
// between my waypoint and the bestNode... I could be off
// that path because of collision avoidance...
if ( d_patched->integer &&//use patch-style navigation
( !navigator.NodesAreNeighbors( self->waypoint, bestNode )
|| NAVNEW_TestNodeConnectionBlocked( self->waypoint, bestNode, self, self->NPC->goalEntity->s.number, qfalse, qtrue ) ) )
{//the direct path between these 2 nodes is blocked by an ent
navigator.AddFailedEdge( self->s.number, self->waypoint, bestNode );
}
bestNode = self->waypoint;
}
else
{
//we should stop
goto failed;
}
}
else
{//we headed for *our* waypoint and couldn't get to it
if ( d_altRoutes->integer )
{
//remember that this node is blocked
navigator.AddFailedNode( self, self->waypoint );
//Now we should get our waypoints again
//FIXME: cache the trace-data for subsequent calls as only the route info would have changed
//if ( (bestNode = navigator.GetBestPathBetweenEnts( self, self->NPC->goalEntity, NF_CLEAR_PATH )) == NODE_NONE )//!NAVNEW_GetWaypoints( self, qfalse ) )
{//one of our waypoints is WAYPOINT_NONE now
goto failed;
}
}
else
{
//we should stop
goto failed;
}
}