Networking should mostly be working now. Some small issues concerning the display of pot/sets, and some delays are still needed.
This commit is contained in:
+52
-3
@@ -10,6 +10,7 @@ PokerTH general message format:
|
|||||||
| +-------------------------------+
|
| +-------------------------------+
|
||||||
/ | padding |
|
/ | padding |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
Minimum length is 8. Maximum length is 256.
|
||||||
|
|
||||||
|
|
||||||
Client Request: Join Game
|
Client Request: Join Game
|
||||||
@@ -239,7 +240,7 @@ Server Notification: Deal Flop Cards
|
|||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Flop 1st Card | Flop 2nd Card |
|
| Flop 1st Card | Flop 2nd Card |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Flop 3rd Card | Reserved |
|
| Flop 3rd Card | Reserved |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
|
||||||
|
|
||||||
@@ -250,7 +251,7 @@ Server Notification: Deal Turn Card
|
|||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Message Type = 12 | Message Length = 8 |
|
| Message Type = 12 | Message Length = 8 |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Turn Card | Reserved |
|
| Turn Card | Reserved |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
|
||||||
|
|
||||||
@@ -261,10 +262,58 @@ Server Notification: Deal River Card
|
|||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Message Type = 13 | Message Length = 8 |
|
| Message Type = 13 | Message Length = 8 |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| River Card | Reserved |
|
| River Card | Reserved |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
|
||||||
|
|
||||||
|
Server Notification: End Of Hand Show Cards
|
||||||
|
|
||||||
|
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 = 14 | Message Length |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
|Number Of PlayerResult Records | Reserved |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| \
|
||||||
|
\ PlayerResult Records /
|
||||||
|
/ |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
|
||||||
|
PlayerResult Record
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Player Id | 1st Card |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| 2nd Card | Best Hand Position 1 |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Best Hand Position 2 | Best Hand Position 3 |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Best Hand Position 4 | Best Hand Position 5 |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Value Of Cards |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Money Won |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Player Money |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
|
||||||
|
|
||||||
|
Server Notification: End Of Hand Hide Cards
|
||||||
|
|
||||||
|
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 = 15 | Message Length = 16 |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Player Id | Reserved |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Money Won |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Player Money |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Client Request: Send Chat Text
|
Client Request: Send Chat Text
|
||||||
|
|
||||||
0 1 2 3
|
0 1 2 3
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class FlopInterface{
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
virtual ~FlopInterface();
|
virtual ~FlopInterface();
|
||||||
|
|
||||||
virtual void setPlayersTurn(const int& theValue) =0;
|
virtual void setPlayersTurn(const int& theValue) =0;
|
||||||
virtual int getPlayersTurn() const =0;
|
virtual int getPlayersTurn() const =0;
|
||||||
@@ -41,6 +41,8 @@ public:
|
|||||||
virtual void setSmallBlind(const int& theValue) =0;
|
virtual void setSmallBlind(const int& theValue) =0;
|
||||||
virtual int getSmallBlind() const =0;
|
virtual int getSmallBlind() const =0;
|
||||||
|
|
||||||
|
virtual void resetFirstRun() =0;
|
||||||
|
|
||||||
virtual void flopRun() =0;
|
virtual void flopRun() =0;
|
||||||
virtual void nextPlayer2() =0;
|
virtual void nextPlayer2() =0;
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ public:
|
|||||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||||
int getSmallBlind() const { return smallBlind; }
|
int getSmallBlind() const { return smallBlind; }
|
||||||
|
|
||||||
|
void resetFirstRun() { firstFlopRun = false; }
|
||||||
|
|
||||||
void flopRun();
|
void flopRun();
|
||||||
void nextPlayer2();
|
void nextPlayer2();
|
||||||
|
|
||||||
|
|||||||
@@ -347,7 +347,8 @@ void LocalHand::switchRounds() {
|
|||||||
myGui->refreshPot();
|
myGui->refreshPot();
|
||||||
myGui->refreshSet();
|
myGui->refreshSet();
|
||||||
myGui->flipHolecardsAllIn();
|
myGui->flipHolecardsAllIn();
|
||||||
actualRound++;
|
if (actualRound < 4) // do not increment past 4
|
||||||
|
actualRound++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//unhighlight actual players groupbox
|
//unhighlight actual players groupbox
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public:
|
|||||||
void setHighestCardsValue(const int& theValue) { highestCardsValue = theValue;}
|
void setHighestCardsValue(const int& theValue) { highestCardsValue = theValue;}
|
||||||
int getHighestCardsValue() const { return highestCardsValue;}
|
int getHighestCardsValue() const { return highestCardsValue;}
|
||||||
|
|
||||||
|
void resetFirstRun() { firstRiverRun = false; }
|
||||||
|
|
||||||
void riverRun();
|
void riverRun();
|
||||||
void postRiverRun();
|
void postRiverRun();
|
||||||
void nextPlayer2();
|
void nextPlayer2();
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ public:
|
|||||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||||
int getSmallBlind() const { return smallBlind; }
|
int getSmallBlind() const { return smallBlind; }
|
||||||
|
|
||||||
|
void resetFirstRun() { firstTurnRun = false; }
|
||||||
|
|
||||||
void turnRun();
|
void turnRun();
|
||||||
void nextPlayer2();
|
void nextPlayer2();
|
||||||
|
|
||||||
|
|||||||
@@ -47,20 +47,20 @@ ClientBoard::setHand(HandInterface* br)
|
|||||||
|
|
||||||
void
|
void
|
||||||
ClientBoard::collectSets()
|
ClientBoard::collectSets()
|
||||||
{
|
{
|
||||||
sets = 0;
|
sets = 0;
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) sets += playerArray[i]->getMySet();
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) sets += playerArray[i]->getMySet();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientBoard::collectPot()
|
ClientBoard::collectPot()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
pot += sets;
|
pot += sets;
|
||||||
sets = 0;
|
sets = 0;
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++){ playerArray[i]->setMySetNull(); }
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++){ playerArray[i]->setMySetNull(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ public:
|
|||||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||||
int getSmallBlind() const { return smallBlind; }
|
int getSmallBlind() const { return smallBlind; }
|
||||||
|
|
||||||
|
void resetFirstRun() { firstFlopRun = false; }
|
||||||
|
|
||||||
void flopRun();
|
void flopRun();
|
||||||
void nextPlayer2();
|
void nextPlayer2();
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public:
|
|||||||
void setHighestCardsValue(const int& theValue) { highestCardsValue = theValue;}
|
void setHighestCardsValue(const int& theValue) { highestCardsValue = theValue;}
|
||||||
int getHighestCardsValue() const { return highestCardsValue;}
|
int getHighestCardsValue() const { return highestCardsValue;}
|
||||||
|
|
||||||
|
void resetFirstRun() { firstRiverRun = false; }
|
||||||
|
|
||||||
void riverRun();
|
void riverRun();
|
||||||
void postRiverRun();
|
void postRiverRun();
|
||||||
void nextPlayer2();
|
void nextPlayer2();
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ public:
|
|||||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||||
int getSmallBlind() const { return smallBlind; }
|
int getSmallBlind() const { return smallBlind; }
|
||||||
|
|
||||||
|
void resetFirstRun() { firstTurnRun = false; }
|
||||||
|
|
||||||
void turnRun();
|
void turnRun();
|
||||||
void nextPlayer2();
|
void nextPlayer2();
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ public:
|
|||||||
virtual void setHighestCardsValue(const int& theValue) =0;
|
virtual void setHighestCardsValue(const int& theValue) =0;
|
||||||
virtual int getHighestCardsValue() const =0;
|
virtual int getHighestCardsValue() const =0;
|
||||||
|
|
||||||
|
virtual void resetFirstRun() =0;
|
||||||
|
|
||||||
virtual void riverRun() =0;
|
virtual void riverRun() =0;
|
||||||
virtual void postRiverRun() =0;
|
virtual void postRiverRun() =0;
|
||||||
virtual void nextPlayer2() =0;
|
virtual void nextPlayer2() =0;
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ public:
|
|||||||
virtual void setSmallBlind(const int& theValue) =0;
|
virtual void setSmallBlind(const int& theValue) =0;
|
||||||
virtual int getSmallBlind() const =0;
|
virtual int getSmallBlind() const =0;
|
||||||
|
|
||||||
|
virtual void resetFirstRun() =0;
|
||||||
|
|
||||||
virtual void turnRun() =0;
|
virtual void turnRun() =0;
|
||||||
virtual void nextPlayer2() =0;
|
virtual void nextPlayer2() =0;
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ enum GameState {
|
|||||||
GAME_STATE_FLOP,
|
GAME_STATE_FLOP,
|
||||||
GAME_STATE_TURN,
|
GAME_STATE_TURN,
|
||||||
GAME_STATE_RIVER,
|
GAME_STATE_RIVER,
|
||||||
|
GAME_STATE_POST_RIVER,
|
||||||
GAME_STATE_PREFLOP_SMALL_BLIND = 0xF0,
|
GAME_STATE_PREFLOP_SMALL_BLIND = 0xF0,
|
||||||
GAME_STATE_PREFLOP_BIG_BLIND = 0xF1 };
|
GAME_STATE_PREFLOP_BIG_BLIND = 0xF1 };
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ void ServerGuiWrapper::refreshAll() const {}
|
|||||||
void ServerGuiWrapper::refreshPot() const {}
|
void ServerGuiWrapper::refreshPot() const {}
|
||||||
void ServerGuiWrapper::refreshGroupbox(int playerID, int status) const {}
|
void ServerGuiWrapper::refreshGroupbox(int playerID, int status) const {}
|
||||||
void ServerGuiWrapper::refreshPlayerName() const {}
|
void ServerGuiWrapper::refreshPlayerName() const {}
|
||||||
|
void ServerGuiWrapper::refreshButton() const {}
|
||||||
|
|
||||||
void ServerGuiWrapper::dealHoleCards() {}
|
void ServerGuiWrapper::dealHoleCards() {}
|
||||||
void ServerGuiWrapper::dealFlopCards() {}
|
void ServerGuiWrapper::dealFlopCards() {}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public:
|
|||||||
void refreshGroupbox(int =-1, int =-1) const;
|
void refreshGroupbox(int =-1, int =-1) const;
|
||||||
void refreshAll() const;
|
void refreshAll() const;
|
||||||
void refreshPlayerName() const;
|
void refreshPlayerName() const;
|
||||||
|
void refreshButton() const;
|
||||||
|
|
||||||
void dealHoleCards();
|
void dealHoleCards();
|
||||||
void dealFlopCards();
|
void dealFlopCards();
|
||||||
|
|||||||
@@ -48,11 +48,7 @@ public:
|
|||||||
virtual void refreshGroupbox(int =-1, int =-1) const=0;
|
virtual void refreshGroupbox(int =-1, int =-1) const=0;
|
||||||
virtual void refreshAll() const=0;
|
virtual void refreshAll() const=0;
|
||||||
virtual void refreshPlayerName() const=0;
|
virtual void refreshPlayerName() const=0;
|
||||||
|
virtual void refreshButton() const =0;
|
||||||
// virtual void refreshButton() const=0;
|
|
||||||
|
|
||||||
// virtual void refreshAction() const=0;
|
|
||||||
// virtual void refreshCash() const=0;
|
|
||||||
|
|
||||||
// // Karten-Funktionen
|
// // Karten-Funktionen
|
||||||
virtual void dealHoleCards()=0;
|
virtual void dealHoleCards()=0;
|
||||||
|
|||||||
+109
-108
@@ -1,108 +1,109 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2006 by FThauer FHammer *
|
* Copyright (C) 2006 by FThauer FHammer *
|
||||||
* f.thauer@web.de *
|
* f.thauer@web.de *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
* GNU General Public License for more details. *
|
* GNU General Public License for more details. *
|
||||||
* *
|
* *
|
||||||
* You should have received a copy of the GNU General Public License *
|
* You should have received a copy of the GNU General Public License *
|
||||||
* along with this program; if not, write to the *
|
* along with this program; if not, write to the *
|
||||||
* Free Software Foundation, Inc., *
|
* Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "guiwrapper.h"
|
#include "guiwrapper.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "chat.h"
|
#include "chat.h"
|
||||||
#include "mainwindowimpl.h"
|
#include "mainwindowimpl.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(0), myW(0), myConfig(c)
|
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(0), myW(0), myConfig(c)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
myW = new mainWindowImpl(myConfig);
|
myW = new mainWindowImpl(myConfig);
|
||||||
myW->show();
|
myW->show();
|
||||||
myLog = new Log(myW, myConfig);
|
myLog = new Log(myW, myConfig);
|
||||||
myChat = new Chat(myW, myConfig);
|
myChat = new Chat(myW, myConfig);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GuiWrapper::~GuiWrapper()
|
GuiWrapper::~GuiWrapper()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiWrapper::initGui(int speed) { myW->initGui(speed); }
|
void GuiWrapper::initGui(int speed) { myW->initGui(speed); }
|
||||||
|
|
||||||
Session &GuiWrapper::getSession() { return myW->getSession(); }
|
Session &GuiWrapper::getSession() { return myW->getSession(); }
|
||||||
void GuiWrapper::setSession(boost::shared_ptr<Session> session) { myW->setSession(session); }
|
void GuiWrapper::setSession(boost::shared_ptr<Session> session) { myW->setSession(session); }
|
||||||
|
|
||||||
void GuiWrapper::refreshSet() const { myW->signalRefreshSet(); }
|
void GuiWrapper::refreshSet() const { myW->signalRefreshSet(); }
|
||||||
void GuiWrapper::refreshCash() const { myW->signalRefreshCash(); }
|
void GuiWrapper::refreshCash() const { myW->signalRefreshCash(); }
|
||||||
void GuiWrapper::refreshAction(int playerID, int playerAction) const { myW->signalRefreshAction(playerID, playerAction); }
|
void GuiWrapper::refreshAction(int playerID, int playerAction) const { myW->signalRefreshAction(playerID, playerAction); }
|
||||||
void GuiWrapper::refreshChangePlayer() const { myW->signalRefreshChangePlayer(); }
|
void GuiWrapper::refreshChangePlayer() const { myW->signalRefreshChangePlayer(); }
|
||||||
void GuiWrapper::refreshAll() const { myW->signalRefreshAll(); }
|
void GuiWrapper::refreshAll() const { myW->signalRefreshAll(); }
|
||||||
void GuiWrapper::refreshPot() const { myW->signalRefreshPot(); }
|
void GuiWrapper::refreshPot() const { myW->signalRefreshPot(); }
|
||||||
void GuiWrapper::refreshGroupbox(int playerID, int status) const { myW->signalRefreshGroupbox(playerID, status); }
|
void GuiWrapper::refreshGroupbox(int playerID, int status) const { myW->signalRefreshGroupbox(playerID, status); }
|
||||||
void GuiWrapper::refreshPlayerName() const { myW->signalRefreshPlayerName(); }
|
void GuiWrapper::refreshPlayerName() const { myW->signalRefreshPlayerName(); }
|
||||||
|
void GuiWrapper::refreshButton() const { myW->signalRefreshButton(); }
|
||||||
void GuiWrapper::dealHoleCards() { myW->signalDealHoleCards(); }
|
|
||||||
void GuiWrapper::dealFlopCards() { myW->signalDealFlopCards0(); }
|
void GuiWrapper::dealHoleCards() { myW->signalDealHoleCards(); }
|
||||||
void GuiWrapper::dealTurnCard() { myW->signalDealTurnCards0(); }
|
void GuiWrapper::dealFlopCards() { myW->signalDealFlopCards0(); }
|
||||||
void GuiWrapper::dealRiverCard() { myW->signalDealRiverCards0(); }
|
void GuiWrapper::dealTurnCard() { myW->signalDealTurnCards0(); }
|
||||||
|
void GuiWrapper::dealRiverCard() { myW->signalDealRiverCards0(); }
|
||||||
void GuiWrapper::highlightRoundLabel(string round) const { myW->signalHighlightRoundLabel(QString::fromUtf8(round.c_str())); }
|
|
||||||
|
void GuiWrapper::highlightRoundLabel(string round) const { myW->signalHighlightRoundLabel(QString::fromUtf8(round.c_str())); }
|
||||||
|
|
||||||
void GuiWrapper::nextPlayerAnimation() { myW->signalNextPlayerAnimation(); }
|
|
||||||
|
void GuiWrapper::nextPlayerAnimation() { myW->signalNextPlayerAnimation(); }
|
||||||
void GuiWrapper::preflopAnimation1() { myW->signalPreflopAnimation1(); }
|
|
||||||
void GuiWrapper::preflopAnimation2() { myW->signalPreflopAnimation2(); }
|
void GuiWrapper::preflopAnimation1() { myW->signalPreflopAnimation1(); }
|
||||||
|
void GuiWrapper::preflopAnimation2() { myW->signalPreflopAnimation2(); }
|
||||||
void GuiWrapper::flopAnimation1() { myW->signalFlopAnimation1(); }
|
|
||||||
void GuiWrapper::flopAnimation2() { myW->signalFlopAnimation2(); }
|
void GuiWrapper::flopAnimation1() { myW->signalFlopAnimation1(); }
|
||||||
|
void GuiWrapper::flopAnimation2() { myW->signalFlopAnimation2(); }
|
||||||
void GuiWrapper::turnAnimation1() { myW->signalTurnAnimation1(); }
|
|
||||||
void GuiWrapper::turnAnimation2() { myW->signalTurnAnimation2(); }
|
void GuiWrapper::turnAnimation1() { myW->signalTurnAnimation1(); }
|
||||||
|
void GuiWrapper::turnAnimation2() { myW->signalTurnAnimation2(); }
|
||||||
void GuiWrapper::riverAnimation1() { myW->signalRiverAnimation1(); }
|
|
||||||
void GuiWrapper::riverAnimation2() { myW->signalRiverAnimation2(); }
|
void GuiWrapper::riverAnimation1() { myW->signalRiverAnimation1(); }
|
||||||
|
void GuiWrapper::riverAnimation2() { myW->signalRiverAnimation2(); }
|
||||||
void GuiWrapper::postRiverAnimation1() { myW->signalPostRiverAnimation1(); }
|
|
||||||
void GuiWrapper::postRiverRunAnimation1() { myW->signalPostRiverRunAnimation1(); }
|
void GuiWrapper::postRiverAnimation1() { myW->signalPostRiverAnimation1(); }
|
||||||
|
void GuiWrapper::postRiverRunAnimation1() { myW->signalPostRiverRunAnimation1(); }
|
||||||
void GuiWrapper::flipHolecardsAllIn() { myW->signalFlipHolecardsAllIn(); }
|
|
||||||
|
void GuiWrapper::flipHolecardsAllIn() { myW->signalFlipHolecardsAllIn(); }
|
||||||
void GuiWrapper::nextRoundCleanGui() { myW->signalNextRoundCleanGui(); }
|
|
||||||
|
void GuiWrapper::nextRoundCleanGui() { myW->signalNextRoundCleanGui(); }
|
||||||
void GuiWrapper::meInAction() { myW->signalMeInAction(); }
|
|
||||||
|
void GuiWrapper::meInAction() { myW->signalMeInAction(); }
|
||||||
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
|
|
||||||
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
|
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
|
||||||
|
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
|
||||||
void GuiWrapper::SignalNetClientConnect(int actionID) { myW->signalNetClientConnect(actionID); }
|
|
||||||
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGameInfo(actionID); }
|
void GuiWrapper::SignalNetClientConnect(int actionID) { myW->signalNetClientConnect(actionID); }
|
||||||
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->signalNetClientError(errorID, osErrorID); }
|
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGameInfo(actionID); }
|
||||||
void GuiWrapper::SignalNetClientPlayerJoined(const string &playerName) { myW->signalNetClientPlayerJoined(QString::fromUtf8(playerName.c_str())); }
|
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->signalNetClientError(errorID, osErrorID); }
|
||||||
void GuiWrapper::SignalNetClientPlayerLeft(const string &playerName) { myW->signalNetClientPlayerLeft(QString::fromUtf8(playerName.c_str())); }
|
void GuiWrapper::SignalNetClientPlayerJoined(const string &playerName) { myW->signalNetClientPlayerJoined(QString::fromUtf8(playerName.c_str())); }
|
||||||
void GuiWrapper::SignalNetClientGameStart(boost::shared_ptr<Game> game) { myW->signalNetClientGameStart(game); }
|
void GuiWrapper::SignalNetClientPlayerLeft(const string &playerName) { myW->signalNetClientPlayerLeft(QString::fromUtf8(playerName.c_str())); }
|
||||||
void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myChat->signalChatMessage(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); }
|
void GuiWrapper::SignalNetClientGameStart(boost::shared_ptr<Game> game) { myW->signalNetClientGameStart(game); }
|
||||||
|
void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myChat->signalChatMessage(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); }
|
||||||
void GuiWrapper::SignalNetServerSuccess(int actionID) { }
|
|
||||||
void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { }
|
void GuiWrapper::SignalNetServerSuccess(int actionID) { }
|
||||||
void GuiWrapper::SignalNetServerPlayerJoined(const string &playerName) { myW->signalNetServerPlayerJoined(QString::fromUtf8(playerName.c_str())); }
|
void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { }
|
||||||
void GuiWrapper::SignalNetServerPlayerLeft(const string &playerName) { myW->signalNetServerPlayerLeft(QString::fromUtf8(playerName.c_str())); }
|
void GuiWrapper::SignalNetServerPlayerJoined(const string &playerName) { myW->signalNetServerPlayerJoined(QString::fromUtf8(playerName.c_str())); }
|
||||||
|
void GuiWrapper::SignalNetServerPlayerLeft(const string &playerName) { myW->signalNetServerPlayerLeft(QString::fromUtf8(playerName.c_str())); }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+112
-111
@@ -1,111 +1,112 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2006 by FThauer FHammer *
|
* Copyright (C) 2006 by FThauer FHammer *
|
||||||
* f.thauer@web.de *
|
* f.thauer@web.de *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
* GNU General Public License for more details. *
|
* GNU General Public License for more details. *
|
||||||
* *
|
* *
|
||||||
* You should have received a copy of the GNU General Public License *
|
* You should have received a copy of the GNU General Public License *
|
||||||
* along with this program; if not, write to the *
|
* along with this program; if not, write to the *
|
||||||
* Free Software Foundation, Inc., *
|
* Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifndef GUIWRAPPER_H
|
#ifndef GUIWRAPPER_H
|
||||||
#define GUIWRAPPER_H
|
#define GUIWRAPPER_H
|
||||||
|
|
||||||
#include <guiinterface.h>
|
#include <guiinterface.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
class Session;
|
class Session;
|
||||||
class mainWindowImpl;
|
class mainWindowImpl;
|
||||||
class Log;
|
class Log;
|
||||||
class Chat;
|
class Chat;
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
|
|
||||||
class GuiWrapper : public GuiInterface
|
class GuiWrapper : public GuiInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GuiWrapper(ConfigFile*);
|
GuiWrapper(ConfigFile*);
|
||||||
|
|
||||||
~GuiWrapper();
|
~GuiWrapper();
|
||||||
|
|
||||||
void initGui(int speed);
|
void initGui(int speed);
|
||||||
|
|
||||||
Session &getSession();
|
Session &getSession();
|
||||||
void setSession(boost::shared_ptr<Session> session);
|
void setSession(boost::shared_ptr<Session> session);
|
||||||
|
|
||||||
void refreshSet() const;
|
void refreshSet() const;
|
||||||
void refreshCash() const;
|
void refreshCash() const;
|
||||||
void refreshAction(int =-1, int =-1) const;
|
void refreshAction(int =-1, int =-1) const;
|
||||||
void refreshChangePlayer() const;
|
void refreshChangePlayer() const;
|
||||||
void refreshPot() const;
|
void refreshPot() const;
|
||||||
void refreshGroupbox(int =-1, int =-1) const;
|
void refreshGroupbox(int =-1, int =-1) const;
|
||||||
void refreshAll() const;
|
void refreshAll() const;
|
||||||
void refreshPlayerName() const;
|
void refreshPlayerName() const;
|
||||||
|
void refreshButton() const;
|
||||||
void dealHoleCards();
|
|
||||||
void dealFlopCards();
|
void dealHoleCards();
|
||||||
void dealTurnCard();
|
void dealFlopCards();
|
||||||
void dealRiverCard();
|
void dealTurnCard();
|
||||||
|
void dealRiverCard();
|
||||||
void highlightRoundLabel(std::string round) const;
|
|
||||||
|
void highlightRoundLabel(std::string round) const;
|
||||||
void nextPlayerAnimation();
|
|
||||||
|
void nextPlayerAnimation();
|
||||||
void preflopAnimation1();
|
|
||||||
void preflopAnimation2();
|
void preflopAnimation1();
|
||||||
|
void preflopAnimation2();
|
||||||
void flopAnimation1();
|
|
||||||
void flopAnimation2();
|
void flopAnimation1();
|
||||||
|
void flopAnimation2();
|
||||||
void turnAnimation1();
|
|
||||||
void turnAnimation2();
|
void turnAnimation1();
|
||||||
|
void turnAnimation2();
|
||||||
void riverAnimation1();
|
|
||||||
void riverAnimation2();
|
void riverAnimation1();
|
||||||
|
void riverAnimation2();
|
||||||
void postRiverAnimation1();
|
|
||||||
void postRiverRunAnimation1();
|
void postRiverAnimation1();
|
||||||
|
void postRiverRunAnimation1();
|
||||||
void flipHolecardsAllIn();
|
|
||||||
|
void flipHolecardsAllIn();
|
||||||
void nextRoundCleanGui();
|
|
||||||
|
void nextRoundCleanGui();
|
||||||
void meInAction();
|
|
||||||
|
void meInAction();
|
||||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
|
||||||
void logNewGameHandMsg(int gameID, int handID) ;
|
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||||
|
void logNewGameHandMsg(int gameID, int handID) ;
|
||||||
void SignalNetClientConnect(int actionID);
|
|
||||||
void SignalNetClientGameInfo(int actionID);
|
void SignalNetClientConnect(int actionID);
|
||||||
void SignalNetClientError(int errorID, int osErrorID);
|
void SignalNetClientGameInfo(int actionID);
|
||||||
void SignalNetClientPlayerJoined(const std::string &playerName);
|
void SignalNetClientError(int errorID, int osErrorID);
|
||||||
void SignalNetClientPlayerLeft(const std::string &playerName);
|
void SignalNetClientPlayerJoined(const std::string &playerName);
|
||||||
void SignalNetClientChatMsg(const std::string &playerName, const std::string &msg);
|
void SignalNetClientPlayerLeft(const std::string &playerName);
|
||||||
|
void SignalNetClientChatMsg(const std::string &playerName, const std::string &msg);
|
||||||
void SignalNetClientGameStart(boost::shared_ptr<Game> game);
|
|
||||||
|
void SignalNetClientGameStart(boost::shared_ptr<Game> game);
|
||||||
void SignalNetServerSuccess(int actionID);
|
|
||||||
void SignalNetServerError(int errorID, int osErrorID);
|
void SignalNetServerSuccess(int actionID);
|
||||||
void SignalNetServerPlayerJoined(const std::string &playerName);
|
void SignalNetServerError(int errorID, int osErrorID);
|
||||||
void SignalNetServerPlayerLeft(const std::string &playerName);
|
void SignalNetServerPlayerJoined(const std::string &playerName);
|
||||||
|
void SignalNetServerPlayerLeft(const std::string &playerName);
|
||||||
private:
|
|
||||||
|
private:
|
||||||
Log *myLog;
|
|
||||||
Chat *myChat;
|
Log *myLog;
|
||||||
mainWindowImpl *myW;
|
Chat *myChat;
|
||||||
ConfigFile *myConfig;
|
mainWindowImpl *myW;
|
||||||
|
ConfigFile *myConfig;
|
||||||
};
|
|
||||||
|
};
|
||||||
#endif
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -571,6 +571,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
connect(this, SIGNAL(signalRefreshGroupbox(int, int)), this, SLOT(refreshGroupbox(int, int)));
|
connect(this, SIGNAL(signalRefreshGroupbox(int, int)), this, SLOT(refreshGroupbox(int, int)));
|
||||||
connect(this, SIGNAL(signalRefreshAll()), this, SLOT(refreshAll()));
|
connect(this, SIGNAL(signalRefreshAll()), this, SLOT(refreshAll()));
|
||||||
connect(this, SIGNAL(signalRefreshPlayerName()), this, SLOT(refreshPlayerName()));
|
connect(this, SIGNAL(signalRefreshPlayerName()), this, SLOT(refreshPlayerName()));
|
||||||
|
connect(this, SIGNAL(signalRefreshButton()), this, SLOT(refreshButton()));
|
||||||
|
|
||||||
connect(this, SIGNAL(signalMeInAction()), this, SLOT(meInAction()));
|
connect(this, SIGNAL(signalMeInAction()), this, SLOT(meInAction()));
|
||||||
|
|
||||||
@@ -1799,7 +1800,7 @@ void mainWindowImpl::postRiverRunAnimation2() {
|
|||||||
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
|
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
|
||||||
int activePlayersCounter = 0;
|
int activePlayersCounter = 0;
|
||||||
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
if (currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus() == 1) activePlayersCounter++;
|
if (currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus()) activePlayersCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(activePlayersCounter!=1) {
|
if(activePlayersCounter!=1) {
|
||||||
@@ -2021,6 +2022,11 @@ void mainWindowImpl::postRiverRunAnimation6() {
|
|||||||
refreshCash();
|
refreshCash();
|
||||||
refreshPot();
|
refreshPot();
|
||||||
|
|
||||||
|
// TODO HACK
|
||||||
|
// Check for network client, do not start new hand if client is running.
|
||||||
|
if (mySession->isNetworkClientRunning())
|
||||||
|
return;
|
||||||
|
|
||||||
// wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen
|
// wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen
|
||||||
int playersPositiveCashCounter = 0;
|
int playersPositiveCashCounter = 0;
|
||||||
for (i=0; i<mySession->getCurrentGame()->getStartQuantityPlayers(); i++) {
|
for (i=0; i<mySession->getCurrentGame()->getStartQuantityPlayers(); i++) {
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ signals:
|
|||||||
void signalRefreshGroupbox(int =-1, int =-1);
|
void signalRefreshGroupbox(int =-1, int =-1);
|
||||||
void signalRefreshAll();
|
void signalRefreshAll();
|
||||||
void signalRefreshPlayerName();
|
void signalRefreshPlayerName();
|
||||||
|
void signalRefreshButton();
|
||||||
|
|
||||||
void signalMeInAction();
|
void signalMeInAction();
|
||||||
|
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ ClientStateWaitHand::InternalProcess(ClientThread &client, boost::shared_ptr<Net
|
|||||||
client.GetGui().dealHoleCards();
|
client.GetGui().dealHoleCards();
|
||||||
client.SetState(ClientStateRunHand::Instance());
|
client.SetState(ClientStateRunHand::Instance());
|
||||||
|
|
||||||
retVal = MSG_NET_GAME_CLIENT_HAND;
|
retVal = MSG_NET_GAME_CLIENT_HAND_START;
|
||||||
}
|
}
|
||||||
|
|
||||||
return MSG_SOCK_INTERNAL_PENDING;
|
return MSG_SOCK_INTERNAL_PENDING;
|
||||||
@@ -566,6 +566,7 @@ ClientStateRunHand::~ClientStateRunHand()
|
|||||||
int
|
int
|
||||||
ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetPacket> packet)
|
ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetPacket> packet)
|
||||||
{
|
{
|
||||||
|
int retVal = MSG_SOCK_INTERNAL_PENDING;
|
||||||
ClientContext &context = client.GetContext();
|
ClientContext &context = client.GetContext();
|
||||||
|
|
||||||
if (packet.get())
|
if (packet.get())
|
||||||
@@ -601,6 +602,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
client.GetGui().refreshSet();
|
client.GetGui().refreshSet();
|
||||||
client.GetGui().refreshAction();
|
client.GetGui().refreshAction();
|
||||||
client.GetGui().refreshCash();
|
client.GetGui().refreshCash();
|
||||||
|
client.GetGui().refreshButton();
|
||||||
}
|
}
|
||||||
else if (packet->ToNetPacketPlayersTurn())
|
else if (packet->ToNetPacketPlayersTurn())
|
||||||
{
|
{
|
||||||
@@ -612,21 +614,21 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
// Set round.
|
// Set round.
|
||||||
if (curGame->getCurrentHand()->getActualRound() != turnData.gameState)
|
if (curGame->getCurrentHand()->getActualRound() != turnData.gameState)
|
||||||
{
|
{
|
||||||
// Reset player actions
|
// Reset player actions
|
||||||
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++)
|
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
int action = curGame->getPlayerArray()[i]->getMyAction();
|
int action = curGame->getPlayerArray()[i]->getMyAction();
|
||||||
if (action != 1 && action != 6)
|
if (action != 1 && action != 6)
|
||||||
curGame->getPlayerArray()[i]->setMyAction(0);
|
curGame->getPlayerArray()[i]->setMyAction(0);
|
||||||
}
|
}
|
||||||
// Move sets to pot
|
// Move sets to pot
|
||||||
curGame->getCurrentHand()->getBoard()->collectSets();
|
curGame->getCurrentHand()->getBoard()->collectSets();
|
||||||
curGame->getCurrentHand()->getBoard()->collectPot();
|
curGame->getCurrentHand()->getBoard()->collectPot();
|
||||||
|
|
||||||
client.GetGui().refreshPot();
|
client.GetGui().refreshPot();
|
||||||
client.GetGui().refreshSet();
|
client.GetGui().refreshSet();
|
||||||
client.GetGui().refreshAction();
|
client.GetGui().refreshAction();
|
||||||
client.GetGui().refreshCash();
|
client.GetGui().refreshCash();
|
||||||
|
|
||||||
curGame->getCurrentHand()->setActualRound(turnData.gameState);
|
curGame->getCurrentHand()->setActualRound(turnData.gameState);
|
||||||
}
|
}
|
||||||
@@ -650,9 +652,8 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
NetPacketDealFlopCards::Data cardsData;
|
NetPacketDealFlopCards::Data cardsData;
|
||||||
packet->ToNetPacketDealFlopCards()->GetData(cardsData);
|
packet->ToNetPacketDealFlopCards()->GetData(cardsData);
|
||||||
int tmpCards[5];
|
int tmpCards[5];
|
||||||
tmpCards[0] = static_cast<int>(cardsData.flopCards[0]);
|
for (int num = 0; num < 3; num++)
|
||||||
tmpCards[1] = static_cast<int>(cardsData.flopCards[1]);
|
tmpCards[num] = static_cast<int>(cardsData.flopCards[num]);
|
||||||
tmpCards[2] = static_cast<int>(cardsData.flopCards[2]);
|
|
||||||
tmpCards[3] = tmpCards[4] = 0;
|
tmpCards[3] = tmpCards[4] = 0;
|
||||||
curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards);
|
curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards);
|
||||||
client.GetGui().dealFlopCards();
|
client.GetGui().dealFlopCards();
|
||||||
@@ -677,9 +678,63 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards);
|
curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards);
|
||||||
client.GetGui().dealRiverCard();
|
client.GetGui().dealRiverCard();
|
||||||
}
|
}
|
||||||
|
else if (packet->ToNetPacketEndOfHandHideCards())
|
||||||
|
{
|
||||||
|
// End of Hand, but keep cards hidden.
|
||||||
|
NetPacketEndOfHandHideCards::Data endHandData;
|
||||||
|
packet->ToNetPacketEndOfHandHideCards()->GetData(endHandData);
|
||||||
|
|
||||||
|
PlayerInterface *tmpPlayer = curGame->getPlayerByUniqueId(endHandData.playerId);
|
||||||
|
assert(tmpPlayer); // TODO: throw exception
|
||||||
|
|
||||||
|
tmpPlayer->setMyCash(endHandData.playerMoney);
|
||||||
|
// TODO use moneyWon
|
||||||
|
client.GetGui().postRiverRunAnimation1();
|
||||||
|
|
||||||
|
// Wait for next Hand.
|
||||||
|
client.SetState(ClientStateWaitHand::Instance());
|
||||||
|
retVal = MSG_NET_GAME_SERVER_HAND_END;
|
||||||
|
}
|
||||||
|
else if (packet->ToNetPacketEndOfHandShowCards())
|
||||||
|
{
|
||||||
|
// End of Hand, show cards.
|
||||||
|
NetPacketEndOfHandShowCards::Data endHandData;
|
||||||
|
packet->ToNetPacketEndOfHandShowCards()->GetData(endHandData);
|
||||||
|
|
||||||
|
NetPacketEndOfHandShowCards::PlayerResultList::const_iterator i
|
||||||
|
= endHandData.playerResults.begin();
|
||||||
|
NetPacketEndOfHandShowCards::PlayerResultList::const_iterator end
|
||||||
|
= endHandData.playerResults.end();
|
||||||
|
|
||||||
|
int highestValueOfCards = 0;
|
||||||
|
while (i != end)
|
||||||
|
{
|
||||||
|
PlayerInterface *tmpPlayer = curGame->getPlayerByUniqueId((*i).playerId);
|
||||||
|
assert(tmpPlayer); // TODO: throw exception
|
||||||
|
|
||||||
|
int tmpCards[2];
|
||||||
|
tmpCards[0] = static_cast<int>((*i).cards[0]);
|
||||||
|
tmpCards[1] = static_cast<int>((*i).cards[1]);
|
||||||
|
tmpPlayer->setMyCards(tmpCards);
|
||||||
|
for (int num = 0; num < 5; num++)
|
||||||
|
tmpPlayer->getMyBestHandPosition()[num] = (*i).bestHandPos[num];
|
||||||
|
tmpPlayer->setMyCardsValueInt((*i).valueOfCards);
|
||||||
|
if (tmpPlayer->getMyCardsValueInt() > highestValueOfCards)
|
||||||
|
highestValueOfCards = tmpPlayer->getMyCardsValueInt();
|
||||||
|
tmpPlayer->setMyCash((*i).playerMoney);
|
||||||
|
// TODO use moneyWon
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
client.GetGame()->getCurrentHand()->getRiver()->setHighestCardsValue(highestValueOfCards);
|
||||||
|
client.GetGui().postRiverRunAnimation1();
|
||||||
|
|
||||||
|
// Wait for next Hand.
|
||||||
|
client.SetState(ClientStateWaitHand::Instance());
|
||||||
|
retVal = MSG_NET_GAME_SERVER_HAND_END;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return MSG_SOCK_INTERNAL_PENDING;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ using namespace std;
|
|||||||
#define NET_TYPE_DEAL_FLOP_CARDS 0x000B
|
#define NET_TYPE_DEAL_FLOP_CARDS 0x000B
|
||||||
#define NET_TYPE_DEAL_TURN_CARD 0x000C
|
#define NET_TYPE_DEAL_TURN_CARD 0x000C
|
||||||
#define NET_TYPE_DEAL_RIVER_CARD 0x000D
|
#define NET_TYPE_DEAL_RIVER_CARD 0x000D
|
||||||
|
#define NET_TYPE_END_OF_HAND_SHOW_CARDS 0x000E
|
||||||
|
#define NET_TYPE_END_OF_HAND_HIDE_CARDS 0x000F
|
||||||
|
|
||||||
#define NET_TYPE_SEND_CHAT_TEXT 0x0200
|
#define NET_TYPE_SEND_CHAT_TEXT 0x0200
|
||||||
#define NET_TYPE_CHAT_TEXT 0x0201
|
#define NET_TYPE_CHAT_TEXT 0x0201
|
||||||
@@ -194,6 +196,37 @@ struct GCC_PACKED NetPacketDealRiverCardData
|
|||||||
u_int16_t reserved;
|
u_int16_t reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct GCC_PACKED NetPacketEndOfHandShowCardsData
|
||||||
|
{
|
||||||
|
NetPacketHeader head;
|
||||||
|
u_int16_t numberOfPlayerResults;
|
||||||
|
u_int16_t reserved;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GCC_PACKED PlayerResultData
|
||||||
|
{
|
||||||
|
u_int16_t playerId;
|
||||||
|
u_int16_t card1;
|
||||||
|
u_int16_t card2;
|
||||||
|
u_int16_t bestHandPos1;
|
||||||
|
u_int16_t bestHandPos2;
|
||||||
|
u_int16_t bestHandPos3;
|
||||||
|
u_int16_t bestHandPos4;
|
||||||
|
u_int16_t bestHandPos5;
|
||||||
|
u_int32_t valueOfCards;
|
||||||
|
u_int32_t moneyWon;
|
||||||
|
u_int32_t playerMoney;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GCC_PACKED NetPacketEndOfHandHideCardsData
|
||||||
|
{
|
||||||
|
NetPacketHeader head;
|
||||||
|
u_int16_t playerId;
|
||||||
|
u_int16_t reserved;
|
||||||
|
u_int32_t moneyWon;
|
||||||
|
u_int32_t playerMoney;
|
||||||
|
};
|
||||||
|
|
||||||
struct GCC_PACKED NetPacketSendChatTextData
|
struct GCC_PACKED NetPacketSendChatTextData
|
||||||
{
|
{
|
||||||
NetPacketHeader head;
|
NetPacketHeader head;
|
||||||
@@ -281,6 +314,12 @@ NetPacket::Create(char *data, unsigned &dataSize)
|
|||||||
case NET_TYPE_DEAL_RIVER_CARD:
|
case NET_TYPE_DEAL_RIVER_CARD:
|
||||||
tmpPacket = boost::shared_ptr<NetPacket>(new NetPacketDealRiverCard);
|
tmpPacket = boost::shared_ptr<NetPacket>(new NetPacketDealRiverCard);
|
||||||
break;
|
break;
|
||||||
|
case NET_TYPE_END_OF_HAND_SHOW_CARDS:
|
||||||
|
tmpPacket = boost::shared_ptr<NetPacket>(new NetPacketEndOfHandShowCards);
|
||||||
|
break;
|
||||||
|
case NET_TYPE_END_OF_HAND_HIDE_CARDS:
|
||||||
|
tmpPacket = boost::shared_ptr<NetPacket>(new NetPacketEndOfHandHideCards);
|
||||||
|
break;
|
||||||
case NET_TYPE_SEND_CHAT_TEXT:
|
case NET_TYPE_SEND_CHAT_TEXT:
|
||||||
tmpPacket = boost::shared_ptr<NetPacket>(new NetPacketSendChatText);
|
tmpPacket = boost::shared_ptr<NetPacket>(new NetPacketSendChatText);
|
||||||
break;
|
break;
|
||||||
@@ -449,6 +488,18 @@ NetPacket::ToNetPacketDealRiverCard() const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const NetPacketEndOfHandShowCards *
|
||||||
|
NetPacket::ToNetPacketEndOfHandShowCards() const
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const NetPacketEndOfHandHideCards *
|
||||||
|
NetPacket::ToNetPacketEndOfHandHideCards() const
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
const NetPacketSendChatText *
|
const NetPacketSendChatText *
|
||||||
NetPacket::ToNetPacketSendChatText() const
|
NetPacket::ToNetPacketSendChatText() const
|
||||||
{
|
{
|
||||||
@@ -1493,6 +1544,199 @@ NetPacketDealRiverCard::Check(const NetPacketHeader* data) const
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
NetPacketEndOfHandShowCards::NetPacketEndOfHandShowCards()
|
||||||
|
: NetPacket(NET_TYPE_END_OF_HAND_SHOW_CARDS, sizeof(NetPacketEndOfHandShowCardsData))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NetPacketEndOfHandShowCards::~NetPacketEndOfHandShowCards()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<NetPacket>
|
||||||
|
NetPacketEndOfHandShowCards::Clone() const
|
||||||
|
{
|
||||||
|
boost::shared_ptr<NetPacket> newPacket(new NetPacketEndOfHandShowCards);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
newPacket->SetRawData(GetRawData());
|
||||||
|
} catch (const NetException &)
|
||||||
|
{
|
||||||
|
// Need to return the new packet anyway.
|
||||||
|
}
|
||||||
|
return newPacket;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NetPacketEndOfHandShowCards::SetData(const NetPacketEndOfHandShowCards::Data &inData)
|
||||||
|
{
|
||||||
|
u_int16_t numPlayerResults = (u_int16_t)inData.playerResults.size();
|
||||||
|
|
||||||
|
if (!numPlayerResults || numPlayerResults > MAX_NUM_PLAYER_RESULTS)
|
||||||
|
throw NetException(ERR_NET_INVALID_PLAYER_RESULTS, 0);
|
||||||
|
|
||||||
|
// Resize the packet so that the data fits in.
|
||||||
|
Resize((u_int16_t)
|
||||||
|
(sizeof(NetPacketEndOfHandShowCardsData) + numPlayerResults * sizeof(PlayerResultData)));
|
||||||
|
|
||||||
|
NetPacketEndOfHandShowCardsData *tmpData = (NetPacketEndOfHandShowCardsData *)GetRawData();
|
||||||
|
assert(tmpData);
|
||||||
|
|
||||||
|
tmpData->numberOfPlayerResults = htons(numPlayerResults);
|
||||||
|
|
||||||
|
PlayerResultList::const_iterator i = inData.playerResults.begin();
|
||||||
|
PlayerResultList::const_iterator end = inData.playerResults.end();
|
||||||
|
|
||||||
|
// Copy the player result data to continous memory
|
||||||
|
PlayerResultData *curPlayerResultData =
|
||||||
|
(PlayerResultData *)((char *)tmpData + sizeof(NetPacketEndOfHandShowCardsData));
|
||||||
|
while (i != end)
|
||||||
|
{
|
||||||
|
curPlayerResultData->playerId = htons((*i).playerId);
|
||||||
|
curPlayerResultData->card1 = htons((*i).cards[0]);
|
||||||
|
curPlayerResultData->card2 = htons((*i).cards[1]);
|
||||||
|
curPlayerResultData->bestHandPos1 = htons((*i).bestHandPos[0]);
|
||||||
|
curPlayerResultData->bestHandPos2 = htons((*i).bestHandPos[1]);
|
||||||
|
curPlayerResultData->bestHandPos3 = htons((*i).bestHandPos[2]);
|
||||||
|
curPlayerResultData->bestHandPos4 = htons((*i).bestHandPos[3]);
|
||||||
|
curPlayerResultData->bestHandPos5 = htons((*i).bestHandPos[4]);
|
||||||
|
curPlayerResultData->valueOfCards = htonl((*i).valueOfCards);
|
||||||
|
curPlayerResultData->moneyWon = htonl((*i).moneyWon);
|
||||||
|
curPlayerResultData->playerMoney = htonl((*i).playerMoney);
|
||||||
|
++curPlayerResultData;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NetPacketEndOfHandShowCards::GetData(NetPacketEndOfHandShowCards::Data &outData) const
|
||||||
|
{
|
||||||
|
NetPacketEndOfHandShowCardsData *tmpData = (NetPacketEndOfHandShowCardsData *)GetRawData();
|
||||||
|
assert(tmpData);
|
||||||
|
|
||||||
|
outData.playerResults.clear();
|
||||||
|
|
||||||
|
u_int16_t numPlayerResults = ntohs(tmpData->numberOfPlayerResults);
|
||||||
|
PlayerResultData *curPlayerResultData =
|
||||||
|
(PlayerResultData *)((char *)tmpData + sizeof(NetPacketEndOfHandShowCardsData));
|
||||||
|
|
||||||
|
// Store all available player results.
|
||||||
|
for (int i = 0; i < numPlayerResults; i++)
|
||||||
|
{
|
||||||
|
PlayerResult tmpPlayerResult;
|
||||||
|
tmpPlayerResult.playerId = ntohs(curPlayerResultData->playerId);
|
||||||
|
tmpPlayerResult.cards[0] = ntohs(curPlayerResultData->card1);
|
||||||
|
tmpPlayerResult.cards[1] = ntohs(curPlayerResultData->card2);
|
||||||
|
tmpPlayerResult.bestHandPos[0] = ntohs(curPlayerResultData->bestHandPos1);
|
||||||
|
tmpPlayerResult.bestHandPos[1] = ntohs(curPlayerResultData->bestHandPos2);
|
||||||
|
tmpPlayerResult.bestHandPos[2] = ntohs(curPlayerResultData->bestHandPos3);
|
||||||
|
tmpPlayerResult.bestHandPos[3] = ntohs(curPlayerResultData->bestHandPos4);
|
||||||
|
tmpPlayerResult.bestHandPos[4] = ntohs(curPlayerResultData->bestHandPos5);
|
||||||
|
tmpPlayerResult.valueOfCards = ntohl(curPlayerResultData->valueOfCards);
|
||||||
|
tmpPlayerResult.moneyWon = ntohl(curPlayerResultData->moneyWon);
|
||||||
|
tmpPlayerResult.playerMoney = ntohl(curPlayerResultData->playerMoney);
|
||||||
|
|
||||||
|
outData.playerResults.push_back(tmpPlayerResult);
|
||||||
|
++curPlayerResultData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const NetPacketEndOfHandShowCards *
|
||||||
|
NetPacketEndOfHandShowCards::ToNetPacketEndOfHandShowCards() const
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NetPacketEndOfHandShowCards::Check(const NetPacketHeader* data) const
|
||||||
|
{
|
||||||
|
assert(data);
|
||||||
|
|
||||||
|
u_int16_t dataLen = ntohs(data->length);
|
||||||
|
if (dataLen < sizeof(NetPacketEndOfHandShowCardsData))
|
||||||
|
{
|
||||||
|
throw NetException(ERR_SOCK_INVALID_PACKET, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
NetPacketEndOfHandShowCardsData *tmpData = (NetPacketEndOfHandShowCardsData *)data;
|
||||||
|
int numPlayerResults = ntohs(tmpData->numberOfPlayerResults);
|
||||||
|
|
||||||
|
if (dataLen !=
|
||||||
|
sizeof(NetPacketEndOfHandShowCardsData)
|
||||||
|
+ numPlayerResults * sizeof(PlayerResultData))
|
||||||
|
{
|
||||||
|
throw NetException(ERR_SOCK_INVALID_PACKET, 0);
|
||||||
|
}
|
||||||
|
// TODO: semantic checks within PlayerResultData
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
NetPacketEndOfHandHideCards::NetPacketEndOfHandHideCards()
|
||||||
|
: NetPacket(NET_TYPE_END_OF_HAND_HIDE_CARDS, sizeof(NetPacketEndOfHandHideCardsData))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NetPacketEndOfHandHideCards::~NetPacketEndOfHandHideCards()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<NetPacket>
|
||||||
|
NetPacketEndOfHandHideCards::Clone() const
|
||||||
|
{
|
||||||
|
boost::shared_ptr<NetPacket> newPacket(new NetPacketEndOfHandHideCards);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
newPacket->SetRawData(GetRawData());
|
||||||
|
} catch (const NetException &)
|
||||||
|
{
|
||||||
|
// Need to return the new packet anyway.
|
||||||
|
}
|
||||||
|
return newPacket;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NetPacketEndOfHandHideCards::SetData(const NetPacketEndOfHandHideCards::Data &inData)
|
||||||
|
{
|
||||||
|
NetPacketEndOfHandHideCardsData *tmpData = (NetPacketEndOfHandHideCardsData *)GetRawData();
|
||||||
|
assert(tmpData);
|
||||||
|
|
||||||
|
tmpData->playerId = htons(inData.playerId);
|
||||||
|
tmpData->moneyWon = htonl(inData.moneyWon);
|
||||||
|
tmpData->playerMoney = htonl(inData.playerMoney);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NetPacketEndOfHandHideCards::GetData(NetPacketEndOfHandHideCards::Data &outData) const
|
||||||
|
{
|
||||||
|
NetPacketEndOfHandHideCardsData *tmpData = (NetPacketEndOfHandHideCardsData *)GetRawData();
|
||||||
|
assert(tmpData);
|
||||||
|
|
||||||
|
outData.playerId = ntohs(tmpData->playerId);
|
||||||
|
outData.moneyWon = ntohl(tmpData->moneyWon);
|
||||||
|
outData.playerMoney = ntohl(tmpData->playerMoney);
|
||||||
|
}
|
||||||
|
|
||||||
|
const NetPacketEndOfHandHideCards *
|
||||||
|
NetPacketEndOfHandHideCards::ToNetPacketEndOfHandHideCards() const
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NetPacketEndOfHandHideCards::Check(const NetPacketHeader* data) const
|
||||||
|
{
|
||||||
|
assert(data);
|
||||||
|
|
||||||
|
u_int16_t dataLen = ntohs(data->length);
|
||||||
|
if (dataLen != sizeof(NetPacketEndOfHandHideCardsData))
|
||||||
|
{
|
||||||
|
throw NetException(ERR_SOCK_INVALID_PACKET, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
NetPacketSendChatText::NetPacketSendChatText()
|
NetPacketSendChatText::NetPacketSendChatText()
|
||||||
: NetPacket(NET_TYPE_SEND_CHAT_TEXT, sizeof(NetPacketSendChatTextData))
|
: NetPacket(NET_TYPE_SEND_CHAT_TEXT, sizeof(NetPacketSendChatTextData))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define SERVER_WAIT_TIMEOUT_MSEC 50
|
#define SERVER_WAIT_TIMEOUT_MSEC 50
|
||||||
|
#define SERVER_NEXT_HAND_DELAY_SEC 5
|
||||||
|
|
||||||
|
|
||||||
ServerRecvState::~ServerRecvState()
|
ServerRecvState::~ServerRecvState()
|
||||||
@@ -319,6 +320,11 @@ ServerRecvStateStartHand::Process(ServerRecvThread &server)
|
|||||||
Game &curGame = server.GetGame();
|
Game &curGame = server.GetGame();
|
||||||
curGame.initHand();
|
curGame.initHand();
|
||||||
|
|
||||||
|
// HACK: Skip GUI notification run
|
||||||
|
curGame.getCurrentHand()->getFlop()->resetFirstRun();
|
||||||
|
curGame.getCurrentHand()->getTurn()->resetFirstRun();
|
||||||
|
curGame.getCurrentHand()->getRiver()->resetFirstRun();
|
||||||
|
|
||||||
PlayerInterface **playerArray = curGame.getPlayerArray();
|
PlayerInterface **playerArray = curGame.getPlayerArray();
|
||||||
|
|
||||||
// Send cards to all players.
|
// Send cards to all players.
|
||||||
@@ -380,7 +386,7 @@ ServerRecvStateStartHand::Process(ServerRecvThread &server)
|
|||||||
|
|
||||||
server.SetState(ServerRecvStateStartRound::Instance());
|
server.SetState(ServerRecvStateStartRound::Instance());
|
||||||
|
|
||||||
return MSG_NET_GAME_SERVER_HAND;
|
return MSG_NET_GAME_SERVER_HAND_START;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -403,51 +409,142 @@ ServerRecvStateStartRound::~ServerRecvStateStartRound()
|
|||||||
int
|
int
|
||||||
ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
||||||
{
|
{
|
||||||
|
int retVal = MSG_SOCK_INTERNAL_PENDING;
|
||||||
Game &curGame = server.GetGame();
|
Game &curGame = server.GetGame();
|
||||||
|
|
||||||
curGame.getCurrentHand()->switchRounds();
|
|
||||||
|
|
||||||
// Call main loop - if state changes, call again.
|
// Call main loop - if state changes, call again.
|
||||||
int newRound = curGame.getCurrentHand()->getActualRound();
|
int newRound = curGame.getCurrentHand()->getActualRound();
|
||||||
int curRound;
|
int curRound;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
curRound = newRound;
|
curRound = newRound;
|
||||||
GameRun(curGame, curRound);
|
curGame.getCurrentHand()->switchRounds();
|
||||||
|
if (!curGame.getCurrentHand()->getAllInCondition())
|
||||||
|
GameRun(curGame);
|
||||||
newRound = curGame.getCurrentHand()->getActualRound();
|
newRound = curGame.getCurrentHand()->getActualRound();
|
||||||
|
|
||||||
// If round changes, deal cards if needed.
|
// If round changes, deal cards if needed.
|
||||||
if (newRound != curRound)
|
if (newRound != curRound)
|
||||||
{
|
{
|
||||||
// HACK: Skip GUI notification run
|
assert(newRound > curRound);
|
||||||
GameRun(curGame, newRound);
|
SendNewRoundCards(server, curGame, newRound);
|
||||||
SendNewRoundCards(server, curGame);
|
|
||||||
}
|
}
|
||||||
} while (newRound != curRound);
|
} while (newRound != curRound);
|
||||||
|
|
||||||
// Retrieve current player.
|
if (newRound != GAME_STATE_POST_RIVER) // continue hand
|
||||||
PlayerInterface *curPlayer = GetCurrentPlayer(curGame);
|
{
|
||||||
assert(curPlayer); // TODO throw exception
|
if (!curGame.getCurrentHand()->getAllInCondition())
|
||||||
assert(curPlayer->getMyActiveStatus()); // TODO throw exception
|
{
|
||||||
|
// Retrieve current player.
|
||||||
|
PlayerInterface *curPlayer = GetCurrentPlayer(curGame);
|
||||||
|
assert(curPlayer); // TODO throw exception
|
||||||
|
assert(curPlayer->getMyActiveStatus()); // TODO throw exception
|
||||||
|
|
||||||
boost::shared_ptr<NetPacket> notification(new NetPacketPlayersTurn);
|
boost::shared_ptr<NetPacket> notification(new NetPacketPlayersTurn);
|
||||||
NetPacketPlayersTurn::Data playersTurnData;
|
NetPacketPlayersTurn::Data playersTurnData;
|
||||||
playersTurnData.gameState = (GameState)curGame.getCurrentHand()->getActualRound();
|
playersTurnData.gameState = (GameState)curGame.getCurrentHand()->getActualRound();
|
||||||
playersTurnData.playerId = curPlayer->getMyUniqueID();
|
playersTurnData.playerId = curPlayer->getMyUniqueID();
|
||||||
static_cast<NetPacketPlayersTurn *>(notification.get())->SetData(playersTurnData);
|
static_cast<NetPacketPlayersTurn *>(notification.get())->SetData(playersTurnData);
|
||||||
|
|
||||||
server.SendToAllPlayers(notification);
|
server.SendToAllPlayers(notification);
|
||||||
|
|
||||||
server.SetState(ServerRecvStateWaitPlayerAction::Instance());
|
server.SetState(ServerRecvStateWaitPlayerAction::Instance());
|
||||||
|
|
||||||
return MSG_NET_GAME_SERVER_ROUND;
|
retVal = MSG_NET_GAME_SERVER_ROUND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // hand is over
|
||||||
|
{
|
||||||
|
// Let the engine find out the winner(s).
|
||||||
|
curGame.getCurrentHand()->getRiver()->postRiverRun();
|
||||||
|
|
||||||
|
// Count active players. If only one player is left, no cards are shown.
|
||||||
|
int activePlayersCounter = 0;
|
||||||
|
std::list<PlayerInterface *> activePlayers;
|
||||||
|
for (int i = 0; i < curGame.getActualQuantityPlayers() ; i++)
|
||||||
|
{
|
||||||
|
if (curGame.getPlayerArray()[i]->getMyActiveStatus()
|
||||||
|
&& curGame.getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD)
|
||||||
|
{
|
||||||
|
activePlayersCounter++;
|
||||||
|
activePlayers.push_back(curGame.getPlayerArray()[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(activePlayersCounter);
|
||||||
|
assert(!activePlayers.empty());
|
||||||
|
|
||||||
|
if (activePlayersCounter == 1)
|
||||||
|
{
|
||||||
|
// End of Hand, but keep cards hidden.
|
||||||
|
PlayerInterface *player = activePlayers.front();
|
||||||
|
boost::shared_ptr<NetPacket> endHand(new NetPacketEndOfHandHideCards);
|
||||||
|
NetPacketEndOfHandHideCards::Data endHandData;
|
||||||
|
endHandData.playerId = player->getMyUniqueID();
|
||||||
|
endHandData.moneyWon = 0; // TODO
|
||||||
|
endHandData.playerMoney = player->getMyCash();
|
||||||
|
static_cast<NetPacketEndOfHandHideCards *>(endHand.get())->SetData(endHandData);
|
||||||
|
|
||||||
|
server.SendToAllPlayers(endHand);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// End of Hand - show cards of active players.
|
||||||
|
boost::shared_ptr<NetPacket> endHand(new NetPacketEndOfHandShowCards);
|
||||||
|
NetPacketEndOfHandShowCards::Data endHandData;
|
||||||
|
|
||||||
|
std::list<PlayerInterface *>::iterator i = activePlayers.begin();
|
||||||
|
std::list<PlayerInterface *>::iterator end = activePlayers.end();
|
||||||
|
|
||||||
|
while (i != end)
|
||||||
|
{
|
||||||
|
NetPacketEndOfHandShowCards::PlayerResult tmpPlayerResult;
|
||||||
|
tmpPlayerResult.playerId = (*i)->getMyUniqueID();
|
||||||
|
|
||||||
|
int tmpCards[2];
|
||||||
|
(*i)->getMyCards(tmpCards);
|
||||||
|
tmpPlayerResult.cards[0] = static_cast<u_int16_t>(tmpCards[0]);
|
||||||
|
tmpPlayerResult.cards[1] = static_cast<u_int16_t>(tmpCards[1]);
|
||||||
|
|
||||||
|
for (int num = 0; num < 5; num++)
|
||||||
|
tmpPlayerResult.bestHandPos[num] = (*i)->getMyBestHandPosition()[num];
|
||||||
|
|
||||||
|
tmpPlayerResult.valueOfCards = (*i)->getMyCardsValueInt();
|
||||||
|
tmpPlayerResult.moneyWon = 0; // TODO
|
||||||
|
tmpPlayerResult.playerMoney = (*i)->getMyCash();
|
||||||
|
|
||||||
|
endHandData.playerResults.push_back(tmpPlayerResult);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
static_cast<NetPacketEndOfHandShowCards *>(endHand.get())->SetData(endHandData);
|
||||||
|
|
||||||
|
server.SendToAllPlayers(endHand);
|
||||||
|
}
|
||||||
|
// Start next hand - if enough players are left.
|
||||||
|
int playersPositiveCashCounter = 0;
|
||||||
|
for (int i = 0; i < curGame.getStartQuantityPlayers(); i++)
|
||||||
|
{
|
||||||
|
if (curGame.getCurrentHand()->getPlayerArray()[i]->getMyCash() > 0)
|
||||||
|
playersPositiveCashCounter++;
|
||||||
|
}
|
||||||
|
if (playersPositiveCashCounter == 1)
|
||||||
|
server.SetState(ServerRecvStateFinal::Instance()); // TODO
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boost::microsec_timer delayTimer;
|
||||||
|
delayTimer.start();
|
||||||
|
ServerRecvStateNextHand::Instance().SetTimer(delayTimer);
|
||||||
|
server.SetState(ServerRecvStateNextHand::Instance());
|
||||||
|
retVal = MSG_NET_GAME_SERVER_HAND_END;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerRecvStateStartRound::GameRun(Game &curGame, int state)
|
ServerRecvStateStartRound::GameRun(Game &curGame)
|
||||||
{
|
{
|
||||||
// TODO: no switch needed here if game states are polymorphic
|
// TODO: no switch needed here if game states are polymorphic
|
||||||
switch(state) {
|
switch(curGame.getCurrentHand()->getActualRound()) {
|
||||||
case GAME_STATE_PREFLOP: {
|
case GAME_STATE_PREFLOP: {
|
||||||
// Preflop starten
|
// Preflop starten
|
||||||
curGame.getCurrentHand()->getPreflop()->preflopRun();
|
curGame.getCurrentHand()->getPreflop()->preflopRun();
|
||||||
@@ -497,10 +594,10 @@ ServerRecvStateStartRound::GetCurrentPlayer(Game &curGame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerRecvStateStartRound::SendNewRoundCards(ServerRecvThread &server, Game &curGame)
|
ServerRecvStateStartRound::SendNewRoundCards(ServerRecvThread &server, Game &curGame, int state)
|
||||||
{
|
{
|
||||||
// TODO: no switch needed here if game states are polymorphic
|
// TODO: no switch needed here if game states are polymorphic
|
||||||
switch(curGame.getCurrentHand()->getActualRound()) {
|
switch(state) {
|
||||||
case GAME_STATE_PREFLOP: {
|
case GAME_STATE_PREFLOP: {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
} break;
|
} break;
|
||||||
@@ -510,9 +607,8 @@ ServerRecvStateStartRound::SendNewRoundCards(ServerRecvThread &server, Game &cur
|
|||||||
curGame.getCurrentHand()->getBoard()->getMyCards(cards);
|
curGame.getCurrentHand()->getBoard()->getMyCards(cards);
|
||||||
boost::shared_ptr<NetPacket> notifyCards(new NetPacketDealFlopCards);
|
boost::shared_ptr<NetPacket> notifyCards(new NetPacketDealFlopCards);
|
||||||
NetPacketDealFlopCards::Data notifyCardsData;
|
NetPacketDealFlopCards::Data notifyCardsData;
|
||||||
notifyCardsData.flopCards[0] = static_cast<u_int16_t>(cards[0]);
|
for (int num = 0; num < 3; num++)
|
||||||
notifyCardsData.flopCards[1] = static_cast<u_int16_t>(cards[1]);
|
notifyCardsData.flopCards[num] = static_cast<u_int16_t>(cards[num]);
|
||||||
notifyCardsData.flopCards[2] = static_cast<u_int16_t>(cards[2]);
|
|
||||||
static_cast<NetPacketDealFlopCards *>(notifyCards.get())->SetData(notifyCardsData);
|
static_cast<NetPacketDealFlopCards *>(notifyCards.get())->SetData(notifyCardsData);
|
||||||
server.SendToAllPlayers(notifyCards);
|
server.SendToAllPlayers(notifyCards);
|
||||||
} break;
|
} break;
|
||||||
@@ -658,6 +754,39 @@ ServerRecvStateWaitPlayerAction::SetHighestSet(Game &curGame, int highestSet)
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ServerRecvStateNextHand &
|
||||||
|
ServerRecvStateNextHand::Instance()
|
||||||
|
{
|
||||||
|
static ServerRecvStateNextHand state;
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerRecvStateNextHand::ServerRecvStateNextHand()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerRecvStateNextHand::~ServerRecvStateNextHand()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ServerRecvStateNextHand::SetTimer(const boost::microsec_timer &timer)
|
||||||
|
{
|
||||||
|
m_delayTimer = timer;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ServerRecvStateNextHand::Process(ServerRecvThread &server)
|
||||||
|
{
|
||||||
|
if (m_delayTimer.elapsed().seconds() >= SERVER_NEXT_HAND_DELAY_SEC)
|
||||||
|
server.SetState(ServerRecvStateStartHand::Instance());
|
||||||
|
Thread::Msleep(10);
|
||||||
|
|
||||||
|
return MSG_SOCK_INTERNAL_PENDING;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ServerRecvStateFinal &
|
ServerRecvStateFinal &
|
||||||
ServerRecvStateFinal::Instance()
|
ServerRecvStateFinal::Instance()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#define MAX_NAME_SIZE 64
|
#define MAX_NAME_SIZE 64
|
||||||
#define MAX_PASSWORD_SIZE 64
|
#define MAX_PASSWORD_SIZE 64
|
||||||
#define MAX_CHAT_TEXT_SIZE 128
|
#define MAX_CHAT_TEXT_SIZE 128
|
||||||
|
#define MAX_NUM_PLAYER_RESULTS MAX_NUMBER_OF_PLAYERS
|
||||||
|
|
||||||
|
|
||||||
struct NetPacketHeader;
|
struct NetPacketHeader;
|
||||||
@@ -51,6 +52,8 @@ class NetPacketPlayersActionRejected;
|
|||||||
class NetPacketDealFlopCards;
|
class NetPacketDealFlopCards;
|
||||||
class NetPacketDealTurnCard;
|
class NetPacketDealTurnCard;
|
||||||
class NetPacketDealRiverCard;
|
class NetPacketDealRiverCard;
|
||||||
|
class NetPacketEndOfHandShowCards;
|
||||||
|
class NetPacketEndOfHandHideCards;
|
||||||
class NetPacketSendChatText;
|
class NetPacketSendChatText;
|
||||||
class NetPacketChatText;
|
class NetPacketChatText;
|
||||||
class NetPacketError;
|
class NetPacketError;
|
||||||
@@ -85,6 +88,8 @@ public:
|
|||||||
virtual const NetPacketDealFlopCards *ToNetPacketDealFlopCards() const;
|
virtual const NetPacketDealFlopCards *ToNetPacketDealFlopCards() const;
|
||||||
virtual const NetPacketDealTurnCard *ToNetPacketDealTurnCard() const;
|
virtual const NetPacketDealTurnCard *ToNetPacketDealTurnCard() const;
|
||||||
virtual const NetPacketDealRiverCard *ToNetPacketDealRiverCard() const;
|
virtual const NetPacketDealRiverCard *ToNetPacketDealRiverCard() const;
|
||||||
|
virtual const NetPacketEndOfHandShowCards *ToNetPacketEndOfHandShowCards() const;
|
||||||
|
virtual const NetPacketEndOfHandHideCards *ToNetPacketEndOfHandHideCards() const;
|
||||||
virtual const NetPacketSendChatText *ToNetPacketSendChatText() const;
|
virtual const NetPacketSendChatText *ToNetPacketSendChatText() const;
|
||||||
virtual const NetPacketChatText *ToNetPacketChatText() const;
|
virtual const NetPacketChatText *ToNetPacketChatText() const;
|
||||||
virtual const NetPacketError *ToNetPacketError() const;
|
virtual const NetPacketError *ToNetPacketError() const;
|
||||||
@@ -423,6 +428,66 @@ protected:
|
|||||||
virtual void Check(const NetPacketHeader* data) const;
|
virtual void Check(const NetPacketHeader* data) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NetPacketEndOfHandShowCards : public NetPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct PlayerResult
|
||||||
|
{
|
||||||
|
u_int16_t playerId;
|
||||||
|
u_int16_t cards[2];
|
||||||
|
u_int16_t bestHandPos[5];
|
||||||
|
u_int32_t valueOfCards;
|
||||||
|
u_int32_t moneyWon;
|
||||||
|
u_int32_t playerMoney;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::list<PlayerResult> PlayerResultList;
|
||||||
|
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
PlayerResultList playerResults;
|
||||||
|
};
|
||||||
|
|
||||||
|
NetPacketEndOfHandShowCards();
|
||||||
|
virtual ~NetPacketEndOfHandShowCards();
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
||||||
|
|
||||||
|
void SetData(const Data &inData);
|
||||||
|
void GetData(Data &outData) const;
|
||||||
|
|
||||||
|
virtual const NetPacketEndOfHandShowCards *ToNetPacketEndOfHandShowCards() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void Check(const NetPacketHeader* data) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NetPacketEndOfHandHideCards : public NetPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
u_int16_t playerId;
|
||||||
|
u_int32_t moneyWon;
|
||||||
|
u_int32_t playerMoney;
|
||||||
|
};
|
||||||
|
|
||||||
|
NetPacketEndOfHandHideCards();
|
||||||
|
virtual ~NetPacketEndOfHandHideCards();
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
||||||
|
|
||||||
|
void SetData(const Data &inData);
|
||||||
|
void GetData(Data &outData) const;
|
||||||
|
|
||||||
|
virtual const NetPacketEndOfHandHideCards *ToNetPacketEndOfHandHideCards() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void Check(const NetPacketHeader* data) const;
|
||||||
|
};
|
||||||
|
|
||||||
class NetPacketSendChatText : public NetPacket
|
class NetPacketSendChatText : public NetPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
unsigned m_curUniquePlayerId;
|
u_int16_t m_curUniquePlayerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Abstract State: Game is running.
|
// Abstract State: Game is running.
|
||||||
@@ -151,9 +151,9 @@ protected:
|
|||||||
// Protected constructor - this is a singleton.
|
// Protected constructor - this is a singleton.
|
||||||
ServerRecvStateStartRound();
|
ServerRecvStateStartRound();
|
||||||
|
|
||||||
static void GameRun(Game &curGame, int state);
|
static void GameRun(Game &curGame);
|
||||||
static PlayerInterface *GetCurrentPlayer(Game &curGame);
|
static PlayerInterface *GetCurrentPlayer(Game &curGame);
|
||||||
static void SendNewRoundCards(ServerRecvThread &server, Game &curGame);
|
static void SendNewRoundCards(ServerRecvThread &server, Game &curGame, int state);
|
||||||
};
|
};
|
||||||
|
|
||||||
// State: Wait for a player action.
|
// State: Wait for a player action.
|
||||||
@@ -178,6 +178,30 @@ protected:
|
|||||||
static void SetHighestSet(Game &curGame, int highestSet);
|
static void SetHighestSet(Game &curGame, int highestSet);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// State: Final.
|
||||||
|
class ServerRecvStateNextHand : public ServerRecvStateRunning
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Access the state singleton.
|
||||||
|
static ServerRecvStateNextHand &Instance();
|
||||||
|
|
||||||
|
virtual ~ServerRecvStateNextHand();
|
||||||
|
|
||||||
|
void SetTimer(const boost::microsec_timer &timer);
|
||||||
|
|
||||||
|
//
|
||||||
|
virtual int Process(ServerRecvThread &server);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected constructor - this is a singleton.
|
||||||
|
ServerRecvStateNextHand();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
boost::microsec_timer m_delayTimer;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// State: Final.
|
// State: Final.
|
||||||
class ServerRecvStateFinal : public ServerRecvStateRunning
|
class ServerRecvStateFinal : public ServerRecvStateRunning
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ friend class ServerRecvStateStartGame;
|
|||||||
friend class ServerRecvStateStartHand;
|
friend class ServerRecvStateStartHand;
|
||||||
friend class ServerRecvStateStartRound;
|
friend class ServerRecvStateStartRound;
|
||||||
friend class ServerRecvStateWaitPlayerAction;
|
friend class ServerRecvStateWaitPlayerAction;
|
||||||
|
friend class ServerRecvStateNextHand;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -48,7 +48,8 @@
|
|||||||
#define ERR_NET_INVALID_PASSWORD_STR 105
|
#define ERR_NET_INVALID_PASSWORD_STR 105
|
||||||
#define ERR_NET_PLAYER_NAME_IN_USE 106
|
#define ERR_NET_PLAYER_NAME_IN_USE 106
|
||||||
#define ERR_NET_INVALID_PLAYER_NAME 107
|
#define ERR_NET_INVALID_PLAYER_NAME 107
|
||||||
#define ERR_NET_INVALID_CHAT_TEXT 108
|
#define ERR_NET_INVALID_PLAYER_RESULTS 108
|
||||||
|
#define ERR_NET_INVALID_CHAT_TEXT 109
|
||||||
|
|
||||||
// This is an internal message which is not reported.
|
// This is an internal message which is not reported.
|
||||||
#define MSG_SOCK_INTERNAL_PENDING 0
|
#define MSG_SOCK_INTERNAL_PENDING 0
|
||||||
@@ -65,9 +66,11 @@
|
|||||||
// The following messages are game messages.
|
// The following messages are game messages.
|
||||||
#define MSG_NET_GAME_CLIENT_START 5
|
#define MSG_NET_GAME_CLIENT_START 5
|
||||||
#define MSG_NET_GAME_SERVER_START 6
|
#define MSG_NET_GAME_SERVER_START 6
|
||||||
#define MSG_NET_GAME_CLIENT_HAND 7
|
#define MSG_NET_GAME_CLIENT_HAND_START 7
|
||||||
#define MSG_NET_GAME_SERVER_HAND 8
|
#define MSG_NET_GAME_CLIENT_HAND_END 8
|
||||||
#define MSG_NET_GAME_SERVER_ROUND 10
|
#define MSG_NET_GAME_SERVER_HAND_START 9
|
||||||
|
#define MSG_NET_GAME_SERVER_HAND_END 10
|
||||||
|
#define MSG_NET_GAME_SERVER_ROUND 11
|
||||||
#define MSG_NET_GAME_SERVER_ACTION 12
|
#define MSG_NET_GAME_SERVER_ACTION 12
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -194,3 +194,10 @@ void Session::sendChatMessage(const std::string &message) {
|
|||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendChatMessage(message);
|
myNetClient->SendChatMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Session::isNetworkClientRunning() const
|
||||||
|
{
|
||||||
|
// This, and every place which calls this, is a HACK.
|
||||||
|
// TODO
|
||||||
|
return myNetClient != NULL;
|
||||||
|
}
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ public:
|
|||||||
|
|
||||||
void sendChatMessage(const std::string &message);
|
void sendChatMessage(const std::string &message);
|
||||||
|
|
||||||
|
bool isNetworkClientRunning() const; // TODO hack
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int currentGameID;
|
int currentGameID;
|
||||||
|
|||||||
Reference in New Issue
Block a user