hedgewars/uGearsUtils.pas
changeset 10160 4608f10ae65f
parent 10124 aabd1b75d5a3
child 10245 3ccc054c3c3e
--- a/hedgewars/uGearsUtils.pas	Mon Feb 24 13:41:32 2014 -0500
+++ b/hedgewars/uGearsUtils.pas	Wed Feb 26 00:28:27 2014 +0400
@@ -1232,14 +1232,14 @@
 begin
 WorldWrap:= false;
 if WorldEdge = weNone then exit(false);
-if (hwRound(Gear^.X) - Gear^.Radius < LongInt(leftX)) or
-   (hwRound(Gear^.X) + LongInt(Gear^.Radius) > LongInt(rightX)) then
+if (hwRound(Gear^.X) < LongInt(leftX)) or
+   (hwRound(Gear^.X) > LongInt(rightX)) then
     begin
     if WorldEdge = weWrap then
         begin
-        if (hwRound(Gear^.X) - Gear^.Radius < LongInt(leftX)) then
-             Gear^.X:= int2hwfloat(rightX - Gear^.Radius)
-        else Gear^.X:= int2hwfloat(LongInt(leftX) + Gear^.Radius);
+        if (hwRound(Gear^.X) < LongInt(leftX)) then
+             Gear^.X:= Gear^.X + int2hwfloat(rightX - leftX)
+        else Gear^.X:= Gear^.X - int2hwfloat(rightX - leftX);
         LeftImpactTimer:= 150;
         RightImpactTimer:= 150
         end