# HG changeset patch
# User unc0rr
# Date 1316462152 -14400
# Node ID 07f6fa51ea5842e8124eea569c2afaceb9249011
# Parent  ba168fa3451a3d6737f8b4d0b74e118d3fa442a5
 - Unset hhdriven flag for gone hedgehog
 - Fix incorrect work with states in gstWait state handler
 - These two changes fix the bug with hogs of gone team not disappearing

diff -r ba168fa3451a -r 07f6fa51ea58 hedgewars/HHHandlers.inc
--- a/hedgewars/HHHandlers.inc	Sat Sep 17 10:22:35 2011 -0400
+++ b/hedgewars/HHHandlers.inc	Mon Sep 19 23:55:52 2011 +0400
@@ -1064,13 +1064,13 @@
 if ((Gear^.State and gstWait) = 0) and
     (prevState <> Gear^.State) then
     begin
-    Gear^.State:= gstWait;
+    Gear^.State:= Gear^.State or gstWait;
     Gear^.Timer:= 150
     end else
     begin
     if Gear^.Timer = 0 then
         begin
-        Gear^.State:= 0;
+        Gear^.State:= Gear^.State and not gstWait;
         Gear^.Active:= false;
         AddGearCI(Gear);
         exit
@@ -1094,7 +1094,7 @@
 else
     begin
     with Gear^.Hedgehog^ do
-        if Team^.hasGone then 
+        if Team^.hasGone then
             TeamGoneEffect(Team^)
         else
             doStepHedgehogDriven(Gear)
diff -r ba168fa3451a -r 07f6fa51ea58 hedgewars/uTeams.pas
--- a/hedgewars/uTeams.pas	Sat Sep 17 10:22:35 2011 -0400
+++ b/hedgewars/uTeams.pas	Mon Sep 19 23:55:52 2011 +0400
@@ -435,7 +435,7 @@
                 begin
                 Gear^.Invulnerable:= false;
                 Gear^.Damage:= Gear^.Health;
-                Gear^.State:= Gear^.State or gstHHGone
+                Gear^.State:= (Gear^.State or gstHHGone) and not gstHHDriven
                 end
             end
 end;