| 648 | } |
| 649 | |
| 650 | void UniverseServer::updateTeams() { |
| 651 | RecursiveMutexLocker locker(m_mainLock); |
| 652 | ReadLocker clientsLocker(m_clientsLock); |
| 653 | |
| 654 | StringMap<List<Uuid>> connectedPlayers; |
| 655 | auto teams = m_teamManager->getPvpTeams(); |
| 656 | for (auto const& p : m_clients) { |
| 657 | connectedPlayers[p.second->playerName()].append(p.second->playerUuid()); |
| 658 | |
| 659 | if (p.second->team().type == TeamType::PVP) |
| 660 | p.second->setTeam(EntityDamageTeam(TeamType::PVP, teams.value(p.second->playerUuid(), soloPvpTeam(p.second->clientId())))); |
| 661 | else |
| 662 | p.second->setTeam(EntityDamageTeam(TeamType::Friendly)); |
| 663 | |
| 664 | auto channels = m_chatProcessor->clientChannels(p.first); |
| 665 | auto team = m_teamManager->getTeam(p.second->playerUuid()); |
| 666 | for (auto const& channel : channels) { |
| 667 | if (channel != printWorldId(p.second->playerWorldId()) && (!team || channel != team.value().hex())) |
| 668 | m_chatProcessor->leaveChannel(p.first, channel); |
| 669 | } |
| 670 | if (team && !channels.contains(team.value().hex())) |
| 671 | m_chatProcessor->joinChannel(p.first, team.value().hex()); |
| 672 | |
| 673 | } |
| 674 | |
| 675 | m_teamManager->setConnectedPlayers(connectedPlayers); |
| 676 | } |
| 677 | |
| 678 | void UniverseServer::updateShips() { |
| 679 | RecursiveMutexLocker locker(m_mainLock); |
nothing calls this directly
no test coverage detected