Added kick function with player name.
This commit is contained in:
@@ -67,6 +67,7 @@ public:
|
||||
|
||||
GameInfo GetGameInfo(unsigned playerId) const;
|
||||
PlayerInfo GetPlayerInfo(unsigned playerId) const;
|
||||
bool GetPlayerIdFromName(const std::string &playerName, unsigned &playerId) const;
|
||||
ServerStats GetStatData() const;
|
||||
|
||||
ClientCallback &GetCallback();
|
||||
|
||||
@@ -264,6 +264,28 @@ ClientThread::GetPlayerInfo(unsigned playerId) const
|
||||
return info;
|
||||
}
|
||||
|
||||
bool
|
||||
ClientThread::GetPlayerIdFromName(const string &playerName, unsigned &playerId) const
|
||||
{
|
||||
bool retVal = false;
|
||||
|
||||
boost::mutex::scoped_lock lock(m_playerInfoMapMutex);
|
||||
PlayerInfoMap::const_iterator i = m_playerInfoMap.begin();
|
||||
PlayerInfoMap::const_iterator end = m_playerInfoMap.end();
|
||||
|
||||
while (i != end)
|
||||
{
|
||||
if (i->second.playerName == playerName)
|
||||
{
|
||||
playerId = i->first;
|
||||
retVal = true;
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
ClientCallback &
|
||||
ClientThread::GetCallback()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user