From: terencehill Date: Thu, 2 Mar 2017 20:54:51 +0000 (+0100) Subject: Fix bots recalculating every time the nearest waypoint of every weapon on the map X-Git-Tag: xonotic-v0.8.2~158 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b6c56e960049f928a110b827ef15c54a19df6f50;p=xonotic%2Fxonotic-data.pk3dir.git Fix bots recalculating every time the nearest waypoint of every weapon on the map --- diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 61c628542..20a3a9149 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -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; }