# HG changeset patch
# User Wuzzy <Wuzzy2@mail.ru>
# Date 1563217981 -7200
# Node ID 44533b2e4fb1c17107fa5f75075a48e6e1c95b6b
# Parent  c70de34686ac8a03e65987ca80d9523f16ef087e
Drowning gears: Delete big gears when they're *completely* out of visible area

diff -r c70de34686ac -r 44533b2e4fb1 hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGearsHandlersMess.pas	Mon Jul 15 20:46:50 2019 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Mon Jul 15 21:13:01 2019 +0200
@@ -349,8 +349,21 @@
     DeleteGear(Gear);
     exit;
     end;
-// Delete normally if gear is outside of visible range
-if (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
+// Delete gear normally if it is outside of visible range.
+// But first determine size tolerance for big gears to make sure the gear is REALLY out of range.
+if Gear^.Kind = gtPiano then
+    d:= SpritesData[sprPiano].height
+else if Gear^.Kind = gtRCPlane then
+    d:= SpritesData[sprPlane].width
+else if Gear^.Kind = gtKnife then
+    d:= SpritesData[sprKnife].height
+else if Gear^.Kind = gtDynamite then
+    d:= SpritesData[sprDynamite].height
+else if Gear^.Kind = gtSnowball then
+    d:= SpritesData[sprSnowball].height
+else
+    d:= Gear^.Radius * 2;
+if (hwRound(Gear^.Y) > d + cWaterLine + cVisibleWater) then
     DeleteGear(Gear);
 end;