From 0d17ea4a6fc382131b4f06e971f8abe9d2ae97a2 Mon Sep 17 00:00:00 2001 From: mand1nga Date: Thu, 21 Apr 2011 21:45:50 -0300 Subject: [PATCH] Cleaner handling of the queue --- qcsrc/server/bot/navigation.qc | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/qcsrc/server/bot/navigation.qc b/qcsrc/server/bot/navigation.qc index 4c4044f10..8f72014a2 100644 --- a/qcsrc/server/bot/navigation.qc +++ b/qcsrc/server/bot/navigation.qc @@ -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; -- 2.39.2