# HG changeset patch
# User unc0rr
# Date 1302981675 -14400
# Node ID 73b3b4b8359ca3c480674bd964cc2b300d8f3a43
# Parent  a2ae7702bb759ef3ebaf54e77ac30d64b6e55926
Make AI switch to amNothing before trying to walk if it holds weapon which needs targeting (not tested)

diff -r a2ae7702bb75 -r 73b3b4b8359c hedgewars/uAI.pas
--- a/hedgewars/uAI.pas	Fri Apr 15 22:38:50 2011 +0400
+++ b/hedgewars/uAI.pas	Sat Apr 16 23:21:15 2011 +0400
@@ -208,6 +208,9 @@
 BestRate:= RatePlace(Me);
 BaseRate:= Max(BestRate, 0);
 
+if (Ammoz[Me^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0 then
+    AddAction(Actions, aia_Weapon, Longword(amNothing), 100 + random(200), 0, 0);
+
 while (Stack.Count > 0) and (not StopThinking) and (GameFlags and gfArtillery = 0) do
     begin
     Pop(ticks, Actions, Me^);