# HG changeset patch # User Wuzzy # Date 1547479114 -3600 # Node ID 42f3d6860971bc443a1c02c5fc164d6cf6a9cc01 # Parent 50f511588635f142c75d513c328190d69b78814e Fix crosshair sometimes not getting removed diff -r 50f511588635 -r 42f3d6860971 hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Mon Jan 14 07:14:18 2019 +0100 +++ b/hedgewars/uGearsRender.pas Mon Jan 14 16:18:34 2019 +0100 @@ -273,7 +273,7 @@ exit; // render crosshair - if (Gear = CrosshairGear) then + if (CrosshairGear <> nil) and (Gear = CrosshairGear) then begin sign:= hwSign(Gear^.dX); m:= 1; @@ -328,6 +328,7 @@ curhat: PTexture; begin HH:= Gear^.Hedgehog; + CrosshairGear:= nil; if HH^.Unplaced then exit; if (HH^.CurAmmoType = amKnife) and (HH = CurrentHedgehog) then @@ -510,6 +511,7 @@ DrawLineWrapped(hx, hy, tx, ty, 1.0, (sign*m) < 0, wraps, $FF, $00, $00, $C0); end; + // calculate crosshair position CrosshairX := Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle)); CrosshairY := Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle)); @@ -916,7 +918,6 @@ end else // not gstHHDriven begin - CrosshairGear:= nil; // check if hedgehog is sliding/rolling if (Gear^.Damage > 0) and (HH^.Effects[heFrozen] = 0) and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then