From: Mario Date: Wed, 20 Jun 2018 08:36:44 +0000 (+1000) Subject: Optimise bot route rating a tiny bit by abusing vlen2 X-Git-Tag: xonotic-v0.8.5~1998 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c128310d86eea9d95a81adb1a1e85c434d8e5c35;p=xonotic%2Fxonotic-data.pk3dir.git Optimise bot route rating a tiny bit by abusing vlen2 --- diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 512d3a206..555cfd0ef 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1234,12 +1234,13 @@ void navigation_routerating(entity this, entity e, float f, float rangebias) { entity theEnemy = e; entity best_wp = NULL; - float best_dist = 10000; - IL_EACH(g_waypoints, vdist(it.origin - theEnemy.origin, <, 500) + float best_dist = FLOAT_MAX; + IL_EACH(g_waypoints, !(it.wpflags & WAYPOINTFLAG_TELEPORT) + && vdist(it.origin - theEnemy.origin, <, 500) && vdist(it.origin - this.origin, >, 100) - && !(it.wpflags & WAYPOINTFLAG_TELEPORT), + && vdist(it.origin - this.origin, <, 10000), { - float dist = vlen(it.origin - theEnemy.origin); + float dist = vlen2(it.origin - theEnemy.origin); if (dist < best_dist) { best_wp = it;