亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? navigate.h

?? this keik game source
?? H
?? 第 1 頁 / 共 2 頁
字號:
EXPORT_FROM_DLL void PathFinder<Heuristic>::ClearCLOSED
	(
	void
	)

	{
	PathNode *node;

	while( CLOSED )
		{
		node = CLOSED;
		CLOSED = node->NextNode;

		node->inlist = NOT_IN_LIST;
		node->NextNode = NULL;
		node->Parent = NULL;

		// reject is used to indicate that a node is unfit for ending on during a search
		node->reject = false;
		}
	}

template <class Heuristic>
EXPORT_FROM_DLL void PathFinder<Heuristic>::ClearPath
	(
	void
	)

	{
	stack.Clear();
	ClearOPEN();
	ClearCLOSED();
	}

template <class Heuristic>
EXPORT_FROM_DLL Path *PathFinder<Heuristic>::FindPath
	(
	PathNode *from, 
	PathNode *to
	)

	{
	Path		*path;
	PathNode	*node;
   int start;
   int end;
   qboolean checktime;

   checktime = false;
   if ( ai_timepaths->value )
      {
      start = G_Milliseconds();
      checktime = true;
      }

	OPEN   = NULL;
	CLOSED = NULL;

	endnode = to;

	// Should always be NULL at this point
	assert( !from->NextNode );

	// make Open List point to first node 
	OPEN = from;
	from->g = 0;
	from->h = heuristic.dist( from, endnode );
	from->NextNode = NULL;

	node = ReturnBestNode();
	while( node && !heuristic.done( node, endnode ) )
		{
		GenerateSuccessors( node );
		node = ReturnBestNode();
		}

	if ( !node )
		{
		path = NULL;
		if ( ai_debugpath->value )
			{
			gi.dprintf( "Search failed--no path found.\n" );
			}
		}
	else
		{
		path = CreatePath( node );
		}

	ClearPath();

   if ( checktime )
      {
      end = G_Milliseconds();
      if ( ai_timepaths->value <= ( end - start ) )
         {
         G_DebugPrintf( "%d: ent #%d : %d\n", level.framenum, heuristic.entnum, end - start );
         }
      }

	return path;
	}

template <class Heuristic>
EXPORT_FROM_DLL Path *PathFinder<Heuristic>::FindPath
	(
	Vector start,
	Vector end
	)

	{
	PathNode *from;
	PathNode *to;
   Entity *ent;

   ent = G_GetEntity( heuristic.entnum );
	from = PathManager.NearestNode( start, ent );
	to = PathManager.NearestNode( end, ent );

	if ( !from )
		{
		if ( ai_debugpath->value )
			{
			gi.dprintf( "Search failed--couldn't find closest source.\n" );
			}
		return NULL;
		}

	if ( !from || !to )
		{
		if ( ai_debugpath->value )
			{
			gi.dprintf( "Search failed--couldn't find closest destination.\n" );
			}
		return NULL;
		}

	return FindPath( from, to );
	}

template <class Heuristic>
EXPORT_FROM_DLL Path *PathFinder<Heuristic>::CreatePath
	(
	PathNode *startnode
	)

	{
	PathNode *node;
	Path *p;
	int	i;
	int	n;
	PathNode *reverse[ MAX_PATH_LENGTH ];

	// unfortunately, the list goes goes from end to start, so we have to reverse it
	for( node = startnode, n = 0; ( node != NULL ) && ( n < MAX_PATH_LENGTH ); node = node->Parent, n++ )
		{
		assert( n < MAX_PATH_LENGTH );
		reverse[ n ] = node;
		}

	p = new Path( n );
	for( i = n - 1; i >= 0; i-- )
		{
		p->AddNode( reverse[ i ] );
		}

	if ( ai_debugpath->value )
		{
		gi.dprintf( "%d nodes in path\n", n );
		gi.dprintf( "%d nodes allocated\n", PathManager.NumNodes() );
		}

	return p;
	}

template <class Heuristic>
EXPORT_FROM_DLL PathNode *PathFinder<Heuristic>::ReturnBestNode
	(
	void
	)

	{
	PathNode *bestnode;

	if ( !OPEN )
		{
		// No more nodes on OPEN
		return NULL;
		}

	// Pick node with lowest f, in this case it's the first node in list
	// because we sort the OPEN list wrt lowest f. Call it BESTNODE. 

	bestnode = OPEN;					// point to first node on OPEN
	OPEN = bestnode->NextNode;		// Make OPEN point to nextnode or NULL.

	// Next take BESTNODE (or temp in this case) and put it on CLOSED
	bestnode->NextNode	= CLOSED;
	CLOSED					= bestnode;

	bestnode->inlist = IN_CLOSED;

	return( bestnode );
	}

