# HG changeset patch # User nemo # Date 1242348697 0 # Node ID cf0d844792516e1bfc6300893fad288619df401a # Parent ed8c83f1e4b09ca696c54f2d897b31af6eb2d7e4 Prevent gaining more health than hedgehog actually has diff -r ed8c83f1e4b0 -r cf0d84479251 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Fri May 15 00:38:49 2009 +0000 +++ b/hedgewars/uGears.pas Fri May 15 00:51:37 2009 +0000 @@ -665,11 +665,10 @@ var s: shortstring; vampDmg: Longword; begin - inc(Gear^.Damage, Damage); if Gear^.Kind = gtHedgehog then begin AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); - Damage:= min(Damage, Gear^.Health); + Damage:= min(Damage, max(0,Gear^.Health-Gear^.Damage)); if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (Damage >= 1) then begin if cVampiric then @@ -704,6 +703,7 @@ end; end; end; + inc(Gear^.Damage, Damage); end; procedure SetAllToActive;