hedgewars/uTeams.pas
changeset 10397 314164a9c912
parent 10350 4e919f7b9d92
child 10398 d9cf9ef08ba7
equal deleted inserted replaced
10396:77ff1db6d6e4 10397:314164a9c912
   651     while (t < cMaxTeams) and (TeamsArray[t] <> nil) and (TeamsArray[t]^.TeamName <> s) do
   651     while (t < cMaxTeams) and (TeamsArray[t] <> nil) and (TeamsArray[t]^.TeamName <> s) do
   652         inc(t);
   652         inc(t);
   653     if (t = cMaxTeams) or (TeamsArray[t] = nil) then
   653     if (t = cMaxTeams) or (TeamsArray[t] = nil) then
   654         exit;
   654         exit;
   655 
   655 
   656     TeamsArray[t]^.isGoneFlagPengingToBeSet:= true;
   656     TeamsArray[t]^.isGoneFlagPendingToBeSet:= true;
   657 
   657 
   658     if isSynced then
   658     if isSynced then
   659     begin
   659     begin
   660     for i:= 0 to Pred(cMaxTeams) do
   660     for i:= 0 to Pred(cMaxTeams) do
   661         with TeamsArray[i]^ do
   661         with TeamsArray[i]^ do
   662             begin
   662             begin
   663             if (not hasGone) and isGoneFlagPengingToBeSet then
   663             if (not hasGone) and isGoneFlagPendingToBeSet then
   664                 begin
   664                 begin
   665                 AddChatString('** '+ TeamName + ' is gone'); // TODO: localize
   665                 AddChatString('** '+ TeamName + ' is gone'); // TODO: localize
   666                 if not CurrentTeam^.ExtDriven then SendIPC(_S'f' + s);
   666                 if not CurrentTeam^.ExtDriven then SendIPC(_S'f' + s);
   667                 hasGone:= true;
   667                 hasGone:= true;
   668                 skippedTurns:= 0;
   668                 skippedTurns:= 0;
   669                 isGoneFlagPengingToBeSet:= false;
   669                 isGoneFlagPendingToBeSet:= false;
   670                 RecountTeamHealth(TeamsArray[i])
   670                 RecountTeamHealth(TeamsArray[i])
   671                 end;
   671                 end;
   672             if hasGone and isGoneFlagPengingToBeUnset then
   672             if hasGone and isGoneFlagPendingToBeUnset then
   673                 ParseCommand('/teamback s' + s, true);
   673                 ParseCommand('/teamback s' + s, true);
   674             end;
   674             end;
   675     end
   675     end
   676     else
   676     else
   677     begin
   677     begin
   678         TeamsArray[t]^.isGoneFlagPengingToBeSet:= true;
   678         TeamsArray[t]^.isGoneFlagPendingToBeSet:= true;
   679 
   679 
   680         if (not CurrentTeam^.ExtDriven) or (CurrentTeam^.TeamName = s) then
   680         if (not CurrentTeam^.ExtDriven) or (CurrentTeam^.TeamName = s) then
   681             ParseCommand('/teamgone s' + s, true);
   681             ParseCommand('/teamgone s' + s, true);
   682     end;
   682     end;
   683 end;
   683 end;
   705                 if not CurrentTeam^.ExtDriven then SendIPC(_S'g' + s);
   705                 if not CurrentTeam^.ExtDriven then SendIPC(_S'g' + s);
   706                 hasGone:= false;
   706                 hasGone:= false;
   707 
   707 
   708                 RecountTeamHealth(TeamsArray[t]);
   708                 RecountTeamHealth(TeamsArray[t]);
   709 
   709 
   710                 if isGoneFlagPengingToBeUnset and (Owner = UserNick) then
   710                 if isGoneFlagPendingToBeUnset and (Owner = UserNick) then
   711                     ExtDriven:= false;
   711                     ExtDriven:= false;
   712 
   712 
   713                 isGoneFlagPengingToBeUnset:= false;
   713                 isGoneFlagPendingToBeUnset:= false;
   714                 end;
   714                 end;
   715         end
   715         end
   716     else
   716     else
   717     begin
   717     begin
   718         TeamsArray[t]^.isGoneFlagPengingToBeUnset:= true;
   718         TeamsArray[t]^.isGoneFlagPendingToBeUnset:= true;
   719 
   719 
   720         if not CurrentTeam^.ExtDriven then
   720         if not CurrentTeam^.ExtDriven then
   721             ParseCommand('/teamback s' + s, true);
   721             ParseCommand('/teamback s' + s, true);
   722     end;
   722     end;
   723 end;
   723 end;