Add spectator list during the game (when lobby messages are disabled).
This commit is contained in:
@@ -1454,6 +1454,48 @@ ClientThread::ModifyGameInfoRemoveSpectator(unsigned gameId, unsigned playerId)
|
||||
GetCallback().SignalNetClientGameListSpectatorLeft(gameId, playerId);
|
||||
}
|
||||
|
||||
void
|
||||
ClientThread::ModifyGameInfoClearSpectatorsDuringGame()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_gameInfoMapMutex);
|
||||
GameInfoMap::iterator pos = m_gameInfoMap.find(GetGameId());
|
||||
if (pos != m_gameInfoMap.end()) {
|
||||
pos->second.spectatorsDuringGame.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ClientThread::ModifyGameInfoAddSpectatorDuringGame(unsigned playerId)
|
||||
{
|
||||
bool spectatorAdded = false;
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_gameInfoMapMutex);
|
||||
GameInfoMap::iterator pos = m_gameInfoMap.find(GetGameId());
|
||||
if (pos != m_gameInfoMap.end()) {
|
||||
pos->second.spectatorsDuringGame.push_back(playerId);
|
||||
spectatorAdded = true;
|
||||
}
|
||||
}
|
||||
if (spectatorAdded)
|
||||
GetCallback().SignalNetClientSpectatorJoined(playerId, GetPlayerName(playerId));
|
||||
}
|
||||
|
||||
void
|
||||
ClientThread::ModifyGameInfoRemoveSpectatorDuringGame(unsigned playerId, int removeReason)
|
||||
{
|
||||
bool spectatorRemoved = false;
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_gameInfoMapMutex);
|
||||
GameInfoMap::iterator pos = m_gameInfoMap.find(GetGameId());
|
||||
if (pos != m_gameInfoMap.end()) {
|
||||
pos->second.spectatorsDuringGame.remove(playerId);
|
||||
spectatorRemoved = true;
|
||||
}
|
||||
}
|
||||
if (spectatorRemoved)
|
||||
GetCallback().SignalNetClientSpectatorLeft(playerId, GetPlayerName(playerId), removeReason);
|
||||
}
|
||||
|
||||
void
|
||||
ClientThread::ClearGameInfoMap()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user