template <class Heuristic>
EXPORT_FROM_DLL void PathFinder<Heuristic>::GenerateSuccessors
	(
	PathNode *BestNode
	)

	{
	int			i;
	int			g;					// total path cost - as stored in the linked lists.
	PathNode		*node;
	pathway_t	*path;

	for( i = 0; i < BestNode->numChildren; i++ )
		{
		path = &BestNode->Child[ i ];
		node = AI_GetNode( path->node );

		// g(Successor)=g(BestNode)+cost of getting from BestNode to Successor 
		g = BestNode->g + heuristic.cost( BestNode, i );

		switch( node->inlist )
			{
			case NOT_IN_LIST :
				// Only allow this if it's valid
				if ( heuristic.validpath( BestNode, i ) )
					{
					node->Parent	= BestNode;
					node->g			= g;
					node->h			= heuristic.dist( node, endnode );
					node->f			= g + node->h;

					// Insert Successor on OPEN list wrt f
					Insert( node );
					}
				break;

			case IN_OPEN :
				// if our new g value is < node's then reset node's parent to point to BestNode
    			if ( g < node->g )
    				{
    				node->Parent	= BestNode;
    				node->g			= g;
    				node->f			= g + node->h;
    				}
				break;

			case IN_CLOSED :
				// if our new g value is < Old's then reset Old's parent to point to BestNode
    			if ( g < node->g )
    				{
    				node->Parent	= BestNode;
    				node->g			= g;
    				node->f			= g + node->h;

					// Since we changed the g value of Old, we need
    				// to propagate this new value downwards, i.e.
    				// do a Depth-First traversal of the tree!
    				PropagateDown( node );
    				}
				break;

			default :
				// shouldn't happen, but try to catch it during debugging phase
				assert( NULL );
				gi.error( "Corrupted path node" );
				break;
			}
		}
	}

template <class Heuristic>
EXPORT_FROM_DLL void PathFinder<Heuristic>::Insert
	(
	PathNode *node
	)

	{
	PathNode *prev;
	PathNode *next;
	int		f;

	node->inlist = IN_OPEN;
	f = node->f;

	// special case for if the list is empty, or it should go at head of list (lowest f)
	if ( ( OPEN == NULL ) || ( f < OPEN->f ) )
		{
		node->NextNode = OPEN;
		OPEN = node;
		return;
		}

	// do sorted insertion into OPEN list in order of ascending f
	prev = OPEN;
	next = OPEN->NextNode;
	while( ( next != NULL ) && ( next->f < f ) )
		{
		prev = next;
		next = next->NextNode;
		}

	// insert it between the two nodes
	node->NextNode = next;
	prev->NextNode = node;
	}

template <class Heuristic>
EXPORT_FROM_DLL void PathFinder<Heuristic>::PropagateDown
	(
	PathNode *node
	)

	{
	int			c;
	unsigned		g;
	unsigned		movecost;
	PathNode		*child;
	PathNode		*parent;
	pathway_t	*path;
	int			n;

	g = node->g;
	n = node->numChildren;
	for( c = 0; c < n; c++ )
		{
		path = &node->Child[ c ];
		child = AI_GetNode( path->node );

		movecost = g + heuristic.cost( node, c );
		if ( movecost < child->g )
			{
			child->g = movecost;
			child->f = child->g + child->h;
			child->Parent = node;

			// reset parent to new path.
			// Now the Child's branch need to be
			// checked out. Remember the new cost must be propagated down.
			stack.Push( child );
			}
		}

	while( !stack.Empty() )
		{
    	parent = stack.Pop();
		n = parent->numChildren;
		for( c = 0; c < n; c++ )
    		{
			path = &parent->Child[ c ];
			child = AI_GetNode( path->node );
  
			// we stop the propagation when the g value of the child is equal or better than 
			// the cost we're propagating
			movecost = parent->g + path->moveCost;
			if ( movecost < child->g )
    			{
				child->g = movecost;
				child->f = child->g + child->h;
    			child->Parent = parent;
    			stack.Push( child );
    			}
    		}
		}
	}

