merge
authorsheepluva
Fri, 29 Mar 2013 14:47:01 +0100
changeset 8816 6f93822e0b2e
parent 8807 509d812ca219 (current diff)
parent 8814 01e13871f578 (diff)
child 8818 8f317ba10675
merge
QTfrontend/util/MessageDialog.h
--- a/hedgewars/GSHandlers.inc	Thu Mar 28 17:41:40 2013 +0100
+++ b/hedgewars/GSHandlers.inc	Fri Mar 29 14:47:01 2013 +0100
@@ -5130,7 +5130,7 @@
     hogs: PGearArrayS;
 begin
     HHGear := Gear^.Hedgehog^.Gear;
-    if (Gear^.Message and gmAttack <> 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then
+    if (Gear^.Message and gmAttack <> 0) or (Gear^.Health = 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then
         begin
         DeleteGear(Gear);
         AfterAttack;
@@ -5147,8 +5147,8 @@
            ((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and
              (Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0))) then
             begin
-                updateTarget(Gear, ndX, ndY);
-                Health := iceWaitCollision;
+            updateTarget(Gear, ndX, ndY);
+            Timer := iceWaitCollision;
             end
         else
             begin
@@ -5156,27 +5156,24 @@
             Y:= Y + dY;
             gX:= hwRound(X);
             gY:= hwRound(Y);
-            if Target.X = NoPointX then
-            begin
-                t:= hwRound(hwSqr(X-HHGear^.X)+hwSqr(Y-HHGear^.Y));
-            end;
+            if Target.X = NoPointX then t:= hwRound(hwSqr(X-HHGear^.X)+hwSqr(Y-HHGear^.Y));
 
             if Target.X <> NoPointX then
-            begin
+                begin
                 CheckCollisionWithLand(Gear);
                 if (State and gstCollision) <> 0 then
-                begin
-                if Health = iceWaitCollision then
                     begin
-                    Health := iceCollideWithGround;
-                    Power := GameTicks;
+                    if Timer = iceWaitCollision then
+                        begin
+                        Timer := iceCollideWithGround;
+                        Power := GameTicks;
+                        end
                     end
-                end
                 else if (target.y >= cWaterLine) then
                     begin
-                    if Health = iceWaitCollision then
+                    if Timer = iceWaitCollision then
                         begin
-                        Health := iceCollideWithWater;
+                        Timer := iceCollideWithWater;
                         Power := GameTicks;
                         end;
                     end;
@@ -5187,7 +5184,7 @@
                     Y:= HHGear^.Y
                     end;
 
-                if (Health = iceCollideWithGround) and ((GameTicks - Power) > groundFreezingTime) then
+                if (Timer = iceCollideWithGround) and ((GameTicks - Power) > groundFreezingTime) then
                     begin
                     FillRoundInLand(target.x, target.y, iceRadius, icePixel);
                     landRect.x := min(max(target.x - iceRadius, 0), LAND_WIDTH - 1);
@@ -5198,14 +5195,14 @@
 
                     // FillRoundInLandWithIce(Target.X, Target.Y, iceRadius);
                     SetAllHHToActive;
-                    Health := iceWaitCollision;
+                    Timer := iceWaitCollision;
                     end;
 
-                if (Health = iceCollideWithWater) and ((GameTicks - Power) > groundFreezingTime) then
+                if (Timer = iceCollideWithWater) and ((GameTicks - Power) > groundFreezingTime) then
                     begin
                     DrawIceBreak(Target.X, cWaterLine - iceHeight, iceRadius, iceHeight);
                     SetAllHHToActive;
-                    Health := iceWaitCollision;
+                    Timer := iceWaitCollision;
                     end;
 
 // freeze nearby hogs
@@ -5222,16 +5219,16 @@
                                     hogs.ar^[i]^.Hedgehog^.Effects[heFrozen]:= 200000;//cHedgehogTurnTime + cReadyDelay
                                 end;
                 inc(Pos)
-            end
+                end
             else if (t > 400) and ((gY > cWaterLine) or
                     (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0))
                         and (Land[gY, gX] <> 0))) then
-            begin
+                begin
                 Target.X:= gX;
                 Target.Y:= gY;
                 X:= HHGear^.X;
                 Y:= HHGear^.Y
-            end;
+                end;
             {if (gX > max(LAND_WIDTH,4096)*2) or
                     (gX < -max(LAND_WIDTH,4096)) or
                     (gY < -max(LAND_HEIGHT,4096)) or
--- a/hedgewars/uAIMisc.pas	Thu Mar 28 17:41:40 2013 +0100
+++ b/hedgewars/uAIMisc.pas	Fri Mar 29 14:47:01 2013 +0100
@@ -266,7 +266,7 @@
         MeX:= hwRound(Me^.X);
         MeY:= hwRound(Me^.Y);
         // We are still inside the hog. Skip radius test
-        if ((((x-MeX)*(x-MeX)) + ((y-MeY)*(y-MeY))) < 256) and (Land[y, x] <= lfAllObjMask) then
+        if ((((x-MeX)*(x-MeX)) + ((y-MeY)*(y-MeY))) < 256) and (Land[y, x] <= lfAllObjMask) and ((Land[y, x] and lfObjMask) < 2) then
             exit(false);
     end;
     TestCollExcludingMe:= TestColl(x, y, r)