# HG changeset patch # User unc0rr # Date 1211024184 0 # Node ID ba582673db7d82a123e362f8ceafdd12ff5d3a80 # Parent f13a67ce38118e6eb78c201a6116ecb0c71ce03f Fix 'AI may break demos playing' message while loading saves diff -r f13a67ce3811 -r ba582673db7d hedgewars/uAI.pas --- a/hedgewars/uAI.pas Fri May 16 13:21:18 2008 +0000 +++ b/hedgewars/uAI.pas Sat May 17 11:36:24 2008 +0000 @@ -329,7 +329,12 @@ if (BestActions.Pos >= BestActions.Count) and (TurnTimeLeft > cStopThinkTime) then begin - TryDo(Gear^.Message = 0, 'Engine bug: AI may break demos playing', true); + if Gear^.Message <> 0 then + begin + StopMessages(Gear^.Message); + TryDo((Gear^.Message and gmAllStoppable) = 0, 'Engine bug: AI may break demos playing', true); + end; + if Gear^.Message <> 0 then exit; StartThink(Gear); StartTicks:= GameTicks end else ProcessAction(BestActions, Gear) diff -r f13a67ce3811 -r ba582673db7d hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Fri May 16 13:21:18 2008 +0000 +++ b/hedgewars/uConsole.pas Sat May 17 11:36:24 2008 +0000 @@ -29,6 +29,7 @@ procedure WriteLnToConsole(s: shortstring); procedure KeyPressConsole(Key: Longword); procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); +procedure StopMessages(Message: Longword); function GetLastConsoleLine: shortstring; procedure doPut(putX, putY: LongInt; fromAI: boolean); @@ -316,6 +317,15 @@ else GetLastConsoleLine:= ConsoleLines[Pred(CurrLine)].s end; +procedure StopMessages(Message: Longword); +begin +if (Message and gm_Left) <> 0 then ParseCommand('/-left', true) else +if (Message and gm_Right) <> 0 then ParseCommand('/-right', true) else +if (Message and gm_Up) <> 0 then ParseCommand('/-up', true) else +if (Message and gm_Down) <> 0 then ParseCommand('/-down', true) else +if (Message and gm_Attack) <> 0 then ParseCommand('/-attack', true) +end; + {$INCLUDE CCHandlers.inc} initialization diff -r f13a67ce3811 -r ba582673db7d hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Fri May 16 13:21:18 2008 +0000 +++ b/hedgewars/uConsts.pas Sat May 17 11:36:24 2008 +0000 @@ -185,6 +185,7 @@ gm_Slot = $00000200; // with param gm_Weapon = $00000400; // with param gm_Timer = $00000800; // with param + gmAllStoppable = gm_Left or gm_Right or gm_Up or gm_Down or gm_Attack; cMaxSlotIndex = 8; cMaxSlotAmmoIndex = 2;