Don't test for hasGone in unapproved places. Now any possibility of desync on player quit is ruled out. Not tested at all.
--- a/hedgewars/HHHandlers.inc Fri Sep 09 15:52:59 2011 +0200
+++ b/hedgewars/HHHandlers.inc Fri Sep 09 22:04:40 2011 +0400
@@ -1034,7 +1034,7 @@
PrvInactive:= false;
AllInactive:= false;
- if not Gear^.Hedgehog^.Team^.hasGone then
+ if (Gear^.State and gstHHGone) = 0 then
begin
Gear^.Hedgehog^.Effects[hePoisoned] := false;
if Gear^.Hedgehog^.Effects[heResurrectable] then begin
@@ -1048,21 +1048,8 @@
end
else
begin
- Gear^.State:= Gear^.State or gstHHGone;
Gear^.doStep:= @doStepHedgehogGone;
- with Gear^.Hedgehog^.Team^ do
- for i:= 0 to cMaxHHIndex do
- if Hedgehogs[i].GearHidden <> nil then
- begin
- RestoreHog(@Hedgehogs[i]);
- if Hedgehogs[i].Gear <> nil then
- begin
- Hedgehogs[i].Gear^.State:= Gear^.State or gstHHGone;
- Hedgehogs[i].Gear^.doStep:= @doStepHedgehogGone
- end
- end;
-
// Gone message
AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
end
@@ -1103,7 +1090,9 @@
else
begin
with Gear^.Hedgehog^ do
- if Team^.hasGone then TeamGoneEffect(Team^);
- doStepHedgehogDriven(Gear)
+ if Team^.hasGone then
+ TeamGoneEffect(Team^)
+ else
+ doStepHedgehogDriven(Gear)
end;
end;
--- a/hedgewars/uTeams.pas Fri Sep 09 15:52:59 2011 +0200
+++ b/hedgewars/uTeams.pas Fri Sep 09 22:04:40 2011 +0400
@@ -427,11 +427,17 @@
with Team do
for i:= 0 to cMaxHHIndex do
with Hedgehogs[i] do
+ begin
+ if Hedgehogs[i].GearHidden <> nil then
+ RestoreHog(@Hedgehogs[i]);
+
if Gear <> nil then
begin
Gear^.Invulnerable:= false;
- Gear^.Damage:= Gear^.Health
+ Gear^.Damage:= Gear^.Health;
+ Gear^.State:= Gear^.State or gstHHGone
end
+ end
end;
procedure chAddHH(var id: shortstring);