]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
yay! Fix bug causing bots to ignore teleports and warpzones
authorterencehill <piuntn@gmail.com>
Sun, 30 Apr 2017 23:57:23 +0000 (01:57 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 30 Apr 2017 23:57:23 +0000 (01:57 +0200)
qcsrc/server/bot/default/navigation.qc

index 26eb40329861eb7e4b4b40b2c16f2e7ed2f28995..840ca49f17fd9e72e767b24e37b6a408322499c8 100644 (file)
@@ -528,7 +528,7 @@ float navigation_markroutes_nearestwaypoints(entity this, float maxdist)
 }
 
 // updates a path link if a spawnfunc_waypoint link is better than the current one
 }
 
 // updates a path link if a spawnfunc_waypoint link is better than the current one
-void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vector p)
+void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost, vector p)
 {
        vector m1;
        vector m2;
 {
        vector m1;
        vector m2;
@@ -543,10 +543,13 @@ void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vecto
        }
        else
                v = wp.origin;
        }
        else
                v = wp.origin;
-       cost2 += waypoint_getdistancecost(p, v);
-       if (wp.wpcost > cost2)
+       if (w.wpflags & WAYPOINTFLAG_TELEPORT)
+               cost += w.wp00mincost; // assuming teleport has exactly one destination
+       else
+               cost += waypoint_getdistancecost(p, v);
+       if (wp.wpcost > cost)
        {
        {
-               wp.wpcost = cost2;
+               wp.wpcost = cost;
                wp.enemy = w;
                wp.wpfire = 1;
                wp.wpnearestpoint = v;
                wp.enemy = w;
                wp.wpfire = 1;
                wp.wpnearestpoint = v;