Synchronize on network game start, so that everyone has received all avatars and player names before the game starts. Store all computer players in a separate list on the server for name retrieval.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include <net/sessiondata.h>
|
||||
|
||||
SessionData::SessionData(SOCKET sockfd, unsigned id)
|
||||
: m_sockfd(sockfd), m_id(id), m_state(SessionData::Init)
|
||||
: m_sockfd(sockfd), m_id(id), m_state(SessionData::Init), m_readyFlag(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,6 +58,27 @@ SessionData::GetSocket() const
|
||||
return m_sockfd;
|
||||
}
|
||||
|
||||
void
|
||||
SessionData::SetReadyFlag()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||
m_readyFlag = true;
|
||||
}
|
||||
|
||||
void
|
||||
SessionData::ResetReadyFlag()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||
m_readyFlag = false;
|
||||
}
|
||||
|
||||
bool
|
||||
SessionData::IsReady() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||
return m_readyFlag;
|
||||
}
|
||||
|
||||
const std::string &
|
||||
SessionData::GetClientAddr() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user