--- a/hedgewars/uUtils.pas Fri Oct 27 19:54:27 2017 +0200
+++ b/hedgewars/uUtils.pas Sat Oct 28 04:53:21 2017 +0200
@@ -600,15 +600,19 @@
function CalcWorldWrap(X, radius: LongInt): LongInt;
begin
if WorldEdge = weWrap then
- if X < LongInt(leftX) then
- X:= X + (LongInt(rightX) - LongInt(leftX))
- else if X > LongInt(rightX) then
- X:= X - (LongInt(rightX) - LongInt(leftX))
+ begin
+ if X < leftX then
+ X:= X + (rightX - leftX)
+ else if X > rightX then
+ X:= X - (rightX - leftX);
+ end
else if WorldEdge = weBounce then
- if X - radius < LongInt(leftX) then
- X:= LongInt(leftX) + radius
- else if X + radius > LongInt(rightX) then
- X:= LongInt(rightX) - radius;
+ begin
+ if (X + radius) < leftX then
+ X:= leftX + radius
+ else if (X - radius) > rightX then
+ X:= rightX - radius;
+ end;
CalcWorldWrap:= X;
end;