void CTeam::Died(bool normalDeath) { if (isDead) return; if (normalDeath) { // this message is not relayed to clients, it's only for the server net->Send(CBaseNetProtocol::Get().SendTeamDied(gu->myPlayerNum, teamNum)); } KillAIs(); // demote all players in _this_ team to spectators for (int a = 0; a < playerHandler->ActivePlayers(); ++a) { if (playerHandler->Player(a)->team == teamNum) { playerHandler->Player(a)->StartSpectating(); playerHandler->Player(a)->SetControlledTeams(); } } // increase per-team unit-limit for each remaining team in _our_ allyteam teamHandler->UpdateTeamUnitLimitsPreDeath(teamNum); eventHandler.TeamDied(teamNum); isDead = true; }
void CTeam::Died(bool normalDeath) { if (isDead) return; isDead = true; if (normalDeath) { if (leader >= 0) { const CPlayer* leadPlayer = playerHandler->Player(leader); const char* leaderName = leadPlayer->name.c_str(); LOG(CMessages::Tr("Team %i (lead by %s) is no more").c_str(), teamNum, leaderName); } else { LOG(CMessages::Tr("Team %i is no more").c_str(), teamNum); } // this message is not relayed to clients, it's only for the server net->Send(CBaseNetProtocol::Get().SendTeamDied(gu->myPlayerNum, teamNum)); } KillAIs(); // demote all players in _this_ team to spectators for (int a = 0; a < playerHandler->ActivePlayers(); ++a) { if (playerHandler->Player(a)->team == teamNum) { playerHandler->Player(a)->StartSpectating(); playerHandler->Player(a)->SetControlledTeams(); } } eventHandler.TeamDied(teamNum); }