# HG changeset patch # User Wuzzy # Date 1593022562 -7200 # Node ID 25132742a9485720a32393b9d18a8e2104cea0d3 # Parent b2ed495a7fb197bafc0e6d87c620e6422353aff3 Fix AI thread erroring out when there are no targets diff -r b2ed495a7fb1 -r 25132742a948 ChangeLog.txt --- a/ChangeLog.txt Wed Jun 24 20:24:12 2020 +0300 +++ b/ChangeLog.txt Wed Jun 24 20:16:02 2020 +0200 @@ -15,6 +15,7 @@ + New taunt chat commands: /bubble, /happy * Fix many projectiles not being affected by Heavy Wind after turn end * Fix hog getting stuck when opening parachute right after a shoryuken digging through land + * Fix game hanging if computer hog has nothing to attack Campaigns: + A Space Adventure: Spacetrip: Meteorite appears blown-up after victory diff -r b2ed495a7fb1 -r 25132742a948 hedgewars/uAI.pas --- a/hedgewars/uAI.pas Wed Jun 24 20:24:12 2020 +0300 +++ b/hedgewars/uAI.pas Wed Jun 24 20:16:02 2020 +0200 @@ -506,7 +506,14 @@ Me^.AIHints := ME^.AIHints and (not aihAmmosChanged); end; - end else SDL_Delay(100) + end + else + begin + // No target found, skip turn + BestActions.Count:= 0; + AddAction(BestActions, aia_Skip, 0, 250, 0, 0); + Me^.AIHints := ME^.AIHints and (not aihAmmosChanged); + end else begin BackMe:= Me^; @@ -559,11 +566,6 @@ ThinkingHH:= Me; FillTargets; -if Targets.Count = 0 then - begin - OutError('AI: no targets!?', false); - exit - end; FillBonuses(((Me^.State and gstAttacked) <> 0) and (not isInMultiShoot) and ((GameFlags and gfInfAttack) = 0));