[nexuiz-commits] r6589 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Apr 25 15:46:47 EDT 2009


Author: mand1nga
Date: 2009-04-25 15:46:47 -0400 (Sat, 25 Apr 2009)
New Revision: 6589

Modified:
   trunk/data/qcsrc/server/bots.qc
Log:
Fix silly logic in navigation_routetogoal

Modified: trunk/data/qcsrc/server/bots.qc
===================================================================
--- trunk/data/qcsrc/server/bots.qc	2009-04-25 18:24:17 UTC (rev 6588)
+++ trunk/data/qcsrc/server/bots.qc	2009-04-25 19:46:47 UTC (rev 6589)
@@ -1604,38 +1604,37 @@
 };
 
 // adds an item to the the goal stack with the path to a given item
-vector navigation_routetogoal(entity e, vector startposition)
+float navigation_routetogoal(entity e, vector startposition)
 {
-	local vector endposition;
-
 	self.goalentity = e;
 
 	// if there is no goal, just exit
 	if (!e)
-		return '0 0 0';
+		return FALSE;
 
 	// put the entity on the goal stack
 	navigation_pushroute(e);
 
-	endposition = e.origin;
-
-
 	// if it can reach the goal there is nothing more to do
 	if (tracewalk(self, startposition, PL_MIN, PL_MAX, e.origin, MOVE_NORMAL))
-		return endposition;
+		return TRUE;
 
 	// see if there are waypoints describing a path to the item
-
 	e = e.nearestwaypoint;
-	while (e != world)
+	if(e == world)
+		return FALSE;
+
+	for (;;)
 	{
 		// add the spawnfunc_waypoint to the path
 		navigation_pushroute(e);
 		e = e.enemy;
+
+		if(e==world)
+			break;
 	}
 
-	// we assume the destination will be reached
-	return endposition;
+	return TRUE;
 };
 
 void navigation_routetogoals()
@@ -1653,8 +1652,7 @@
 		if(e==world)
 			return;
 
-		v = navigation_routetogoal(e, position);
-		if not(v=='0 0 0')
+		if(navigation_routetogoal(e, position))
 		{
 			position = v;
 			self.navigation_hasgoals = TRUE;



More information about the nexuiz-commits mailing list