# HG changeset patch # User nemo # Date 1424207154 18000 # Node ID 19d056c10bbd11568e1256d492aee18db6ec6e23 # Parent f3e903ace2d3f236b865fde9632a4b4af19eb019 Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear diff -r f3e903ace2d3 -r 19d056c10bbd hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Tue Feb 17 12:09:27 2015 -0500 +++ b/hedgewars/uGearsHandlersMess.pas Tue Feb 17 16:05:54 2015 -0500 @@ -1382,6 +1382,7 @@ dec(TurnTimeLeft) else begin + HHGear^.State := HHGear^.State and (not gstNotKickable); DeleteGear(Gear); AfterAttack end; @@ -3567,6 +3568,11 @@ AllInactive := false; dec(Gear^.Timer); HHGear := Gear^.Hedgehog^.Gear; + if HHGear = nil then + begin + DeleteGear(gear); + exit + end; HedgehogChAngle(HHGear); gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); @@ -3583,6 +3589,7 @@ if (Gear^.Timer = 0) or ((HHGear^.State and gstHHDriven) = 0) then begin + HHGear^.State := HHGear^.State and (not gstNotKickable); DeleteGear(Gear); AfterAttack end @@ -3639,7 +3646,7 @@ else if Gear^.Angle < 2048 then inc(Gear^.Angle) else fChanged := false - end + end else begin if ((Gear^.Message and gmLeft) <> 0) then @@ -3714,6 +3721,7 @@ AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, -dY, 0); end; + if HHGear <> nil then HHGear^.State := HHGear^.State and (not gstNotKickable); DeleteGear(Gear) end; @@ -4970,6 +4978,11 @@ begin AllInactive := false; HHGear := Gear^.Hedgehog^.Gear; + if HHGear = nil then + begin + DeleteGear(gear); + exit + end; HedgehogChAngle(HHGear); gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); @@ -5022,6 +5035,7 @@ if (Gear^.Health = 0) or ((HHGear^.State and gstHHDriven) = 0) then begin + HHGear^.State := HHGear^.State and (not gstNotKickable); DeleteGear(Gear); AfterAttack end @@ -5057,6 +5071,11 @@ begin AllInactive := false; HHGear := Gear^.Hedgehog^.Gear; + if HHGear = nil then + begin + DeleteGear(gear); + exit + end; HedgehogChAngle(HHGear); gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); @@ -5099,6 +5118,7 @@ if (Gear^.Health = 0) or ((HHGear^.State and gstHHDriven) = 0) or ((HHGear^.Message and gmAttack) <> 0) then begin HHGear^.Message:= HHGear^.Message and (not gmAttack); + HHGear^.State := HHGear^.State and (not gstNotKickable); DeleteGear(Gear); AfterAttack end