--- a/hedgewars/uTeams.pas Mon Oct 13 18:37:59 2008 +0000
+++ b/hedgewars/uTeams.pas Mon Oct 13 19:04:27 2008 +0000
@@ -65,7 +65,7 @@
DrawHealthY: LongInt;
AttackBar: LongWord;
HedgehogsNumber: Longword;
- hasSurrendered: boolean;
+ hasGone: boolean;
end;
TClan = record
@@ -94,9 +94,10 @@
procedure RecountTeamHealth(team: PTeam);
procedure RestoreTeamsFromSave;
function CheckForWin: boolean;
+procedure TeamGone(s: shortstring);
implementation
-uses uMisc, uWorld, uAI, uLocale, uConsole, uAmmos, uSound;
+uses uMisc, uWorld, uAI, uLocale, uConsole, uAmmos, uSound, uChat;
const MaxTeamHealth: LongInt = 0;
procedure FreeTeamsList; forward;
@@ -174,8 +175,9 @@
end;
with ClansArray[c]^ do
+ begin
+ PrevTeam:= CurrTeam;
repeat
- PrevTeam:= CurrTeam;
CurrTeam:= Succ(CurrTeam) mod TeamsNumber;
CurrentTeam:= Teams[CurrTeam];
with CurrentTeam^ do
@@ -185,8 +187,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^.hasSurrendered)) or (PrevTeam = CurrTeam);
-until CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil;
+ until ((CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (not CurrentTeam^.hasGone)) or (PrevTeam = CurrTeam);
+ end
+until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (not CurrentTeam^.hasGone);
CurrentHedgehog:= @(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog])
end;
@@ -351,6 +354,24 @@
TeamsArray[t]^.ExtDriven:= false
end;
+procedure TeamGone(s: shortstring);
+var i: integer;
+begin
+i:= 0;
+
+while (i < cMaxTeams)
+ and (TeamsArray[i] <> nil)
+ and (TeamsArray[i]^.TeamName <> s) do inc(i);
+if (i = cMaxTeams) or (TeamsArray[i] = nil) then exit;
+
+with TeamsArray[i]^ do
+ begin
+ AddChatString('* '+ TeamName + ' is gone');
+ //for i:= 0 to cMaxHHIndex do Hedgehogs[i].Gear:= nil;
+ hasGone:= true
+ end
+end;
+
initialization
finalization