]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove navigation_hasgoals field, use goalentity to check if navigation has goals
authorterencehill <piuntn@gmail.com>
Wed, 8 Mar 2017 19:03:32 +0000 (20:03 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 8 Mar 2017 19:03:32 +0000 (20:03 +0100)
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/navigation.qh
qcsrc/server/mutators/mutator/gamemode_ctf.qc

index 2d7cbb4a7e5208794a03448a4f8be096cd91c370..4c3c3f02cd74cfcf1c1f7ce609cfab534e9e2efc 100644 (file)
@@ -1218,7 +1218,7 @@ bool havocbot_moveto_refresh_route(entity this)
        navigation_goalrating_start(this);
        navigation_routerating(this, wp, 10000, 10000);
        navigation_goalrating_end(this);
-       return this.navigation_hasgoals;
+       return (this.goalentity != NULL);
 }
 
 float havocbot_moveto(entity this, vector pos)
index 24cc29bdccc7258ee4ce78f2777c29942b0bd826..e026e1c76deab3929c21653c4b1a70293a84ecfc 100644 (file)
@@ -253,7 +253,6 @@ bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float m
 void navigation_clearroute(entity this)
 {
        //print("bot ", etos(this), " clear\n");
-       this.navigation_hasgoals = false;
        this.goalentity = NULL;
        this.goalcurrent = NULL;
        this.goalstack01 = NULL;
@@ -867,13 +866,11 @@ void navigation_routerating(entity this, entity e, float f, float rangebias)
 // adds an item to the the goal stack with the path to a given item
 bool navigation_routetogoal(entity this, entity e, vector startposition)
 {
-       this.goalentity = e;
-
        // if there is no goal, just exit
        if (!e)
                return false;
 
-       this.navigation_hasgoals = true;
+       this.goalentity = e;
 
        // put the entity on the goal stack
        //print("routetogoal ", etos(e), "\n");
@@ -1028,7 +1025,6 @@ void navigation_goalrating_start(entity this)
 
        this.navigation_jetpack_goal = NULL;
        navigation_bestrating = -1;
-       this.navigation_hasgoals = false;
        navigation_clearroute(this);
        navigation_bestgoal = NULL;
        navigation_markroutes(this, NULL);
@@ -1044,16 +1040,13 @@ void navigation_goalrating_end(entity this)
        LOG_DEBUG("best goal ", this.goalcurrent.classname);
 
        // If the bot got stuck then try to reach the farthest waypoint
-       if (!this.navigation_hasgoals)
-       if (autocvar_bot_wander_enable)
+       if (!this.goalentity && autocvar_bot_wander_enable)
        {
                if (!(this.aistatus & AI_STATUS_STUCK))
                {
                        LOG_DEBUG(this.netname, " cannot walk to any goal");
                        this.aistatus |= AI_STATUS_STUCK;
                }
-
-               this.navigation_hasgoals = false; // Reset this value
        }
 }
 
index 88916916341efa3dec28e8fccd339831319177aa..8f1f03ad1933f9512a2f96126d82ab8770002233 100644 (file)
@@ -28,7 +28,6 @@ entity navigation_bestgoal;
 .entity wp_goal_prev1;
 
 .float nearestwaypointtimeout;
-.float navigation_hasgoals;
 .float lastteleporttime;
 
 .float blacklisted;
index b1d0ab646253632f23a1e49b02cfe52b717ab823..8a88d5d2e8d7ac60ab0b4bd45601914650fb14ba 100644 (file)
@@ -1686,7 +1686,7 @@ void havocbot_role_ctf_carrier(entity this)
 
                navigation_goalrating_end(this);
 
-               if (this.navigation_hasgoals)
+               if (this.goalentity)
                        this.havocbot_cantfindflag = time + 10;
                else if (time > this.havocbot_cantfindflag)
                {