class EXPORT_FROM_DLL StandardMovement
	{
	public:
		int		minwidth;
		int		minheight;
		int		entnum;

	inline void setSize
		( 
		Vector size 
		)

		{
		minwidth = max( size.x, size.y );
		minheight = size.z;
		}

	inline int dist
		( 
		PathNode *node,
		PathNode *end
		)

		{
		Vector	delta;
		int		d1;
		int		d2;
		int		d3;
		int		h;

		delta	= node->worldorigin - end->worldorigin;
		d1		= abs( ( int )delta[ 0 ] );
		d2		= abs( ( int )delta[ 1 ] );
		d3		= abs( ( int )delta[ 2 ] );
		h		= max( d1, d2 );
		h		= max( d3, h );

		return h;
		}

	inline qboolean validpath
		(
		PathNode *node,
		int i
		)

		{
		pathway_t *path;
		PathNode *n;

		path = &node->Child[ i ];
		if ( CHECK_PATH( path, minwidth, minheight ) )
			{
			return false;
			}

		if ( path->door )
			{
			Door *door;
			
			door = ( Door * )G_GetEntity( path->door );
			if ( !door->CanBeOpenedBy( G_GetEntity( entnum ) ) )
				{
				return false;
				}
			}

		n = AI_GetNode( path->node );
		if ( n && ( n->occupiedTime > level.time ) && ( n->entnum != entnum ) )
			{
			return false;
			}

		return true;
		}

	inline int cost
		(
		PathNode *node,
		int i
		)

		{
		return node->Child[ i ].moveCost;
		}

	inline qboolean done
		(
		PathNode *node,
		PathNode *end
		)

		{
		return node == end;
		}
	};

#ifdef EXPORT_TEMPLATE
template class EXPORT_FROM_DLL PathFinder<StandardMovement>;
#endif
typedef PathFinder<StandardMovement> StandardMovePath;

