void PDUNetworkError::execute(Base::GameState*) { #ifdef PSPOT_TABLE_MODULE_ Base::GameLogic::Instance().setNextState(0); Global::Instance().closeConnections(); CTableView* pView = CTableView::Instance(); if (pView) { pView->setCaption(); pView->resetCards(); pView->announce(""); for (int i = 0; i < 10; i++) pView->removePlayer(i); pView->Invalidate(); } // CONNRESET means server closed connection - it's ok if (!Global::CloseConnection())//errorCode_ != WSAECONNRESET) { CString msg; msg.Format(g_szErrFmt, errorCode_); if (AfxGetMainWnd()) AfxGetMainWnd()->MessageBox(msg, NULL, MB_OK|MB_ICONEXCLAMATION); } #else Global::Instance().closeConnections(); CFloorMap* pFM = CFloorMap::Instance(); if (pFM) pFM->disconnect(); if (!Global::CloseConnection()) { CString msg; msg.Format(g_szErrFmt, errorCode_); if (AfxGetMainWnd()) AfxGetMainWnd()->MessageBox(msg, NULL, MB_OK|MB_ICONEXCLAMATION); } #endif }
void PDUAnnounce::execute(GameState*) { CTableView* pTable = CTableView::Instance(); bool msgOnly = (winner_ == ANNOUNCE_FLAG_MSG); if (!msgOnly && pTable) { // Tell the current state to quit animations if any GameState* state = GameLogic::Instance().currentState(); if (state) state->onCommand(MAKEWPARAM(ID_STOPANIMATION, 0), 0); pTable->endBettingRound(true); } CChatView* pChat = CChatView::Instance(); if (pChat && pTable) { CString name("unknown"); Base::Player* p = pTable->getPlayer(winner_); if (p) { name = p->getName(); pTable->showWinner(winner_, 3000); // animate 3 secs } // Replace newlines with spaces CString s(message_); for (int i = 0; i < s.GetLength(); i++) { if (s[i] == '\n' || s[i] == '\r') s.SetAt(i, ' '); } if (msgOnly) pChat->addDealerMessage(s, CChatView::CF_GameNormal); else pChat->addDealerMessage(s, CChatView::CF_Fatal); if (!msgOnly) { CChips chipsInPot = pTable->resetPot(); if (pTable->isLocalPlayer(winner_)) { if (chipsInPot > 100) SndMan::Instance()->playSound(SndMan::SM_RakeInLarge); else SndMan::Instance()->playSound(SndMan::SM_RakeInSmall); } else { SndMan::Instance()->playSound(SndMan::SM_Show); } } #ifdef SHOW_ANNOUNCEMENT_RECT_ // The announcement rectangle is not currently used. pTable->announce(message_); #endif } if (!msgOnly && GameLogic::LeaveTable()) { // User has clicked the Leave Table button // - send logout now if (pTable) Base::SetStatusText(pTable, _T("Leaving table...")); if (Global::TableServer()) Global::TableServer()->sendSetupTableLogout(); } }