- Use LastDamage in CheckHHDamage
authorunc0rr
Mon, 28 Mar 2011 21:44:17 +0400
changeset 5063 d0722d0b024d
parent 5062 e2d38329b84a
child 5064 8de3d20b501e
- Use LastDamage in CheckHHDamage - Clear hedgehog's LastDamage when switching to him
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
hedgewars/uTeams.pas
--- a/hedgewars/GSHandlers.inc	Mon Mar 28 21:27:06 2011 +0400
+++ b/hedgewars/GSHandlers.inc	Mon Mar 28 21:44:17 2011 +0400
@@ -219,7 +219,10 @@
         //else
         //    PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack);
 
-        ApplyDamage(Gear, CurrentHedgehog, dmg, dsFall);
+        if Gear^.LastDamage <> nil then
+            ApplyDamage(Gear, Gear^.LastDamage, dmg, dsFall)
+            else
+            ApplyDamage(Gear, CurrentHedgehog, dmg, dsFall);
     end
 end;
 
--- a/hedgewars/uGears.pas	Mon Mar 28 21:27:06 2011 +0400
+++ b/hedgewars/uGears.pas	Mon Mar 28 21:44:17 2011 +0400
@@ -1022,7 +1022,6 @@
 
     if (Gear^.Kind = gtHedgehog) then
     begin
-
     Gear^.LastDamage := AttackerHog;
 
     Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
--- a/hedgewars/uTeams.pas	Mon Mar 28 21:27:06 2011 +0400
+++ b/hedgewars/uTeams.pas	Mon Mar 28 21:44:17 2011 +0400
@@ -211,7 +211,8 @@
         begin
         Z:= cCurrHHZ;
         State:= gstHHDriven;
-        Active:= true
+        Active:= true;
+        LastDamage:= nil
         end;
     RemoveGearFromList(Gear);
     InsertGearToList(Gear);