From 57447d844ea205eafc9e124112efa878d9223a19 Mon Sep 17 00:00:00 2001 From: lotodore Date: Tue, 27 Dec 2011 10:11:15 +0000 Subject: [PATCH] Fixing problem when resetting the game admin timeout. --- src/net/common/servergamestate.cpp | 22 +++++++++++++++------- src/net/servergamestate.h | 3 +++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/net/common/servergamestate.cpp b/src/net/common/servergamestate.cpp index 358f6eb5..5e1a3ad6 100644 --- a/src/net/common/servergamestate.cpp +++ b/src/net/common/servergamestate.cpp @@ -353,11 +353,6 @@ AbstractServerGameStateReceiving::ProcessPacket(boost::shared_ptr se netReportAck->reportResult = reportResult_avatarReportInvalid; server->GetLobbyThread().GetSender().Send(session, packet); } - } else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage) { - // Reactivate session. - if (server->IsRunning()) { - server->AddReactivatePlayer(session->GetPlayerData()->GetUniqueId()); - } } else { // Packet processing in subclass. InternalProcessPacket(server, session, packet); @@ -804,6 +799,15 @@ AbstractServerGameStateRunning::HandleNewSession(boost::shared_ptr s } } +void +AbstractServerGameStateRunning::InternalProcessPacket(boost::shared_ptr server, boost::shared_ptr session, boost::shared_ptr packet) +{ + if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage) { + // Reactivate session. + server->AddReactivatePlayer(session->GetPlayerData()->GetUniqueId()); + } +} + //----------------------------------------------------------------------------- ServerGameStateHand ServerGameStateHand::s_state; @@ -839,9 +843,9 @@ ServerGameStateHand::Exit(boost::shared_ptr server) } void -ServerGameStateHand::InternalProcessPacket(boost::shared_ptr /*server*/, boost::shared_ptr /*session*/, boost::shared_ptr /*packet*/) +ServerGameStateHand::InternalProcessPacket(boost::shared_ptr server, boost::shared_ptr session, boost::shared_ptr packet) { - // TODO: maybe reject packet. + AbstractServerGameStateRunning::InternalProcessPacket(server, session, packet); } void @@ -1436,6 +1440,8 @@ ServerGameStateWaitPlayerAction::Exit(boost::shared_ptr server) void ServerGameStateWaitPlayerAction::InternalProcessPacket(boost::shared_ptr server, boost::shared_ptr session, boost::shared_ptr packet) { + AbstractServerGameStateRunning::InternalProcessPacket(server, session, packet); + if (packet->GetMsg()->present == PokerTHMessage_PR_myActionRequestMessage) { MyActionRequestMessage_t *netMyAction = &packet->GetMsg()->choice.myActionRequestMessage; @@ -1568,6 +1574,8 @@ ServerGameStateWaitNextHand::Exit(boost::shared_ptr server) void ServerGameStateWaitNextHand::InternalProcessPacket(boost::shared_ptr server, boost::shared_ptr session, boost::shared_ptr packet) { + AbstractServerGameStateRunning::InternalProcessPacket(server, session, packet); + if (packet->GetMsg()->present == PokerTHMessage_PR_showMyCardsRequestMessage) { Game &curGame = server->GetGame(); boost::shared_ptr show(new NetPacket(NetPacket::Alloc)); diff --git a/src/net/servergamestate.h b/src/net/servergamestate.h index cd08c20f..35d900ac 100644 --- a/src/net/servergamestate.h +++ b/src/net/servergamestate.h @@ -138,6 +138,9 @@ public: virtual ~AbstractServerGameStateRunning(); virtual void HandleNewSession(boost::shared_ptr server, boost::shared_ptr session); + +protected: + virtual void InternalProcessPacket(boost::shared_ptr server, boost::shared_ptr session, boost::shared_ptr packet); }; // State: Within hand.