# HG changeset patch
# User unc0rr
# Date 1248975166 0
# Node ID cb850ba733bd2540ad694eaa5c212596e74e904e
# Parent  c01b8258918d9447311ef6fd5846de1d5791635a
Fix queue bug triggered by AI

diff -r c01b8258918d -r cb850ba733bd hedgewars/uAI.pas
--- a/hedgewars/uAI.pas	Thu Jul 30 09:35:09 2009 +0000
+++ b/hedgewars/uAI.pas	Thu Jul 30 17:32:46 2009 +0000
@@ -48,10 +48,7 @@
 with CurrentHedgehog^ do
      if Gear <> nil then
         if BotLevel <> 0 then
-           begin
-           if (Gear^.Message and gm_Left) <> 0 then ParseCommand('-left', true);
-           if (Gear^.Message and gm_Right) <> 0 then ParseCommand('-right', true);
-           end;
+           StopMessages(Gear^.Message);
 
 BestActions.Count:= 0;
 BestActions.Pos:= 0
diff -r c01b8258918d -r cb850ba733bd hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Thu Jul 30 09:35:09 2009 +0000
+++ b/hedgewars/uGears.pas	Thu Jul 30 17:32:46 2009 +0000
@@ -613,7 +613,10 @@
 	stNTurn: begin
 			if isInMultiShoot then isInMultiShoot:= false
 			else begin
-            ResetUtilities;
+			ResetUtilities;
+			
+			FreeActionsList; // could send -left, -right and similar commands, so should be called before /nextturn
+			
 			ParseCommand('/nextturn', true);
 			SwitchHedgehog;
 
diff -r c01b8258918d -r cb850ba733bd hedgewars/uTeams.pas
--- a/hedgewars/uTeams.pas	Thu Jul 30 09:35:09 2009 +0000
+++ b/hedgewars/uTeams.pas	Thu Jul 30 17:32:46 2009 +0000
@@ -162,7 +162,6 @@
 var c: LongWord;
     PrevHH, PrevTeam: LongWord;
 begin
-FreeActionsList;
 TargetPoint.X:= NoPointX;
 TryDo(CurrentTeam <> nil, 'nil Team', true);
 PreviousTeam:= CurrentTeam;