--- a/hedgewars/uGearsRender.pas Tue Sep 11 22:49:27 2018 +0200
+++ b/hedgewars/uGearsRender.pas Wed Sep 12 19:51:45 2018 +0300
@@ -301,7 +301,7 @@
sign, hx, hy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction
dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real; // laser, change
wraps: LongWord; // numbe of wraps for laser in world wrap
- defaultPos, HatVisible: boolean;
+ defaultPos, HatVisible, inWorldBounds: boolean;
HH: PHedgehog;
CurWeapon: PAmmo;
iceOffset:Longint;
@@ -444,7 +444,8 @@
hx:= tx;
hy:= ty;
wraps:= 0;
- while ((Land[ty, tx] and lfAll) = 0) do
+ inWorldBounds := ((ty and LAND_HEIGHT_MASK) or (tx and LAND_WIDTH_MASK)) = 0;
+ while inWorldBounds and ((Land[ty, tx] and lfAll) = 0) do
begin
if wraps > cMaxLaserSightWraps then
break;