Move check for freed goals to navigation_poptouchedgoals
authorterencehill <piuntn@gmail.com>
Sun, 25 Dec 2016 09:51:14 +0000 (10:51 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 25 Dec 2016 09:51:14 +0000 (10:51 +0100)
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/navigation.qc

index 80dc706..af6aa3f 100644 (file)
@@ -29,13 +29,6 @@ void havocbot_ai(entity this)
        if(bot_execute_commands(this))
                return;
 
-       while(this.goalcurrent && wasfreed(this.goalcurrent))
-       {
-               navigation_poproute(this);
-               if(!this.goalcurrent)
-                       this.bot_strategytime = 0;
-       }
-
        if (bot_strategytoken == this)
        if (!bot_strategytoken_taken)
        {
@@ -646,8 +639,7 @@ void havocbot_movetogoal(entity this)
        if (this.goalcurrent == NULL)
                return;
 
-       if (this.goalcurrent)
-               navigation_poptouchedgoals(this);
+       navigation_poptouchedgoals(this);
 
        // if ran out of goals try to use an alternative goal or get a new strategy asap
        if(this.goalcurrent == NULL)
index 0e4243d..83077e1 100644 (file)
@@ -876,6 +876,9 @@ void navigation_poptouchedgoals(entity this)
        m1 = org + this.mins;
        m2 = org + this.maxs;
 
+       while(this.goalcurrent && wasfreed(this.goalcurrent))
+               navigation_poproute(this);
+
        if(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
        {
                // make sure jumppad is really hit, don't rely on distance based checks