# HG changeset patch # User alfadur # Date 1539461295 -10800 # Node ID 7163f5ec3ce2a951699252337119e41db5c57aa3 # Parent 57bac0456b866de99e369f7f64002ca92bafb25d fix offsets diff -r 57bac0456b86 -r 7163f5ec3ce2 hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Sat Oct 13 22:44:21 2018 +0300 +++ b/hedgewars/uGearsUtils.pas Sat Oct 13 23:08:15 2018 +0300 @@ -1057,13 +1057,14 @@ function CheckGearNearImpl(Kind: TGearType; X, Y: hwFloat; rX, rY: LongInt, exclude: PGear): PGear; begin var t: PGear; - halfWidth, dX, dY: hwFloat; + width, halfWidth, dX, dY: hwFloat; isHit: Boolean; begin t:= GearsList; rX:= sqr(rX); rY:= sqr(rY); - halfWidth:= int2hwFloat(RightX - LeftX) / _2; + width:= int2hwFloat(RightX - LeftX); + halfWidth:= width / _2; while t <> nil do begin @@ -1075,9 +1076,9 @@ if (not isHit) and (WorldEdge = weWrap) then begin - if (dX > halfWidth) and (not ((hwSqr(dX - halfWidth) / rX + hwSqr(dY) / rY) > _1)) then + if (dX > halfWidth) and (not ((hwSqr(dX - width) / rX + hwSqr(dY) / rY) > _1)) then isHit := true - else if (dX < -halfWidth) and (not ((hwSqr(dX + halfWidth) / rX + hwSqr(dY) / rY) > _1)) then + else if (dX < -halfWidth) and (not ((hwSqr(dX + width) / rX + hwSqr(dY) / rY) > _1)) then isHit := true end;