From: terencehill <piuntn@gmail.com>
Date: Wed, 15 Feb 2017 15:15:03 +0000 (+0100)
Subject: If for some reason final goal was removed clear route instead of simply removing it
X-Git-Tag: xonotic-v0.8.2~202^2~6
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=438689d3feb91ed0fe07b32a15d0ad9e83c774ae;p=xonotic%2Fxonotic-data.pk3dir.git

If for some reason final goal was removed clear route instead of simply removing it
---

diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc
index ba8757502..3d4e298d1 100644
--- a/qcsrc/server/bot/default/havocbot/havocbot.qc
+++ b/qcsrc/server/bot/default/havocbot/havocbot.qc
@@ -676,7 +676,13 @@ void havocbot_movetogoal(entity this)
 
 
 	bool locked_goal = false;
-	if(this.goalentity.bot_pickup)
+	if(this.goalentity && wasfreed(this.goalentity))
+	{
+		navigation_clearroute(this);
+		this.bot_strategytime = 0;
+		return;
+	}
+	else if(this.goalentity.bot_pickup)
 	{
 		if(this.goalentity.bot_pickup_respawning)
 		{
diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc
index 95d787e00..0883bacd0 100644
--- a/qcsrc/server/bot/default/navigation.qc
+++ b/qcsrc/server/bot/default/navigation.qc
@@ -927,9 +927,6 @@ 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