hedgewars/uGearsUtils.pas
changeset 11555 881231c1ba46
parent 11484 846a3b3a3d1c
child 11556 aefc770feb65
--- a/hedgewars/uGearsUtils.pas	Mon Feb 15 23:37:48 2016 +0100
+++ b/hedgewars/uGearsUtils.pas	Tue Feb 16 03:19:23 2016 +0100
@@ -1170,6 +1170,8 @@
     begin
     dec(i);
     Gear:= t^.ar[i];
+    if (Ammo^.Data <> nil) and (Ammo^.Kind in [gtShotgunShot, gtDEagleShot, gtSniperRifleShot, gtSineGunShot]) and (PGear(Ammo^.Data) = Gear) then
+        continue;
     if ((Ammo^.Kind = gtFlame) or (Ammo^.Kind = gtBlowTorch)) and
        (Gear^.Kind = gtHedgehog) and (Gear^.Hedgehog^.Effects[heFrozen] > 255) then
         Gear^.Hedgehog^.Effects[heFrozen]:= max(255,Gear^.Hedgehog^.Effects[heFrozen]-10000);
@@ -1510,6 +1512,9 @@
 if (hwRound(Gear^.X) < LongInt(leftX)) or
    (hwRound(Gear^.X) > LongInt(rightX)) then
     begin
+    // bullets can now hurt the hog that fired them
+    if (WorldEdge <> weSea) and (Gear^.Kind in [gtShotgunShot, gtDEagleShot, gtSniperRifleShot, gtSineGunShot]) then
+        Gear^.Data:= nil;
     if WorldEdge = weWrap then
         begin
         if (hwRound(Gear^.X) < LongInt(leftX)) then