#endif /* navigate.h */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费在线观看一区| 亚洲国产日韩一级| 91蝌蚪porny成人天涯| 国产成人在线观看| 色猫猫国产区一区二在线视频| 九九久久精品视频| hitomi一区二区三区精品| 高清在线观看日韩| 一本大道久久a久久综合| 欧美美女直播网站| 亚洲精品在线三区| 国产精品萝li| 丁香另类激情小说| 国产精品久久久久久久久久久免费看| 欧美精选午夜久久久乱码6080| 日韩三级.com| 亚洲免费伊人电影| 国产一区二区视频在线| 欧美性大战xxxxx久久久| 欧洲av一区二区嗯嗯嗯啊| 亚洲一区二区视频在线| 国内一区二区在线| 制服丝袜亚洲网站| 亚洲综合一区二区三区| 久久99精品久久久久久国产越南| 国产伦精品一区二区三区免费迷 | 99久久综合狠狠综合久久| 日韩一区二区高清| 亚洲成人黄色影院| 91福利国产精品| 亚洲视频资源在线| 色综合天天综合狠狠| 国产精品福利av| 精品一区二区三区不卡 | 日本少妇一区二区| 99re8在线精品视频免费播放| 91精品福利在线一区二区三区| 激情深爱一区二区| 亚洲欧美日韩电影| 欧美人妖巨大在线| 麻豆国产91在线播放| 国产福利不卡视频| 国产精品免费看片| 色先锋aa成人| 亚洲免费成人av| 精品亚洲成av人在线观看| 91精品福利在线| 中文子幕无线码一区tr| 成人的网站免费观看| 一区二区成人在线观看| 3atv一区二区三区| 成人免费黄色在线| 中文字幕一区二区三区四区不卡| 国产女人aaa级久久久级| 国产不卡免费视频| 一区二区在线观看视频| 久久精品人人做人人综合| 精品一区二区三区的国产在线播放 | 丁香桃色午夜亚洲一区二区三区| 欧美精品一区在线观看| 91精品国产免费久久综合| 国产伦精品一区二区三区免费| 亚洲bt欧美bt精品777| 国产精品色呦呦| 国产精品99久| 成人午夜视频免费看| 久久国产成人午夜av影院| 精品va天堂亚洲国产| 精品视频一区三区九区| 午夜视黄欧洲亚洲| 亚洲成av人综合在线观看| 国产欧美在线观看一区| 91国内精品野花午夜精品| 国内精品久久久久影院一蜜桃| 成人免费在线播放视频| 亚洲男人天堂一区| 亚洲综合偷拍欧美一区色| 国产精品天天摸av网| 国产精品视频免费看| 久久国产成人午夜av影院| 成人高清免费在线播放| 色偷偷成人一区二区三区91| 99re热这里只有精品免费视频| 91福利国产精品| 99精品热视频| 成人黄色小视频在线观看| 中文一区二区完整视频在线观看| 国产清纯白嫩初高生在线观看91 | 亚洲电影视频在线| 五月天激情综合| 香蕉久久夜色精品国产使用方法 | 日韩精品久久久久久| 国产sm精品调教视频网站| 91污在线观看| 国产欧美日韩在线观看| 亚洲综合无码一区二区| 久久91精品久久久久久秒播| 91蝌蚪porny九色| 久久亚洲精精品中文字幕早川悠里 | 日韩欧美视频一区| 一区二区三区四区亚洲| www.欧美日韩国产在线| 精品久久国产字幕高潮| 亚洲男人的天堂av| 国内久久婷婷综合| 欧美视频一区二区| 亚洲女与黑人做爰| 97se亚洲国产综合自在线不卡 | 亚洲午夜国产一区99re久久| 国产馆精品极品| 精品国产一区二区在线观看| 一区二区三区四区高清精品免费观看| 91猫先生在线| 午夜久久久影院| 欧美性感一类影片在线播放| 香蕉久久一区二区不卡无毒影院 | 夜夜精品视频一区二区| 另类小说色综合网站| 欧美一区二区三区人| 日韩av电影免费观看高清完整版在线观看| 国产精品主播直播| 亚洲人成精品久久久久久| av动漫一区二区| av电影在线观看一区| 久久久久久久久岛国免费| 国产伦理精品不卡| 欧美午夜精品一区| 国产嫩草影院久久久久| youjizz国产精品| 色综合网站在线| 亚洲三级在线观看| 欧美三级资源在线| 男女男精品视频| 国产精品视频yy9299一区| 日韩限制级电影在线观看| 粉嫩久久99精品久久久久久夜| 日本少妇一区二区| 亚洲成av人影院| 中文字幕一区二区三区四区| 欧美电影免费观看高清完整版在线 | 成人精品gif动图一区| 麻豆中文一区二区| 亚洲欧美激情在线| 久久久久亚洲蜜桃| 色噜噜狠狠一区二区三区果冻| 国产一区二区三区精品视频| 亚洲乱码日产精品bd| 国产精品久久二区二区| 久久欧美一区二区| 国产欧美日韩在线| 国产精品美女久久久久久久| 国产精品女同一区二区三区| 中文幕一区二区三区久久蜜桃| 欧美一二三四区在线| 精品人在线二区三区| 久久免费国产精品| 国产精品网站在线播放| 中文字幕亚洲欧美在线不卡| 久久久久久久久97黄色工厂| 亚洲精品一区二区精华| 久久蜜桃一区二区| 《视频一区视频二区| 亚洲一区二区三区国产| 日韩中文字幕av电影| 青草国产精品久久久久久| 国产精品99久久久久久宅男| 成人免费的视频| 欧美一区二区国产| 日本一区二区三区dvd视频在线| 欧美国产日产图区| 亚洲激情男女视频| 韩国理伦片一区二区三区在线播放 | 精品国产成人系列| 一区二区三区蜜桃| 国产一区二区在线视频| 欧美性大战久久久久久久蜜臀| 精品国产免费人成在线观看| 亚洲色图在线看| av福利精品导航| 欧美国产成人在线| 国产福利精品导航| 国产亚洲人成网站| 亚洲最大的成人av| 不卡一区在线观看| 中文字幕一区二区三区在线不卡| 麻豆精品国产91久久久久久| 91麻豆精品国产综合久久久久久| 亚洲精品在线免费播放| 蜜桃久久久久久久| 国产亚洲一本大道中文在线| 国产一区二区三区精品欧美日韩一区二区三区 | 欧美色视频在线| 亚洲高清视频在线| 欧美日产国产精品| 日韩高清一区在线| 精品久久久久久无| 亚洲不卡一区二区三区| 99久久久久久99| 奇米影视一区二区三区| 日韩三级精品电影久久久|