]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into mand1nga/pathfinding-optimizations
authormand1nga <mand1nga@xonotic.org>
Sat, 13 Aug 2011 03:51:05 +0000 (00:51 -0300)
committermand1nga <mand1nga@xonotic.org>
Sat, 13 Aug 2011 03:51:05 +0000 (00:51 -0300)
Conflicts:
qcsrc/server/bot/navigation.qc

qcsrc/server/bot/navigation.qc
qcsrc/server/bot/navigation.qh

index ebaf210b3c493855e071ee409de9efdf34d7c233..2d66b021327e116231d567c989b2f77c7728d388 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 0a9bf14010d17176eab4a7740b9b997f2facd622..8b227afd9397899ffe1d4d7d9029221276de6146 100644 (file)
@@ -27,6 +27,8 @@ entity navigation_bestgoal;
 .float navigation_hasgoals;
 .float lastteleporttime;
 
+.float blacklisted;
+
 .entity navigation_jetpack_goal;
 .vector navigation_jetpack_point;