Added notification if a new release or beta release of PokerTH is available.

Removed last traces of deprecated blind values.
This commit is contained in:
lotodore
2007-10-12 13:07:04 +00:00
parent 2c67f848ea
commit 96d1f34f5c
12 changed files with 48 additions and 9 deletions
+7 -2
View File
@@ -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:
-1
View File
@@ -33,7 +33,6 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> 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)
{
-1
View File
@@ -102,7 +102,6 @@ private:
int startQuantityPlayers;
int startCash;
int startSmallBlind;
int startHandsBeforeRaiseSmallBlind;
int myGameID;
int guiPlayerNum;
+6
View File
@@ -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,
+1 -3
View File
@@ -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<int> manualBlindsList;
AfterManualBlindsMode afterManualBlindsMode;
int afterMBAlwaysRaiseValue;
int handsBeforeRaise; // deprecated
int guiSpeed;
int playerActionTimeoutSec;
};
@@ -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));
+13 -1
View File
@@ -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() {
+6
View File
@@ -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());
+6
View File
@@ -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);
}
+2
View File
@@ -606,6 +606,8 @@ ServerLobbyThread::EstablishSession(SessionWrapper session)
// Send ACK to client.
boost::shared_ptr<NetPacket> 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<NetPacketInitAck *>(initAck.get())->SetData(initAckData);
+2
View File
@@ -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;
};
+4
View File
@@ -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