From b6c56e960049f928a110b827ef15c54a19df6f50 Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 2 Mar 2017 21:54:51 +0100 Subject: [PATCH] Fix bots recalculating every time the nearest waypoint of every weapon on the map --- qcsrc/server/bot/default/navigation.qc | 29 +++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-) 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; } -- 2.39.2