]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Cleaner handling of the queue
authormand1nga <mand1nga@xonotic.org>
Fri, 22 Apr 2011 00:45:50 +0000 (21:45 -0300)
committermand1nga <mand1nga@xonotic.org>
Fri, 22 Apr 2011 00:45:50 +0000 (21:45 -0300)
qcsrc/server/bot/navigation.qc

index 4c4044f108b481b5f14f128f1e8d55fbbc38a0c5..8f72014a2eb9f6992993dea2dd6eab3417c09a13 100644 (file)
@@ -1016,7 +1016,9 @@ void navigation_unstuck()
                // build a new queue
                dprint(self.netname, " building a new wayoints queue\n");
 
-               entity first, head, prev;
+               entity head, first;
+
+               first = world;
                head = findradius(self.origin, 1000);
 
                while(head)
@@ -1024,18 +1026,13 @@ void navigation_unstuck()
                        if(head.classname=="waypoint")
                        if(!(head.wpflags & WAYPOINTFLAG_GENERATED))
                        {
-                               if (first==world)
-                               {
-                                       first = head;
-                                       bot_waypoint_queue_goal = head;
-                               }
+                               if(bot_waypoint_queue_goal)
+                                       bot_waypoint_queue_goal.bot_waypoint_queue_nextgoal = head;
                                else
-                               {
-                                       prev = bot_waypoint_queue_goal;
-                                       bot_waypoint_queue_goal = head;
-                                       prev.bot_waypoint_queue_nextgoal = head;
-                                       bot_waypoint_queue_goal.bot_waypoint_queue_nextgoal = world;
-                               }
+                                       first = head;
+
+                               bot_waypoint_queue_goal = head;
+                               bot_waypoint_queue_goal.bot_waypoint_queue_nextgoal = world;
                        }
 
                        head = head.chain;