From: terencehill Date: Sun, 2 Dec 2018 16:35:36 +0000 (+0100) Subject: Bot AI: optimize removal of the first waypoint of the route when bot is really close... X-Git-Tag: xonotic-v0.8.5~1705^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f264dd1d6acb0893dd007ae669b435682e1c1293;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: optimize removal of the first waypoint of the route when bot is really close to it --- diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 6c5e2769b..1a491530a 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1796,6 +1796,7 @@ void navigation_goalrating_start(entity this) navigation_clearroute(this); navigation_bestgoal = NULL; navigation_markroutes(this, wp); + this.goalstack31 = wp; // temporarly save the really close waypoint } // ends a goal selection session (updates goal stack to the best goal) @@ -1804,9 +1805,15 @@ void navigation_goalrating_end(entity this) if(this.aistatus & AI_STATUS_STUCK) return; + entity wp = this.goalstack31; // save to wp as this.goalstack31 is set by navigation_routetogoal + this.goalstack31 = NULL; + navigation_routetogoal(this, navigation_bestgoal, this.origin); LOG_DEBUG("best goal ", this.goalcurrent.classname); + if (wp && this.goalcurrent == wp) + navigation_poproute(this); + // If the bot got stuck then try to reach the farthest waypoint if (!this.goalentity) {