hedgewars/uTeams.pas
changeset 5016 9347d82a26cc
parent 4978 0ef650ea3b12
child 5021 ca09bfa0414c
equal deleted inserted replaced
5015:1859a471488b 5016:9347d82a26cc
    55 
    55 
    56 if (AliveCount > 1)
    56 if (AliveCount > 1)
    57 or ((AliveCount = 1) and ((GameFlags and gfOneClanMode) <> 0)) then exit(false);
    57 or ((AliveCount = 1) and ((GameFlags and gfOneClanMode) <> 0)) then exit(false);
    58 CheckForWin:= true;
    58 CheckForWin:= true;
    59 
    59 
       
    60 if TagTurnTimeLeft = 0 then TagTurnTimeLeft:= TurnTimeLeft;
    60 TurnTimeLeft:= 0;
    61 TurnTimeLeft:= 0;
    61 ReadyTimeLeft:= 0;
    62 ReadyTimeLeft:= 0;
    62 if not GameOver then
    63 if not GameOver then
    63     begin
    64     begin
    64     if AliveCount = 0 then
    65     if AliveCount = 0 then
   139         LocalAmmo:= Hedgehogs[c].AmmoStore
   140         LocalAmmo:= Hedgehogs[c].AmmoStore
   140         end;
   141         end;
   141 
   142 
   142 c:= CurrentTeam^.Clan^.ClanIndex;
   143 c:= CurrentTeam^.Clan^.ClanIndex;
   143 repeat
   144 repeat
   144     inc(c);
   145     if (GameFlags And gfTagTeam) = 0 then inc(c);
   145     if c = ClansCount then
   146 
       
   147     if (c = ClansCount) and ((GameFlags And gfTagTeam) = 0) then
   146         begin
   148         begin
   147         if not PlacingHogs then inc(TotalRounds);
   149         if not PlacingHogs then inc(TotalRounds);
   148         c:= 0
   150         c:= 0
   149         end;
   151         end;
       
   152 
       
   153     with ClansArray[c]^ do
       
   154         if (CurrTeam = TagTeamIndex) and ((GameFlags And gfTagTeam) <> 0) then
       
   155             begin
       
   156             TagTeamIndex:= Succ(TagTeamIndex) mod TeamsNumber;
       
   157             CurrTeam:= Succ(CurrTeam) mod TeamsNumber;
       
   158             c:= Succ(c) mod ClansCount;
       
   159             NextClan:= true;
       
   160             end;
   150 
   161 
   151     with ClansArray[c]^ do
   162     with ClansArray[c]^ do
   152         begin
   163         begin
   153         PrevTeam:= CurrTeam;
   164         PrevTeam:= CurrTeam;
   154         repeat
   165         repeat
   228 if not CurrentTeam^.ExtDriven then SetBinds(CurrentTeam^.Binds);
   239 if not CurrentTeam^.ExtDriven then SetBinds(CurrentTeam^.Binds);
   229 
   240 
   230 bShowFinger:= true;
   241 bShowFinger:= true;
   231 
   242 
   232 if PlacingHogs then
   243 if PlacingHogs then
   233    begin
   244     begin
   234    if CurrentHedgehog^.Unplaced then TurnTimeLeft:= 15000
   245     if CurrentHedgehog^.Unplaced then TurnTimeLeft:= 15000
   235    else TurnTimeLeft:= 0
   246     else TurnTimeLeft:= 0
   236    end
   247     end
   237 else TurnTimeLeft:= cHedgehogTurnTime;
   248 else if ((GameFlags And gfTagTeam) <> 0) and not NextClan then
       
   249     begin
       
   250     TurnTimeLeft:= TagTurnTimeLeft;
       
   251     TagTurnTimeLeft:= 0;
       
   252     end
       
   253 else
       
   254     begin
       
   255     TurnTimeLeft:= cHedgehogTurnTime;
       
   256     TagTurnTimeLeft:= 0;
       
   257     NextClan:= false;
       
   258     end;
   238 if (TurnTimeLeft > 0) and (CurrentHedgehog^.BotLevel = 0) then
   259 if (TurnTimeLeft > 0) and (CurrentHedgehog^.BotLevel = 0) then
   239     begin
   260     begin
   240     if CurrentTeam^.ExtDriven then
   261     if CurrentTeam^.ExtDriven then
   241         PlaySound(sndIllGetYou, CurrentTeam^.voicepack)
   262         PlaySound(sndIllGetYou, CurrentTeam^.voicepack)
   242     else
   263     else
   280    inc(ClansCount);
   301    inc(ClansCount);
   281    with team^.Clan^ do
   302    with team^.Clan^ do
   282         begin
   303         begin
   283         ClanIndex:= Pred(ClansCount);
   304         ClanIndex:= Pred(ClansCount);
   284         Color:= TeamColor;
   305         Color:= TeamColor;
       
   306         TagTeamIndex:= 0;
   285         Flawless:= true
   307         Flawless:= true
   286         end
   308         end
   287    end else
   309    end else
   288    begin
   310    begin
   289    team^.Clan:= ClansArray[c];
   311    team^.Clan:= ClansArray[c];
   530     TeamsCount:= 0;
   552     TeamsCount:= 0;
   531     ClansCount:= 0;
   553     ClansCount:= 0;
   532     LocalClan:= -1;
   554     LocalClan:= -1;
   533     LocalTeam:= -1;
   555     LocalTeam:= -1;
   534     LocalAmmo:= -1;
   556     LocalAmmo:= -1;
   535     GameOver:= false
   557     GameOver:= false;
       
   558     NextClan:= true;
   536 end;
   559 end;
   537 
   560 
   538 procedure freeModule;
   561 procedure freeModule;
   539 var i, h: LongWord;
   562 var i, h: LongWord;
   540 begin
   563 begin
   548             Dispose(TeamsArray[i]);
   571             Dispose(TeamsArray[i]);
   549         end;
   572         end;
   550      for i:= 0 to Pred(ClansCount) do Dispose(ClansArray[i]);
   573      for i:= 0 to Pred(ClansCount) do Dispose(ClansArray[i]);
   551      end;
   574      end;
   552    TeamsCount:= 0;
   575    TeamsCount:= 0;
   553    ClansCount:= 0
   576    ClansCount:= 0;
   554 end;
   577 end;
   555 
   578 
   556 end.
   579 end.