Fix queue bug triggered by AI
authorunc0rr
Thu, 30 Jul 2009 17:32:46 +0000
changeset 2289 cb850ba733bd
parent 2288 c01b8258918d
child 2290 bf87ca44782e
Fix queue bug triggered by AI
hedgewars/uAI.pas
hedgewars/uGears.pas
hedgewars/uTeams.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
--- 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;
 
--- 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;