diff --git a/docs/net_protocol.txt b/docs/net_protocol.txt index 13674d9e..575668f0 100644 --- a/docs/net_protocol.txt +++ b/docs/net_protocol.txt @@ -72,13 +72,18 @@ Server Reply: Init ACK 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Message Type = 2 | Message Length = 12 | + | Message Type = 2 | Message Length = 16 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Latest Game Version | Latest Beta Revision | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Your Session ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Your Player ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - +Latest Game Version: + Major Version << 8 | Minor Version (network byte order). +Latest Beta Revision: + 0 for stable releases, else contains beta release svn revision. Session ID: Unique Session ID which is not known by other players Player ID: diff --git a/src/game.cpp b/src/game.cpp index 3671c9ac..e9819d5a 100755 --- a/src/game.cpp +++ b/src/game.cpp @@ -33,7 +33,6 @@ Game::Game(GuiInterface* gui, boost::shared_ptr factory, : myFactory(factory), myGui(gui), actualHand(0), actualBoard(0), startQuantityPlayers(startData.numberOfPlayers), startCash(gameData.startMoney), startSmallBlind(gameData.firstSmallBlind), - startHandsBeforeRaiseSmallBlind(gameData.handsBeforeRaise), myGameID(gameId), actualSmallBlind(gameData.firstSmallBlind), actualHandID(0), dealerPosition(0), lastHandBlindsRaised(1), lastTimeBlindsRaised(0), myGameData(gameData) { diff --git a/src/game.h b/src/game.h index 08fa43d6..b0190521 100755 --- a/src/game.h +++ b/src/game.h @@ -102,7 +102,6 @@ private: int startQuantityPlayers; int startCash; int startSmallBlind; - int startHandsBeforeRaiseSmallBlind; int myGameID; int guiPlayerNum; diff --git a/src/game_defs.h b/src/game_defs.h index d6b4ea2c..a3406065 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -28,6 +28,12 @@ #define DEBUG_MODE 0 +#define POKERTH_VERSION_MAJOR 0 +#define POKERTH_VERSION_MINOR 6 +#define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR) + +#define POKERTH_BETA_REVISION 0 + enum GameState { GAME_STATE_PREFLOP = 0, GAME_STATE_FLOP, diff --git a/src/gamedata.h b/src/gamedata.h index d6e5de21..5ecce178 100644 --- a/src/gamedata.h +++ b/src/gamedata.h @@ -52,10 +52,9 @@ enum AfterManualBlindsMode // For the sake of simplicity, this is a struct. struct GameData { - GameData() : maxNumberOfPlayers(0), startMoney(0), smallBlind(0), firstSmallBlind(0), raiseIntervalMode(RAISE_ON_HANDNUMBER), raiseSmallBlindEveryHandsValue(8), raiseSmallBlindEveryMinutesValue(0), raiseMode(DOUBLE_BLINDS), afterManualBlindsMode(AFTERMB_DOUBLE_BLINDS), afterMBAlwaysRaiseValue(0), handsBeforeRaise(1), guiSpeed(4), playerActionTimeoutSec(20) {} + GameData() : maxNumberOfPlayers(0), startMoney(0), firstSmallBlind(0), raiseIntervalMode(RAISE_ON_HANDNUMBER), raiseSmallBlindEveryHandsValue(8), raiseSmallBlindEveryMinutesValue(1), raiseMode(DOUBLE_BLINDS), afterManualBlindsMode(AFTERMB_DOUBLE_BLINDS), afterMBAlwaysRaiseValue(0), guiSpeed(4), playerActionTimeoutSec(20) {} int maxNumberOfPlayers; int startMoney; - int smallBlind; // deprecated int firstSmallBlind; RaiseIntervalMode raiseIntervalMode; int raiseSmallBlindEveryHandsValue; @@ -64,7 +63,6 @@ struct GameData std::list manualBlindsList; AfterManualBlindsMode afterManualBlindsMode; int afterMBAlwaysRaiseValue; - int handsBeforeRaise; // deprecated int guiSpeed; int playerActionTimeoutSec; }; diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp index 830f28a7..9d182b2e 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp @@ -186,7 +186,7 @@ void gameLobbyDialogImpl::gameSelected(QTreeWidgetItem* item, QTreeWidgetItem*) GameInfo info(mySession->getClientGameInfo(item->data(0, Qt::UserRole).toUInt())); hideShowGameDescription(TRUE); - label_SmallBlind->setText(QString::number(info.data.smallBlind)); + label_SmallBlind->setText(QString::number(info.data.firstSmallBlind)); label_StartCash->setText(QString::number(info.data.startMoney)); label_MaximumNumberOfPlayers->setText(QString::number(info.data.maxNumberOfPlayers)); diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 103ede29..69202baa 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -3583,6 +3583,18 @@ void mainWindowImpl::networkNotification(int notificationId) tr("Invalid password when joining the game.\nPlease reenter the password and try again."), QMessageBox::Close); } break; + case NTF_NET_NEW_RELEASE_AVAILABLE: + // TODO use dialog with link to pokerth.net + { QMessageBox::information(this, tr("Network Notification"), + tr("A new release of PokerTH is available. Please go to http://www.pokerth.net/ and download the latest version."), + QMessageBox::Close); } + break; + case NTF_NET_OUTDATED_BETA: + // TODO use dialog with link to pokerth.net + { QMessageBox::information(this, tr("Network Notification"), + tr("This beta release of PokerTH is outdated. Please go to http://www.pokerth.net/ and download the latest version."), + QMessageBox::Close); } + break; } } @@ -3781,7 +3793,7 @@ void mainWindowImpl::mouseOverFlipCards(bool front) { } } -void mainWindowImpl::closeEvent(QCloseEvent */*event*/) { quitPokerTH(); } +void mainWindowImpl::closeEvent(QCloseEvent * /*event*/) { quitPokerTH(); } void mainWindowImpl::quitPokerTH() { diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index f5612a66..8047e494 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -554,6 +554,12 @@ ClientStateWaitSession::InternalProcess(ClientThread &client, boost::shared_ptr< // Everything is fine - we are in the lobby. NetPacketInitAck::Data initAckData; packet->ToNetPacketInitAck()->GetData(initAckData); + // Check current game version. + if (initAckData.latestGameVersion != POKERTH_VERSION) + client.GetCallback().SignalNetClientNotification(NTF_NET_NEW_RELEASE_AVAILABLE); + else if (POKERTH_BETA_REVISION && initAckData.latestBetaRevision != POKERTH_BETA_REVISION) + client.GetCallback().SignalNetClientNotification(NTF_NET_OUTDATED_BETA); + client.SetGuiPlayerId(initAckData.playerId); client.SetState(ClientStateWaitJoin::Instance()); diff --git a/src/net/common/netpacket.cpp b/src/net/common/netpacket.cpp index 8b333b80..91ef1eea 100644 --- a/src/net/common/netpacket.cpp +++ b/src/net/common/netpacket.cpp @@ -138,6 +138,8 @@ struct GCC_PACKED NetPacketInitData struct GCC_PACKED NetPacketInitAckData { NetPacketHeader head; + u_int16_t latestGameVersion; + u_int16_t latestBetaRevision; u_int32_t sessionId; u_int32_t playerId; }; @@ -1278,6 +1280,8 @@ NetPacketInitAck::SetData(const NetPacketInitAck::Data &inData) { NetPacketInitAckData *tmpData = (NetPacketInitAckData *)GetRawData(); + tmpData->latestGameVersion = htons(inData.latestGameVersion); + tmpData->latestBetaRevision = htons(inData.latestBetaRevision); tmpData->sessionId = htonl(inData.sessionId); tmpData->playerId = htonl(inData.playerId); @@ -1290,6 +1294,8 @@ NetPacketInitAck::GetData(NetPacketInitAck::Data &outData) const { NetPacketInitAckData *tmpData = (NetPacketInitAckData *)GetRawData(); + outData.latestGameVersion = ntohs(tmpData->latestGameVersion); + outData.latestBetaRevision = ntohs(tmpData->latestBetaRevision); outData.sessionId = ntohl(tmpData->sessionId); outData.playerId = ntohl(tmpData->playerId); } diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 036f4abf..f313da28 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -606,6 +606,8 @@ ServerLobbyThread::EstablishSession(SessionWrapper session) // Send ACK to client. boost::shared_ptr initAck(new NetPacketInitAck); NetPacketInitAck::Data initAckData; + initAckData.latestGameVersion = POKERTH_VERSION; + initAckData.latestBetaRevision = POKERTH_BETA_REVISION; initAckData.sessionId = session.sessionData->GetId(); // TODO: currently unused. initAckData.playerId = session.playerData->GetUniqueId(); static_cast(initAck.get())->SetData(initAckData); diff --git a/src/net/netpacket.h b/src/net/netpacket.h index 0953a6fb..9aa9938f 100644 --- a/src/net/netpacket.h +++ b/src/net/netpacket.h @@ -200,6 +200,8 @@ class NetPacketInitAck : public NetPacket public: struct Data { + u_int16_t latestGameVersion; + u_int16_t latestBetaRevision; u_int32_t sessionId; u_int32_t playerId; }; diff --git a/src/net/socket_msg.h b/src/net/socket_msg.h index 239da643..e9e432d1 100644 --- a/src/net/socket_msg.h +++ b/src/net/socket_msg.h @@ -87,6 +87,10 @@ #define NTF_NET_JOIN_ALREADY_RUNNING 207 #define NTF_NET_JOIN_INVALID_PASSWORD 208 +// Notifications - version +#define NTF_NET_NEW_RELEASE_AVAILABLE 209 +#define NTF_NET_OUTDATED_BETA 210 + // This is an internal message which is not reported. #define MSG_SOCK_INTERNAL_PENDING 0