Fix AI breaking demos and saves in some cases
authorunc0rr
Sun, 16 Dec 2007 19:34:13 +0000
changeset 676 2aa3082937ac
parent 675 28e294a496cb
child 677 9d0bcc3c903a
Fix AI breaking demos and saves in some cases
hedgewars/uAI.pas
hedgewars/uAIActions.pas
--- a/hedgewars/uAI.pas	Sun Dec 16 19:16:22 2007 +0000
+++ b/hedgewars/uAI.pas	Sun Dec 16 19:34:13 2007 +0000
@@ -325,6 +325,7 @@
            if (BestActions.Pos >= BestActions.Count)
               and (TurnTimeLeft > cStopThinkTime) then
               begin
+              TryDo(Gear^.Message = 0, 'Engine bug: AI may break demos playing', true);
               StartThink(Gear);
               StartTicks:= GameTicks
               end else ProcessAction(BestActions, Gear)
--- a/hedgewars/uAIActions.pas	Sun Dec 16 19:16:22 2007 +0000
+++ b/hedgewars/uAIActions.pas	Sun Dec 16 19:34:13 2007 +0000
@@ -127,10 +127,10 @@
        end else
        begin
        inc(timedelta);
-       if timedelta > 2500 then
+       if timedelta > 2000 then
           begin
           timedelta:= 0;
-          Actions.Count:= 0
+          FreeActionsList
           end
        end
     end;