Allow retrieving of own player id by gui.
This commit is contained in:
@@ -91,6 +91,7 @@ public:
|
|||||||
bool GetPlayerIdFromName(const std::string &playerName, unsigned &playerId) const;
|
bool GetPlayerIdFromName(const std::string &playerName, unsigned &playerId) const;
|
||||||
ServerStats GetStatData() const;
|
ServerStats GetStatData() const;
|
||||||
unsigned GetGameId() const;
|
unsigned GetGameId() const;
|
||||||
|
unsigned GetGuiPlayerId() const;
|
||||||
|
|
||||||
Gsasl *GetAuthContext();
|
Gsasl *GetAuthContext();
|
||||||
|
|
||||||
@@ -158,7 +159,6 @@ protected:
|
|||||||
void SetGameData(const GameData &gameData);
|
void SetGameData(const GameData &gameData);
|
||||||
const StartData &GetStartData() const;
|
const StartData &GetStartData() const;
|
||||||
void SetStartData(const StartData &startData);
|
void SetStartData(const StartData &startData);
|
||||||
unsigned GetGuiPlayerId() const;
|
|
||||||
void SetGuiPlayerId(unsigned guiPlayerId);
|
void SetGuiPlayerId(unsigned guiPlayerId);
|
||||||
|
|
||||||
boost::shared_ptr<Game> GetGame();
|
boost::shared_ptr<Game> GetGame();
|
||||||
@@ -259,6 +259,7 @@ private:
|
|||||||
|
|
||||||
unsigned m_curGameNum;
|
unsigned m_curGameNum;
|
||||||
unsigned m_guiPlayerId;
|
unsigned m_guiPlayerId;
|
||||||
|
mutable boost::mutex m_guiPlayerIdMutex;
|
||||||
bool m_sessionEstablished;
|
bool m_sessionEstablished;
|
||||||
|
|
||||||
mutable boost::mutex m_curStatsMutex;
|
mutable boost::mutex m_curStatsMutex;
|
||||||
|
|||||||
@@ -963,12 +963,14 @@ ClientThread::SetStartData(const StartData &startData)
|
|||||||
unsigned
|
unsigned
|
||||||
ClientThread::GetGuiPlayerId() const
|
ClientThread::GetGuiPlayerId() const
|
||||||
{
|
{
|
||||||
|
boost::mutex::scoped_lock lock(m_guiPlayerIdMutex);
|
||||||
return m_guiPlayerId;
|
return m_guiPlayerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientThread::SetGuiPlayerId(unsigned guiPlayerId)
|
ClientThread::SetGuiPlayerId(unsigned guiPlayerId)
|
||||||
{
|
{
|
||||||
|
boost::mutex::scoped_lock lock(m_guiPlayerIdMutex);
|
||||||
m_guiPlayerId = guiPlayerId;
|
m_guiPlayerId = guiPlayerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -490,6 +490,14 @@ unsigned Session::getClientCurrentGameId() const
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned Session::getClientUniquePlayerId() const
|
||||||
|
{
|
||||||
|
unsigned id = 0;
|
||||||
|
if (myNetClient)
|
||||||
|
id = myNetClient->GetGuiPlayerId();
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
bool Session::getAvatarFile(const MD5Buf &avatarMD5, std::string &fileName)
|
bool Session::getAvatarFile(const MD5Buf &avatarMD5, std::string &fileName)
|
||||||
{
|
{
|
||||||
bool retVal = false;
|
bool retVal = false;
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ public:
|
|||||||
PlayerInfo getClientPlayerInfo(unsigned playerId) const;
|
PlayerInfo getClientPlayerInfo(unsigned playerId) const;
|
||||||
ServerStats getClientStats() const;
|
ServerStats getClientStats() const;
|
||||||
unsigned getClientCurrentGameId() const;
|
unsigned getClientCurrentGameId() const;
|
||||||
|
unsigned getClientUniquePlayerId() const;
|
||||||
|
|
||||||
bool getAvatarFile(const MD5Buf &avatarMD5, std::string &fileName);
|
bool getAvatarFile(const MD5Buf &avatarMD5, std::string &fileName);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user