[nexuiz-commits] r7916 - trunk/data/qcsrc/server/bot
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Sep 25 21:12:24 EDT 2009
Author: mand1nga
Date: 2009-09-25 21:12:23 -0400 (Fri, 25 Sep 2009)
New Revision: 7916
Modified:
trunk/data/qcsrc/server/bot/navigation.qc
trunk/data/qcsrc/server/bot/navigation.qh
Log:
Removed support for multi goal routes. Extra overhead, also will become obsolete whenever I get rid of the cvar bot_ai_strategyinterval (just another flaw on the original design).
Modified: trunk/data/qcsrc/server/bot/navigation.qc
===================================================================
--- trunk/data/qcsrc/server/bot/navigation.qc 2009-09-25 23:56:30 UTC (rev 7915)
+++ trunk/data/qcsrc/server/bot/navigation.qc 2009-09-26 01:12:23 UTC (rev 7916)
@@ -641,56 +641,6 @@
}
};
-void navigation_bestgoals_reset()
-{
- local float i;
-
- bestgoalswindex = 0;
- bestgoalsrindex = 0;
-
- for(i=0;i>MAX_BESTGOALS-1;++i)
- {
- navigation_bestgoals[i] = world;
- }
-}
-
-void navigation_add_bestgoal(entity goal)
-{
- if(bestgoalsrindex>0)
- {
- ++bestgoalsrindex;
-
- if(bestgoalsrindex==MAX_BESTGOALS)
- bestgoalsrindex = 0;
- }
-
- if(bestgoalswindex==MAX_BESTGOALS)
- {
- bestgoalswindex=0;
- if(bestgoalsrindex==0)
- bestgoalsrindex=1;
- }
-
- navigation_bestgoals[bestgoalswindex] = goal;
-
- ++bestgoalswindex;
-}
-
-entity navigation_get_bestgoal()
-{
- local entity ent;
-
- ent = navigation_bestgoals[bestgoalsrindex];
- navigation_bestgoals[bestgoalsrindex] = world;
-
- ++bestgoalsrindex;
-
- if(bestgoalsrindex==MAX_BESTGOALS)
- bestgoalsrindex = 0;
-
- return ent;
-}
-
// updates the best goal according to a weighted calculation of travel cost and item value of a new proposed item
void navigation_routerating(entity e, float f, float rangebias)
{
@@ -780,7 +730,7 @@
{
// dprint("jetpack path: added goal", e.classname, " (with rating ", ftos(f), ")\n");
navigation_bestrating = f;
- navigation_add_bestgoal(e);
+ navigation_bestgoal = e;
self.navigation_jetpack_goal = e;
self.navigation_jetpack_point = pointb;
}
@@ -829,7 +779,7 @@
{
// dprint("ground path: added goal ", e.classname, " (with rating ", ftos(f), ")\n");
navigation_bestrating = f;
- navigation_add_bestgoal(e);
+ navigation_bestgoal = e;
}
}
//dprint("\n");
@@ -880,37 +830,6 @@
return FALSE;
};
-void navigation_routetogoals()
-{
- entity g1, g2;
-
- navigation_clearroute();
-
- g1 = navigation_get_bestgoal();
- for(;;)
- {
- if(g2==world)
- g2 = navigation_get_bestgoal();
-
- if(g2==world)
- {
- navigation_routetogoal(g1, self.origin);
- return;
- }
-
- if(navigation_routetogoal(g1, g2.origin))
- {
- g1 = g2;
- g2 = world;
- continue;
- }
-
- navigation_clearroute();
- g1 = g2;
- g2 = world;
- }
-}
-
// removes any currently touching waypoints from the goal stack
// (this is how bots detect if they reached a goal)
void navigation_poptouchedgoals()
@@ -972,14 +891,14 @@
self.navigation_jetpack_goal = world;
navigation_bestrating = -1;
self.navigation_hasgoals = FALSE;
- navigation_bestgoals_reset();
+ navigation_bestgoal = world;
navigation_markroutes(world);
};
// ends a goal selection session (updates goal stack to the best goal)
void navigation_goalrating_end()
{
- navigation_routetogoals();
+ navigation_routetogoal(navigation_bestgoal, self.origin);
// dprint("best goal ", self.goalcurrent.classname , "\n");
// Hack: if it can't walk to any goal just move blindly to the first visible waypoint
Modified: trunk/data/qcsrc/server/bot/navigation.qh
===================================================================
--- trunk/data/qcsrc/server/bot/navigation.qh 2009-09-25 23:56:30 UTC (rev 7915)
+++ trunk/data/qcsrc/server/bot/navigation.qh 2009-09-26 01:12:23 UTC (rev 7916)
@@ -2,18 +2,15 @@
* Globals and Fields
*/
-float bestgoalswindex;
-float bestgoalsrindex;
float navigation_bestrating;
float bot_navigation_movemode;
float navigation_testtracewalk;
vector stepheightvec;
+
entity botframe_dangerwaypoint;
+entity navigation_bestgoal;
-#define MAX_BESTGOALS 3
-entity navigation_bestgoals[MAX_BESTGOALS];
-
// stack of current goals (the last one of which may be an item or other
// desirable object, the rest are typically waypoints to reach it)
.entity goalcurrent, goalstack01, goalstack02, goalstack03;
@@ -65,15 +62,11 @@
void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vector p);
void navigation_markroutes(entity fixed_source_waypoint);
void navigation_markroutes_inverted(entity fixed_source_waypoint);
-void navigation_bestgoals_reset();
-void navigation_add_bestgoal(entity goal);
void navigation_routerating(entity e, float f, float rangebias);
-void navigation_routetogoals();
void navigation_poptouchedgoals();
void navigation_goalrating_start();
void navigation_goalrating_end();
void botframe_updatedangerousobjects(float maxupdate);
-entity navigation_get_bestgoal();
entity navigation_findnearestwaypoint(entity ent, float walkfromwp);
More information about the nexuiz-commits
mailing list