From d6d608850c39140765faba78d39b74de8e81e9e8 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 29 Oct 2017 00:47:34 +0200 Subject: [PATCH] Assume nearest waypoint of a bot is its current goal waypoint (good as feature but also as optimization) --- qcsrc/server/bot/default/navigation.qc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 61079576a..135b5fc68 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1237,7 +1237,10 @@ void navigation_routerating(entity this, entity e, float f, float rangebias) if ((!e.nearestwaypoint || e.navigation_dynamicgoal) && e.nearestwaypointtimeout >= 0 && time > e.nearestwaypointtimeout) { - e.nearestwaypoint = nwp = navigation_findnearestwaypoint(e, true); + if(IS_BOT_CLIENT(e) && e.goalcurrent && e.goalcurrent.classname == "waypoint") + e.nearestwaypoint = nwp = e.goalcurrent; + else + e.nearestwaypoint = nwp = navigation_findnearestwaypoint(e, true); if(!nwp) { LOG_DEBUG("FAILED to find a nearest waypoint to '", e.classname, "' #", etos(e)); -- 2.39.2