]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into mand1nga/pathfinding-optimizations
authormand1nga <mand1nga@xonotic.org>
Mon, 15 Aug 2011 04:56:12 +0000 (01:56 -0300)
committermand1nga <mand1nga@xonotic.org>
Mon, 15 Aug 2011 04:56:12 +0000 (01:56 -0300)
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/navigation.qh

index 749b78fed6546eb7c9460dd88a00cfa2d43b07e3..4f680284eec19ff96b3b6bcfbfa3477a04d9abd7 100644 (file)
@@ -645,7 +645,11 @@ void navigation_routerating(entity e, float f, float rangebias)
        if (!e)
                return;
 
+       if(e.blacklisted)
+               return;
+
        o = (e.absmin + e.absmax) * 0.5;
+
        //print("routerating ", etos(e), " = ", ftos(f), " - ", ftos(rangebias), "\n");
 
        // Evaluate path using jetpack
@@ -747,14 +751,48 @@ void navigation_routerating(entity e, float f, float rangebias)
        }
        else
        {
+               float search;
+
+               search = TRUE;
+
+               if(e.flags & FL_ITEM)
+               {
+                       if not(e.flags & FL_WEAPON)
+                       if(e.nearestwaypoint)
+                               search = FALSE;
+               }
+               else if (e.flags & FL_WEAPON)
+               {
+                       if(e.classname != "droppedweapon")
+                       if(e.nearestwaypoint)
+                               search = FALSE;
+               }
+
+               if(search)
                if (time > e.nearestwaypointtimeout)
                {
                        nwp = navigation_findnearestwaypoint(e, TRUE);
                        if(nwp)
                                e.nearestwaypoint = nwp;
                        else
+                       {
                                dprint("FAILED to find a nearest waypoint to '", e.classname, "' #", etos(e), "\n");
 
+                               if(e.flags & FL_ITEM)
+                                       e.blacklisted = TRUE;
+                               else if (e.flags & FL_WEAPON)
+                               {
+                                       if(e.classname != "droppedweapon")
+                                               e.blacklisted = TRUE;
+                               }
+
+                               if(e.blacklisted)
+                               {
+                                       dprint("The entity '", e.classname, "' is going to be excluded from path finding during this match\n");
+                                       return;
+                               }
+                       }
+
                        // TODO: Cleaner solution, probably handling this timeout from ctf.qc
                        if(e.classname=="item_flag_team")
                                e.nearestwaypointtimeout = time + 2;
index 8971692de03193c546f0a33ac09eb65709038884..b3b40ce03e55443be1c82e8e362f354381e82483 100644 (file)
@@ -28,6 +28,8 @@ entity navigation_bestgoal;
 .float navigation_hasgoals;
 .float lastteleporttime;
 
+.float blacklisted;
+
 .entity navigation_jetpack_goal;
 .vector navigation_jetpack_point;