]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix bots recalculating every time the nearest waypoint of every weapon on the map
authorterencehill <piuntn@gmail.com>
Thu, 2 Mar 2017 20:54:51 +0000 (21:54 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 2 Mar 2017 20:54:51 +0000 (21:54 +0100)
qcsrc/server/bot/default/navigation.qc

index 61c628542c47227f4b8e88ff8d570441a9d29dec..20a3a9149335289dfc0e58d088a2ecce7499c202 100644 (file)
@@ -799,20 +799,16 @@ void navigation_routerating(entity this, entity e, float f, float rangebias)
        }
        else
        {
-               float search;
+               bool search = true;
 
-               search = true;
-
-               if(e.flags & FL_ITEM)
+               if((e.flags & FL_ITEM) && e.nearestwaypoint)
                {
-                       if (!(e.flags & FL_WEAPON))
-                       if(e.nearestwaypoint)
-                               search = false;
-               }
-               else if (e.flags & FL_WEAPON)
-               {
-                       if(e.classname != "droppedweapon")
-                       if(e.nearestwaypoint)
+                       if (e.flags & FL_WEAPON)
+                       {
+                               if(e.classname != "droppedweapon")
+                                       search = false;
+                       }
+                       else
                                search = false;
                }
 
@@ -827,10 +823,13 @@ void navigation_routerating(entity this, entity e, float f, float rangebias)
                                LOG_DEBUG("FAILED to find a nearest waypoint to '", e.classname, "' #", etos(e));
 
                                if(e.flags & FL_ITEM)
-                                       e.blacklisted = true;
-                               else if (e.flags & FL_WEAPON)
                                {
-                                       if(e.classname != "droppedweapon")
+                                       if (e.flags & FL_WEAPON)
+                                       {
+                                               if(e.classname != "droppedweapon")
+                                                       e.blacklisted = true;
+                                       }
+                                       else
                                                e.blacklisted = true;
                                }