hedgewars/uTeams.pas
changeset 2040 7c366fc3c099
parent 2017 7845c77c8d31
child 2042 905c554d62e6
--- a/hedgewars/uTeams.pas	Fri May 08 18:20:06 2009 +0000
+++ b/hedgewars/uTeams.pas	Sat May 09 11:56:46 2009 +0000
@@ -104,6 +104,7 @@
 procedure RestoreTeamsFromSave;
 function  CheckForWin: boolean;
 procedure TeamGone(s: shortstring);
+procedure TeamGoneEffect(var Team: TTeam);
 
 implementation
 uses uMisc, uWorld, uAI, uLocale, uConsole, uAmmos, uChat, uVisualGears;
@@ -197,9 +198,9 @@
 					CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
 				until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
 				end
-		until ((CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (not CurrentTeam^.hasGone)) or (PrevTeam = CurrTeam);
+		until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam);
 		end
-until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (not CurrentTeam^.hasGone);
+until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil);
 
 CurrentHedgehog:= @(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog])
 end;
@@ -368,7 +369,7 @@
 end;
 
 procedure TeamGone(s: shortstring);
-var i, t: LongInt;
+var t: LongInt;
 begin
 t:= 0;
 while (t < cMaxTeams)
@@ -379,22 +380,22 @@
 with TeamsArray[t]^ do
 	begin
 	AddChatString('** '+ TeamName + ' is gone');
-	for i:= 0 to cMaxHHIndex do
-		with Hedgehogs[i] do
-			if Gear <> nil then
-				begin
-				if Gear^.State and gstAttacking <> 0 then
-					AttackBar:= 0;
-					
-				Gear^.State:= Gear^.State and not gstHHDriven
-				end;
-
 	hasGone:= true
 	end;
 	
 RecountTeamHealth(TeamsArray[t])
 end;
 
+procedure TeamGoneEffect(var Team: TTeam);
+var i: LongInt;
+begin
+with Team do
+	for i:= 0 to cMaxHHIndex do
+		with Hedgehogs[i] do
+			if Gear <> nil then
+				Gear^.Damage:= Gear^.Health
+end;
+
 initialization
 
 finalization