Removing AFK-warning message. Preparing integration of a new auto-AFK mode.

This commit is contained in:
lotodore
2011-11-07 21:07:13 +00:00
parent 77cda8da32
commit 32d26e3644
115 changed files with 309 additions and 522 deletions
-1
View File
@@ -61,7 +61,6 @@ public:
virtual void SignalNetClientMsgBox(const std::string &msg) = 0;
virtual void SignalNetClientMsgBox(unsigned msgId) = 0;
virtual void SignalNetClientWaitDialog() = 0;
virtual void SignalNetClientWarningAutoFoldInRankingGame(unsigned remainingAutoFolds) = 0;
virtual void SignalNetClientServerListAdd(unsigned serverId) = 0;
virtual void SignalNetClientServerListClear() = 0;
-3
View File
@@ -716,9 +716,6 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
} else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_timeoutWarningMessage) {
TimeoutWarningMessage_t *tmpTimeout = &tmpPacket->GetMsg()->choice.timeoutWarningMessage;
client->GetCallback().SignalNetClientShowTimeoutDialog((NetTimeoutReason)tmpTimeout->timeoutReason, tmpTimeout->remainingSeconds);
} else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_afkWarningMessage) {
AfkWarningMessage_t *tmpAfk = &tmpPacket->GetMsg()->choice.afkWarningMessage;
client->GetCallback().SignalNetClientWarningAutoFoldInRankingGame(tmpAfk->remainingTimeouts);
} else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_chatMessage) {
// Chat message - display it in the GUI.
ChatMessage_t *netMessage = &tmpPacket->GetMsg()->choice.chatMessage;
+1 -8
View File
@@ -51,7 +51,7 @@ ServerGame::ServerGame(boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32
: 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_serverLog(serverLog), m_gameNum(1),
m_curPetitionId(1), m_doNotAutoKickSmallDelaySec(10), m_voteKickTimer(lobbyThread->GetIOService()),
m_curPetitionId(1), m_voteKickTimer(lobbyThread->GetIOService()),
m_stateTimer1(lobbyThread->GetIOService()), m_stateTimer2(lobbyThread->GetIOService())
{
LOG_VERBOSE("Game object " << GetId() << " created.");
@@ -65,7 +65,6 @@ ServerGame::~ServerGame()
void
ServerGame::Init()
{
m_doNotAutoKickSmallDelaySec = m_playerConfig.readConfigInt("ServerDoNotAutoKickSmallDelaySec");
SetState(SERVER_INITIAL_STATE::Instance());
}
@@ -927,12 +926,6 @@ ServerGame::GetStateTimer2()
return m_stateTimer2;
}
unsigned
ServerGame::GetSmallDelaySec() const
{
return m_doNotAutoKickSmallDelaySec;
}
Game &
ServerGame::GetGame()
{
-21
View File
@@ -68,9 +68,6 @@ using namespace std;
#define SERVER_VOTE_KICK_TIMEOUT_SEC 30
#define SERVER_LOOP_DELAY_MSEC 50
#define SERVER_WARNING_ACTION_TIMEOUT_THRESHOLD 6
#define SERVER_KICK_ACTION_TIMEOUT_REMAINING 2
// Helper functions
static void SendPlayerAction(ServerGame &server, boost::shared_ptr<PlayerInterface> player)
@@ -1427,24 +1424,6 @@ ServerGameStateWaitPlayerAction::TimerTimeout(const boost::system::error_code &e
else
PerformPlayerAction(*server, curPlayer, PLAYER_ACTION_FOLD, 0);
curPlayer->incrementActionTimeoutCounter();
if (server->GetGameData().gameType == GAME_TYPE_RANKING
&& server->GetGameData().playerActionTimeoutSec >= (int)server->GetSmallDelaySec()) {
if (curPlayer->getActionTimeoutCounter() == SERVER_WARNING_ACTION_TIMEOUT_THRESHOLD) {
boost::shared_ptr<SessionData> tmpSession = server->GetSessionManager().GetSessionByUniquePlayerId(curPlayer->getMyUniqueID());
if (tmpSession) { // The session may not exist at this point, because the player may have left.
// Send warning to player.
boost::shared_ptr<NetPacket> warning(new NetPacket(NetPacket::Alloc));
warning->GetMsg()->present = PokerTHMessage_PR_afkWarningMessage;
AfkWarningMessage_t *netWarning = &warning->GetMsg()->choice.afkWarningMessage;
netWarning->remainingTimeouts = SERVER_KICK_ACTION_TIMEOUT_REMAINING;
server->GetLobbyThread().GetSender().Send(tmpSession, warning);
}
} else if (curPlayer->getActionTimeoutCounter() > SERVER_WARNING_ACTION_TIMEOUT_THRESHOLD + SERVER_KICK_ACTION_TIMEOUT_REMAINING) {
server->InternalKickPlayer(curPlayer->getMyUniqueID());
}
}
server->SetState(ServerGameStateHand::Instance());
} catch (const PokerTHException &e) {
LOG_ERROR("Game " << server->GetId() << " - Player timer exception: " << e.what());
+1 -1
View File
@@ -905,7 +905,7 @@ ServerLobbyThread::HandlePacket(boost::shared_ptr<SessionData> session, boost::s
else if (packet->GetMsg()->present == PokerTHMessage_PR_avatarRequestMessage)
HandleNetPacketRetrieveAvatar(session, packet->GetMsg()->choice.avatarRequestMessage);
else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage)
{}
{}
else if (packet->GetMsg()->present == PokerTHMessage_PR_subscriptionRequestMessage) {
SubscriptionRequestMessage_t *subscriptionRequest = &packet->GetMsg()->choice.subscriptionRequestMessage;
if (subscriptionRequest->subscriptionAction == subscriptionAction_resubscribeGameList)
-3
View File
@@ -90,8 +90,6 @@ public:
void AddRejoinPlayer(unsigned playerId);
PlayerIdList GetAndResetRejoinPlayers();
unsigned GetSmallDelaySec() const;
// should be protected, but is needed in function.
const Game &GetGame() const;
Game &GetGame();
@@ -203,7 +201,6 @@ private:
Log &m_serverLog;
unsigned m_gameNum;
unsigned m_curPetitionId;
unsigned m_doNotAutoKickSmallDelaySec;
boost::asio::deadline_timer m_voteKickTimer;
boost::asio::deadline_timer m_stateTimer1;
boost::asio::deadline_timer m_stateTimer2;