# HG changeset patch
# User sheepluva
# Date 1346697994 -7200
# Node ID 3046ad5b361e97c1f031f28d31448197ecc1b3cb
# Parent  8398faa1e62868dad51ad987c3622937bf8e0c50
fix for issue 376 (embedding barrels in ceiling)

diff -r 8398faa1e628 -r 3046ad5b361e hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Mon Sep 03 14:08:01 2012 -0400
+++ b/hedgewars/GSHandlers.inc	Mon Sep 03 20:46:34 2012 +0200
@@ -1771,14 +1771,17 @@
     or (TestCollisionYwithGear(Gear, 1) = 0) then
         begin
         AllInactive := false;
+
         Gear^.dY := Gear^.dY + cGravity;
+
+        if (Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, -1) <> 0) then
+            Gear^.dY := _0;
+
         Gear^.Y := Gear^.Y + Gear^.dY;
+
         if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then
             SetAllHHToActive;
-            
-        if (Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, -1) <> 0) then
-            Gear^.dY := _0;
-            
+
         if (not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) <> 0) then
             begin
             if (Gear^.dY > _0_2) and (k = gtExplosives) then