global variable for defining construction distance limit. value smaller 1 means no limit (wip)
authorsheepluva
Tue, 01 Sep 2015 23:54:13 +0200
changeset 11057 adb5ef54da54
parent 11056 62cc7f67105f
child 11058 b91667fd6f20
global variable for defining construction distance limit. value smaller 1 means no limit (wip)
hedgewars/uGearsHandlersMess.pas
hedgewars/uVariables.pas
--- a/hedgewars/uGearsHandlersMess.pas	Sun Aug 30 18:03:44 2015 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Tue Sep 01 23:54:13 2015 +0200
@@ -2769,10 +2769,10 @@
     if Gear^.AmmoType = amRubber then LandFlags:= lfBouncy
     else if cIce then LandFlags:= lfIce;
 
-    distFail:= ((Distance(tx - x, ty - y) > _256) and ((WorldEdge <> weWrap) or
+    distFail:= (cBuildMaxDist > 0) and ((hwRound(Distance(tx - x, ty - y)) > cBuildMaxDist) and ((WorldEdge <> weWrap) or
             (
-            (Distance(tx - int2hwFloat(rightX+(rx-leftX)), ty - y) > _256) and
-            (Distance(tx - int2hwFloat(leftX-(rightX-rx)), ty - y) > _256)
+            (hwRound(Distance(tx - int2hwFloat(rightX+(rx-leftX)), ty - y)) > cBuildMaxDist) and
+            (hwRound(Distance(tx - int2hwFloat(leftX-(rightX-rx)), ty - y)) > cBuildMaxDist)
             )));
     if distFail
     or (not TryPlaceOnLand(Gear^.Target.X - SpritesData[Ammoz[Gear^.AmmoType].PosSprite].Width div 2, Gear^.Target.Y - SpritesData[Ammoz[Gear^.AmmoType].PosSprite].Height div 2, Ammoz[Gear^.AmmoType].PosSprite, Gear^.State, true, LandFlags)) then
--- a/hedgewars/uVariables.pas	Sun Aug 30 18:03:44 2015 +0300
+++ b/hedgewars/uVariables.pas	Tue Sep 01 23:54:13 2015 +0200
@@ -179,6 +179,7 @@
     cElastic        : hwFloat;
     cGravity        : hwFloat;
     cGravityf       : real;
+    cBuildMaxDist   : LongInt;
     cDamageModifier : hwFloat;
     cLaserSighting  : boolean;
     cVampiric       : boolean;
@@ -2565,6 +2566,7 @@
     cElastic                := _0_9;
     cGravity                := cMaxWindSpeed * 2;
     cGravityf               := 0.00025 * 2;
+    cBuildMaxDist           := 256;
     cDamageModifier         := _1;
     TargetPoint             := cTargetPointRef;