Send spectator list to joining players.

This commit is contained in:
lotodore
2013-09-28 18:58:43 +02:00
parent a304903883
commit 8baecdf9e0
3 changed files with 32 additions and 0 deletions
+9
View File
@@ -460,6 +460,15 @@ AbstractServerGameStateReceiving::AcceptNewSession(boost::shared_ptr<ServerGame>
++player_i;
}
// Send notifications for connected spectators to client.
PlayerDataList tmpSpectatorList(server->GetSessionManager().GetSpectatorDataList());
PlayerDataList::iterator spectator_i = tmpSpectatorList.begin();
PlayerDataList::iterator spectator_end = tmpSpectatorList.end();
while (spectator_i != spectator_end) {
server->GetLobbyThread().GetSender().Send(session, CreateNetPacketSpectatorJoined(server->GetId(), *(*spectator_i)));
++spectator_i;
}
// Send "Player Joined"/"Spectator Joined" to other fully connected clients.
if (spectateOnly) {
server->SendToAllPlayers(CreateNetPacketSpectatorJoined(server->GetId(), *session->GetPlayerData()), SessionData::Game | SessionData::Spectating | SessionData::SpectatorWaiting);