Fixed bug where computer players where displayed as numbers in lobby.
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
|
||||
#include <playerdata.h>
|
||||
|
||||
#define SERVER_COMPUTER_PLAYER_NAME "Computer"
|
||||
|
||||
enum GameMode
|
||||
{
|
||||
GAME_MODE_CREATED = 1,
|
||||
|
||||
@@ -420,16 +420,20 @@ ClientThread::SetPlayerInfo(unsigned id, const PlayerInfo &info)
|
||||
// for the same player name if it exists.
|
||||
// This can only be one entry, since every time a duplicate
|
||||
// name is added one is removed.
|
||||
PlayerInfoMap::iterator i = m_playerInfoMap.begin();
|
||||
PlayerInfoMap::iterator end = m_playerInfoMap.end();
|
||||
while (i != end)
|
||||
// Only erase non computer player entries.
|
||||
if (info.playerName.substr(0, sizeof(SERVER_COMPUTER_PLAYER_NAME) - 1) != SERVER_COMPUTER_PLAYER_NAME)
|
||||
{
|
||||
if (i->first != id && i->second.playerName == info.playerName)
|
||||
PlayerInfoMap::iterator i = m_playerInfoMap.begin();
|
||||
PlayerInfoMap::iterator end = m_playerInfoMap.end();
|
||||
while (i != end)
|
||||
{
|
||||
m_playerInfoMap.erase(i);
|
||||
break;
|
||||
if (i->first != id && i->second.playerName == info.playerName)
|
||||
{
|
||||
m_playerInfoMap.erase(i);
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
m_playerInfoMap[id] = info;
|
||||
}
|
||||
|
||||
@@ -62,8 +62,6 @@ using namespace std;
|
||||
#define SERVER_COMPUTER_ACTION_DELAY_SEC 2
|
||||
#endif
|
||||
|
||||
#define SERVER_COMPUTER_PLAYER_NAME "Computer"
|
||||
|
||||
// Helper functions
|
||||
// TODO: these are hacks.
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@
|
||||
|
||||
#define SERVER_NUM_AVATAR_SENDER_THREADS 5
|
||||
|
||||
#define SERVER_COMPUTER_PLAYER_NAME "Computer"
|
||||
|
||||
#define SERVER_STATISTICS_FILE_NAME "server_statistics.log"
|
||||
#define SERVER_STATISTICS_STR_TOTAL_PLAYERS "TotalNumPlayersLoggedIn"
|
||||
#define SERVER_STATISTICS_STR_TOTAL_GAMES "TotalNumGamesStarted"
|
||||
|
||||
Reference in New Issue
Block a user