]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Optimise bot route rating a tiny bit by abusing vlen2
authorMario <mario@smbclan.net>
Wed, 20 Jun 2018 08:36:44 +0000 (18:36 +1000)
committerMario <mario@smbclan.net>
Wed, 20 Jun 2018 08:36:44 +0000 (18:36 +1000)
qcsrc/server/bot/default/navigation.qc

index 512d3a2062b0049cc8295b892c518a4ec2fe7f78..555cfd0ef0a1f4da4beb81ebc73577ced6dd0360 100644 (file)
@@ -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;