# HG changeset patch # User unc0rr # Date 1352973529 -14400 # Node ID 89740f9272542ae9f3c787b60ca71c0d0afda999 # Parent 4e40503e2b2c9723ed15f8868b1ea1ebb0b7bbf7 Don't rely on hedgehog facing direction, check intentions instead. Should fix excessive turns around and weird jumps to water diff -r 4e40503e2b2c -r 89740f927254 hedgewars/uAI.pas --- a/hedgewars/uAI.pas Thu Nov 15 13:57:29 2012 +0400 +++ b/hedgewars/uAI.pas Thu Nov 15 13:58:49 2012 +0400 @@ -291,18 +291,13 @@ begin with Stack.States[Pred(Stack.Count)] do begin - if Me^.dX.isNegative then + if (Me^.Message and gmLeft) <> 0 then AddAction(MadeActions, aia_LookRight, 0, 200, 0, 0) else AddAction(MadeActions, aia_LookLeft, 0, 200, 0, 0); AddAction(MadeActions, aia_HJump, 0, 305 + random(50), 0, 0); AddAction(MadeActions, aia_HJump, 0, 350, 0, 0); - - if Me^.dX.isNegative then - AddAction(MadeActions, aia_LookLeft, 0, 200, 0, 0) - else - AddAction(MadeActions, aia_LookRight, 0, 200, 0, 0); end; // but first check walking forward Push(ticks, Stack.States[Pred(Stack.Count)].MadeActions, AltMe, Me^.Message) @@ -318,7 +313,7 @@ if Push(ticks, Actions, AltMe, Me^.Message xor 3) then with Stack.States[Pred(Stack.Count)] do begin - if Me^.dX.isNegative then + if (Me^.Message and gmLeft) <> 0 then AddAction(MadeActions, aia_LookLeft, 0, 200, 0, 0) else AddAction(MadeActions, aia_LookRight, 0, 200, 0, 0);