Add online id with player name for easier banning

This commit is contained in:
Benau 2018-03-27 01:23:54 +08:00
parent 5eb436384f
commit ce8a15d90c
3 changed files with 7 additions and 11 deletions

View File

@ -35,14 +35,6 @@ GameSetup::GameSetup()
m_reverse = false;
} // GameSetup
//-----------------------------------------------------------------------------
void GameSetup::addPlayer(std::shared_ptr<NetworkPlayerProfile> profile)
{
m_players.push_back(profile);
Log::info("GameSetup", "New player in the game setup. Player name : %s.",
StringUtils::wideToUtf8(profile->getName()).c_str());
} // addPlayer
//-----------------------------------------------------------------------------
/** Update and see if any player disconnects.
* \param remove_disconnected_players remove the disconnected players,

View File

@ -63,7 +63,8 @@ public:
// ------------------------------------------------------------------------
~GameSetup() {}
// ------------------------------------------------------------------------
void addPlayer(std::shared_ptr<NetworkPlayerProfile> profile);
void addPlayer(std::shared_ptr<NetworkPlayerProfile> profile)
{ m_players.push_back(profile); }
// ------------------------------------------------------------------------
void update(bool remove_disconnected_players);
// ------------------------------------------------------------------------

View File

@ -935,10 +935,13 @@ void ServerLobby::connectionRequested(Event* event)
m_peers_ready[peer] = false;
for (std::shared_ptr<NetworkPlayerProfile> npp : peer->getPlayerProfiles())
{
m_game_setup->addPlayer(npp);
Log::info("ServerLobby", "New player %s with online id %u from %s.",
StringUtils::wideToUtf8(npp->getName()).c_str(),
npp->getOnlineId(), peer->getAddress().toString().c_str());
}
updatePlayerList();
Log::verbose("ServerLobby", "New player.");
} // connectionRequested
//-----------------------------------------------------------------------------