Internet game lobby dialog shows now overview of games and whether they are private. Now showing connection progress before the internet game lobby.

This commit is contained in:
lotodore
2007-09-04 12:44:11 +00:00
parent b0ef569da0
commit 9ed217609b
15 changed files with 105 additions and 40 deletions
+2 -2
View File
@@ -635,7 +635,7 @@ ClientThread::AddGameInfo(unsigned gameId, const GameInfo &info)
boost::mutex::scoped_lock lock(m_gameInfoMapMutex);
m_gameInfoMap.insert(GameInfoMap::value_type(gameId, info));
}
GetCallback().SignalNetClientGameListNew(gameId, info.name);
GetCallback().SignalNetClientGameListNew(gameId);
}
void
@@ -652,7 +652,7 @@ ClientThread::RemoveGameInfo(unsigned gameId)
}
}
if (!name.empty())
GetCallback().SignalNetClientGameListRemove(gameId, name);
GetCallback().SignalNetClientGameListRemove(gameId);
}
void
+9 -4
View File
@@ -50,8 +50,8 @@ private:
};
ServerGameThread::ServerGameThread(ServerLobbyThread &lobbyThread, u_int32_t id, const string &name, GuiInterface &gui, ConfigFile *playerConfig)
: m_lobbyThread(lobbyThread), m_gui(gui), m_id(id), m_name(name), m_playerConfig(playerConfig), m_curState(NULL), m_gameNum(1)
ServerGameThread::ServerGameThread(ServerLobbyThread &lobbyThread, u_int32_t id, const string &name, const string &pwd, GuiInterface &gui, ConfigFile *playerConfig)
: m_lobbyThread(lobbyThread), m_gui(gui), m_id(id), m_name(name), m_password(pwd), m_playerConfig(playerConfig), m_curState(NULL), m_gameNum(1)
{
m_senderCallback.reset(new ServerSenderCallback(*this));
m_sender.reset(new SenderThread(GetSenderCallback()));
@@ -63,9 +63,8 @@ ServerGameThread::~ServerGameThread()
}
void
ServerGameThread::Init(const string &pwd, const GameData &gameData)
ServerGameThread::Init(const GameData &gameData)
{
m_password = pwd;
m_gameData = gameData;
}
@@ -434,6 +433,12 @@ ServerGameThread::SetStartData(const StartData &startData)
m_startData = startData;
}
bool
ServerGameThread::IsPasswordProtected() const
{
return !m_password.empty();
}
bool
ServerGameThread::CheckPassword(const string &password) const
{
+8 -2
View File
@@ -337,8 +337,13 @@ ServerLobbyThread::HandleNetPacketCreateGame(SessionWrapper session, const NetPa
tmpPacket.GetData(createGameData);
boost::shared_ptr<ServerGameThread> game(
new ServerGameThread(*this, GetNextGameId(), createGameData.gameName, GetGui(), m_playerConfig));
game->Init(createGameData.password, createGameData.gameData);
new ServerGameThread(
*this, GetNextGameId(),
createGameData.gameName,
createGameData.password,
GetGui(),
m_playerConfig));
game->Init(createGameData.gameData);
// Remove session from the lobby.
m_sessionManager.RemoveSession(session.sessionData->GetSocket());
@@ -582,6 +587,7 @@ ServerLobbyThread::CreateNetPacketGameListNew(const ServerGameThread &game)
packetData.gameInfo.name = game.GetName();
packetData.gameInfo.data = game.GetGameData();
packetData.gameInfo.players = game.GetPlayerIdList();
packetData.gameInfo.isPasswordProtected = game.IsPasswordProtected();
static_cast<NetPacketGameListNew *>(packet.get())->SetData(packetData);
return packet;
}