Preparing server side code for reporting game names.
This commit is contained in:
@@ -46,11 +46,12 @@ static bool LessThanPlayerHandStartMoney(const boost::shared_ptr<PlayerInterface
|
||||
}
|
||||
|
||||
|
||||
ServerGame::ServerGame(boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32_t id, const string &name, const string &pwd, const GameData &gameData, unsigned adminPlayerId, GuiInterface &gui, ConfigFile &playerConfig)
|
||||
ServerGame::ServerGame(boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32_t id, const string &name, const string &pwd, const GameData &gameData,
|
||||
unsigned adminPlayerId, unsigned creatorPlayerDBId, GuiInterface &gui, ConfigFile &playerConfig)
|
||||
: m_adminPlayerId(adminPlayerId), m_lobbyThread(lobbyThread), m_gui(gui),
|
||||
m_gameData(gameData), m_curState(NULL), m_id(id), m_name(name),
|
||||
m_password(pwd), m_playerConfig(playerConfig), m_gameNum(1),
|
||||
m_curPetitionId(1), m_voteKickTimer(lobbyThread->GetIOService()),
|
||||
m_password(pwd), m_creatorPlayerDBId(creatorPlayerDBId), m_playerConfig(playerConfig),
|
||||
m_gameNum(1), m_curPetitionId(1), m_voteKickTimer(lobbyThread->GetIOService()),
|
||||
m_stateTimer1(lobbyThread->GetIOService()), m_stateTimer2(lobbyThread->GetIOService())
|
||||
{
|
||||
LOG_VERBOSE("Game object " << GetId() << " created.");
|
||||
@@ -86,6 +87,12 @@ ServerGame::GetName() const
|
||||
return m_name;
|
||||
}
|
||||
|
||||
unsigned
|
||||
ServerGame::GetCreatorDBId() const
|
||||
{
|
||||
return m_creatorPlayerDBId;
|
||||
}
|
||||
|
||||
void
|
||||
ServerGame::AddSession(boost::shared_ptr<SessionData> session)
|
||||
{
|
||||
|
||||
@@ -358,6 +358,9 @@ AbstractServerGameStateReceiving::ProcessPacket(boost::shared_ptr<ServerGame> se
|
||||
netReportAck->reportAvatarResult = reportAvatarResult_avatarReportInvalid;
|
||||
server->GetLobbyThread().GetSender().Send(session, packet);
|
||||
}
|
||||
} else if (packet->GetMsg()->present == PokerTHMessage_PR_reportGameMessage) {
|
||||
// Delegate to Lobby.
|
||||
server->GetLobbyThread().HandleGameReportGame(session, packet->GetMsg()->choice.reportGameMessage);
|
||||
} else {
|
||||
// Packet processing in subclass.
|
||||
InternalProcessPacket(server, session, packet);
|
||||
|
||||
@@ -486,6 +486,13 @@ ServerLobbyThread::HandleGameRetrieveAvatar(boost::shared_ptr<SessionData> sessi
|
||||
HandleNetPacketRetrieveAvatar(session, retrieveAvatar);
|
||||
}
|
||||
|
||||
void
|
||||
ServerLobbyThread::HandleGameReportGame(boost::shared_ptr<SessionData> session, const ReportGameMessage_t &reportGame)
|
||||
{
|
||||
// Someone within a game reportet a game name.
|
||||
HandleNetPacketReportGame(session, reportGame);
|
||||
}
|
||||
|
||||
void
|
||||
ServerLobbyThread::HandleChatRequest(boost::shared_ptr<SessionData> session, const ChatRequestMessage_t &chatRequest)
|
||||
{
|
||||
@@ -927,6 +934,8 @@ ServerLobbyThread::HandlePacket(boost::shared_ptr<SessionData> session, boost::s
|
||||
HandleNetPacketChatRequest(session, packet->GetMsg()->choice.chatRequestMessage);
|
||||
else if (packet->GetMsg()->present == PokerTHMessage_PR_rejectGameInvitationMessage)
|
||||
HandleNetPacketRejectGameInvitation(session, packet->GetMsg()->choice.rejectGameInvitationMessage);
|
||||
else if (packet->GetMsg()->present == PokerTHMessage_PR_reportGameMessage)
|
||||
HandleNetPacketReportGame(session, packet->GetMsg()->choice.reportGameMessage);
|
||||
else
|
||||
SessionError(session, ERR_SOCK_INVALID_STATE);
|
||||
}
|
||||
@@ -1287,6 +1296,7 @@ ServerLobbyThread::HandleNetPacketCreateGame(boost::shared_ptr<SessionData> sess
|
||||
password,
|
||||
tmpData,
|
||||
session->GetPlayerData()->GetUniqueId(),
|
||||
session->GetPlayerData()->GetDBId(),
|
||||
GetGui(),
|
||||
m_serverConfig));
|
||||
game->Init();
|
||||
@@ -1443,6 +1453,11 @@ ServerLobbyThread::HandleNetPacketRejectGameInvitation(boost::shared_ptr<Session
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServerLobbyThread::HandleNetPacketReportGame(boost::shared_ptr<SessionData> session, const ReportGameMessage_t &report)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServerLobbyThread::AuthChallenge(boost::shared_ptr<SessionData> session, const string &secret)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,8 @@ class ServerGame : public boost::enable_shared_from_this<ServerGame>
|
||||
{
|
||||
public:
|
||||
ServerGame(
|
||||
boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32_t id, const std::string &name, const std::string &pwd, const GameData &gameData, unsigned adminPlayerId, GuiInterface &gui, ConfigFile &playerConfig);
|
||||
boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32_t id, const std::string &name, const std::string &pwd, const GameData &gameData,
|
||||
unsigned adminPlayerId, unsigned creatorPlayerDBId, GuiInterface &gui, ConfigFile &playerConfig);
|
||||
virtual ~ServerGame();
|
||||
|
||||
void Init();
|
||||
@@ -50,6 +51,7 @@ public:
|
||||
|
||||
u_int32_t GetId() const;
|
||||
const std::string &GetName() const;
|
||||
unsigned GetCreatorDBId() const;
|
||||
|
||||
void AddSession(boost::shared_ptr<SessionData> session);
|
||||
void RemovePlayer(unsigned playerId, unsigned errorCode);
|
||||
@@ -207,6 +209,7 @@ private:
|
||||
const u_int32_t m_id;
|
||||
const std::string m_name;
|
||||
const std::string m_password;
|
||||
const unsigned m_creatorPlayerDBId;
|
||||
ConfigFile &m_playerConfig;
|
||||
unsigned m_gameNum;
|
||||
unsigned m_curPetitionId;
|
||||
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
void DispatchPacket(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet);
|
||||
void HandleGameRetrievePlayerInfo(boost::shared_ptr<SessionData> session, const PlayerInfoRequestMessage_t &playerInfoRequest);
|
||||
void HandleGameRetrieveAvatar(boost::shared_ptr<SessionData> session, const AvatarRequestMessage_t &retrieveAvatar);
|
||||
void HandleGameReportGame(boost::shared_ptr<SessionData> session, const ReportGameMessage_t &reportGame);
|
||||
void HandleChatRequest(boost::shared_ptr<SessionData> session, const ChatRequestMessage_t &chatRequest);
|
||||
|
||||
bool KickPlayerByName(const std::string &playerName);
|
||||
@@ -141,6 +142,7 @@ protected:
|
||||
void HandleNetPacketRejoinGame(boost::shared_ptr<SessionData> session, bool autoLeave, const RejoinExistingGame_t &rejoinGame);
|
||||
void HandleNetPacketChatRequest(boost::shared_ptr<SessionData> session, const ChatRequestMessage_t &chatRequest);
|
||||
void HandleNetPacketRejectGameInvitation(boost::shared_ptr<SessionData> session, const RejectGameInvitationMessage_t &reject);
|
||||
void HandleNetPacketReportGame(boost::shared_ptr<SessionData> session, const ReportGameMessage_t &report);
|
||||
// TODO would be better to use state pattern here.
|
||||
void AuthChallenge(boost::shared_ptr<SessionData> session, const std::string &secret);
|
||||
void CheckAvatarBlacklist(boost::shared_ptr<SessionData> session);
|
||||
|
||||
Reference in New Issue
Block a user