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:
@@ -24,7 +24,7 @@ class FlopInterface{
|
||||
public:
|
||||
|
||||
|
||||
virtual ~FlopInterface();
|
||||
virtual ~FlopInterface();
|
||||
|
||||
virtual void setPlayersTurn(const int& theValue) =0;
|
||||
virtual int getPlayersTurn() const =0;
|
||||
@@ -41,6 +41,8 @@ public:
|
||||
virtual void setSmallBlind(const int& theValue) =0;
|
||||
virtual int getSmallBlind() const =0;
|
||||
|
||||
virtual void resetFirstRun() =0;
|
||||
|
||||
virtual void flopRun() =0;
|
||||
virtual void nextPlayer2() =0;
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ public:
|
||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void resetFirstRun() { firstFlopRun = false; }
|
||||
|
||||
void flopRun();
|
||||
void nextPlayer2();
|
||||
|
||||
|
||||
@@ -347,7 +347,8 @@ void LocalHand::switchRounds() {
|
||||
myGui->refreshPot();
|
||||
myGui->refreshSet();
|
||||
myGui->flipHolecardsAllIn();
|
||||
actualRound++;
|
||||
if (actualRound < 4) // do not increment past 4
|
||||
actualRound++;
|
||||
}
|
||||
|
||||
//unhighlight actual players groupbox
|
||||
|
||||
@@ -48,6 +48,8 @@ public:
|
||||
void setHighestCardsValue(const int& theValue) { highestCardsValue = theValue;}
|
||||
int getHighestCardsValue() const { return highestCardsValue;}
|
||||
|
||||
void resetFirstRun() { firstRiverRun = false; }
|
||||
|
||||
void riverRun();
|
||||
void postRiverRun();
|
||||
void nextPlayer2();
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void resetFirstRun() { firstTurnRun = false; }
|
||||
|
||||
void turnRun();
|
||||
void nextPlayer2();
|
||||
|
||||
|
||||
@@ -47,20 +47,20 @@ ClientBoard::setHand(HandInterface* br)
|
||||
|
||||
void
|
||||
ClientBoard::collectSets()
|
||||
{
|
||||
sets = 0;
|
||||
int i;
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) sets += playerArray[i]->getMySet();
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
sets = 0;
|
||||
int i;
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) sets += playerArray[i]->getMySet();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ClientBoard::collectPot()
|
||||
{
|
||||
int i;
|
||||
pot += sets;
|
||||
sets = 0;
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++){ playerArray[i]->setMySetNull(); }
|
||||
}
|
||||
int i;
|
||||
pot += sets;
|
||||
sets = 0;
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++){ playerArray[i]->setMySetNull(); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void resetFirstRun() { firstFlopRun = false; }
|
||||
|
||||
void flopRun();
|
||||
void nextPlayer2();
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
void setHighestCardsValue(const int& theValue) { highestCardsValue = theValue;}
|
||||
int getHighestCardsValue() const { return highestCardsValue;}
|
||||
|
||||
void resetFirstRun() { firstRiverRun = false; }
|
||||
|
||||
void riverRun();
|
||||
void postRiverRun();
|
||||
void nextPlayer2();
|
||||
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void resetFirstRun() { firstTurnRun = false; }
|
||||
|
||||
void turnRun();
|
||||
void nextPlayer2();
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
virtual void setHighestCardsValue(const int& theValue) =0;
|
||||
virtual int getHighestCardsValue() const =0;
|
||||
|
||||
virtual void resetFirstRun() =0;
|
||||
|
||||
virtual void riverRun() =0;
|
||||
virtual void postRiverRun() =0;
|
||||
virtual void nextPlayer2() =0;
|
||||
|
||||
@@ -40,6 +40,8 @@ public:
|
||||
virtual void setSmallBlind(const int& theValue) =0;
|
||||
virtual int getSmallBlind() const =0;
|
||||
|
||||
virtual void resetFirstRun() =0;
|
||||
|
||||
virtual void turnRun() =0;
|
||||
virtual void nextPlayer2() =0;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ enum GameState {
|
||||
GAME_STATE_FLOP,
|
||||
GAME_STATE_TURN,
|
||||
GAME_STATE_RIVER,
|
||||
GAME_STATE_POST_RIVER,
|
||||
GAME_STATE_PREFLOP_SMALL_BLIND = 0xF0,
|
||||
GAME_STATE_PREFLOP_BIG_BLIND = 0xF1 };
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ void ServerGuiWrapper::refreshAll() const {}
|
||||
void ServerGuiWrapper::refreshPot() const {}
|
||||
void ServerGuiWrapper::refreshGroupbox(int playerID, int status) const {}
|
||||
void ServerGuiWrapper::refreshPlayerName() const {}
|
||||
void ServerGuiWrapper::refreshButton() const {}
|
||||
|
||||
void ServerGuiWrapper::dealHoleCards() {}
|
||||
void ServerGuiWrapper::dealFlopCards() {}
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
void refreshGroupbox(int =-1, int =-1) const;
|
||||
void refreshAll() const;
|
||||
void refreshPlayerName() const;
|
||||
void refreshButton() const;
|
||||
|
||||
void dealHoleCards();
|
||||
void dealFlopCards();
|
||||
|
||||
@@ -48,11 +48,7 @@ public:
|
||||
virtual void refreshGroupbox(int =-1, int =-1) const=0;
|
||||
virtual void refreshAll() const=0;
|
||||
virtual void refreshPlayerName() const=0;
|
||||
|
||||
// virtual void refreshButton() const=0;
|
||||
|
||||
// virtual void refreshAction() const=0;
|
||||
// virtual void refreshCash() const=0;
|
||||
virtual void refreshButton() const =0;
|
||||
|
||||
// // Karten-Funktionen
|
||||
virtual void dealHoleCards()=0;
|
||||
|
||||
+109
-108
@@ -1,108 +1,109 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* 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 *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "guiwrapper.h"
|
||||
#include "session.h"
|
||||
#include "log.h"
|
||||
#include "chat.h"
|
||||
#include "mainwindowimpl.h"
|
||||
#include "configfile.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(0), myW(0), myConfig(c)
|
||||
{
|
||||
|
||||
|
||||
myW = new mainWindowImpl(myConfig);
|
||||
myW->show();
|
||||
myLog = new Log(myW, myConfig);
|
||||
myChat = new Chat(myW, myConfig);
|
||||
|
||||
}
|
||||
|
||||
|
||||
GuiWrapper::~GuiWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
void GuiWrapper::initGui(int speed) { myW->initGui(speed); }
|
||||
|
||||
Session &GuiWrapper::getSession() { return myW->getSession(); }
|
||||
void GuiWrapper::setSession(boost::shared_ptr<Session> session) { myW->setSession(session); }
|
||||
|
||||
void GuiWrapper::refreshSet() const { myW->signalRefreshSet(); }
|
||||
void GuiWrapper::refreshCash() const { myW->signalRefreshCash(); }
|
||||
void GuiWrapper::refreshAction(int playerID, int playerAction) const { myW->signalRefreshAction(playerID, playerAction); }
|
||||
void GuiWrapper::refreshChangePlayer() const { myW->signalRefreshChangePlayer(); }
|
||||
void GuiWrapper::refreshAll() const { myW->signalRefreshAll(); }
|
||||
void GuiWrapper::refreshPot() const { myW->signalRefreshPot(); }
|
||||
void GuiWrapper::refreshGroupbox(int playerID, int status) const { myW->signalRefreshGroupbox(playerID, status); }
|
||||
void GuiWrapper::refreshPlayerName() const { myW->signalRefreshPlayerName(); }
|
||||
|
||||
void GuiWrapper::dealHoleCards() { myW->signalDealHoleCards(); }
|
||||
void GuiWrapper::dealFlopCards() { myW->signalDealFlopCards0(); }
|
||||
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::nextPlayerAnimation() { myW->signalNextPlayerAnimation(); }
|
||||
|
||||
void GuiWrapper::preflopAnimation1() { myW->signalPreflopAnimation1(); }
|
||||
void GuiWrapper::preflopAnimation2() { myW->signalPreflopAnimation2(); }
|
||||
|
||||
void GuiWrapper::flopAnimation1() { myW->signalFlopAnimation1(); }
|
||||
void GuiWrapper::flopAnimation2() { myW->signalFlopAnimation2(); }
|
||||
|
||||
void GuiWrapper::turnAnimation1() { myW->signalTurnAnimation1(); }
|
||||
void GuiWrapper::turnAnimation2() { myW->signalTurnAnimation2(); }
|
||||
|
||||
void GuiWrapper::riverAnimation1() { myW->signalRiverAnimation1(); }
|
||||
void GuiWrapper::riverAnimation2() { myW->signalRiverAnimation2(); }
|
||||
|
||||
void GuiWrapper::postRiverAnimation1() { myW->signalPostRiverAnimation1(); }
|
||||
void GuiWrapper::postRiverRunAnimation1() { myW->signalPostRiverRunAnimation1(); }
|
||||
|
||||
void GuiWrapper::flipHolecardsAllIn() { myW->signalFlipHolecardsAllIn(); }
|
||||
|
||||
void GuiWrapper::nextRoundCleanGui() { myW->signalNextRoundCleanGui(); }
|
||||
|
||||
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::SignalNetClientConnect(int actionID) { myW->signalNetClientConnect(actionID); }
|
||||
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGameInfo(actionID); }
|
||||
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->signalNetClientError(errorID, osErrorID); }
|
||||
void GuiWrapper::SignalNetClientPlayerJoined(const string &playerName) { myW->signalNetClientPlayerJoined(QString::fromUtf8(playerName.c_str())); }
|
||||
void GuiWrapper::SignalNetClientPlayerLeft(const string &playerName) { myW->signalNetClientPlayerLeft(QString::fromUtf8(playerName.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::SignalNetServerPlayerJoined(const string &playerName) { myW->signalNetServerPlayerJoined(QString::fromUtf8(playerName.c_str())); }
|
||||
void GuiWrapper::SignalNetServerPlayerLeft(const string &playerName) { myW->signalNetServerPlayerLeft(QString::fromUtf8(playerName.c_str())); }
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* 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 *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "guiwrapper.h"
|
||||
#include "session.h"
|
||||
#include "log.h"
|
||||
#include "chat.h"
|
||||
#include "mainwindowimpl.h"
|
||||
#include "configfile.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(0), myW(0), myConfig(c)
|
||||
{
|
||||
|
||||
|
||||
myW = new mainWindowImpl(myConfig);
|
||||
myW->show();
|
||||
myLog = new Log(myW, myConfig);
|
||||
myChat = new Chat(myW, myConfig);
|
||||
|
||||
}
|
||||
|
||||
|
||||
GuiWrapper::~GuiWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
void GuiWrapper::initGui(int speed) { myW->initGui(speed); }
|
||||
|
||||
Session &GuiWrapper::getSession() { return myW->getSession(); }
|
||||
void GuiWrapper::setSession(boost::shared_ptr<Session> session) { myW->setSession(session); }
|
||||
|
||||
void GuiWrapper::refreshSet() const { myW->signalRefreshSet(); }
|
||||
void GuiWrapper::refreshCash() const { myW->signalRefreshCash(); }
|
||||
void GuiWrapper::refreshAction(int playerID, int playerAction) const { myW->signalRefreshAction(playerID, playerAction); }
|
||||
void GuiWrapper::refreshChangePlayer() const { myW->signalRefreshChangePlayer(); }
|
||||
void GuiWrapper::refreshAll() const { myW->signalRefreshAll(); }
|
||||
void GuiWrapper::refreshPot() const { myW->signalRefreshPot(); }
|
||||
void GuiWrapper::refreshGroupbox(int playerID, int status) const { myW->signalRefreshGroupbox(playerID, status); }
|
||||
void GuiWrapper::refreshPlayerName() const { myW->signalRefreshPlayerName(); }
|
||||
void GuiWrapper::refreshButton() const { myW->signalRefreshButton(); }
|
||||
|
||||
void GuiWrapper::dealHoleCards() { myW->signalDealHoleCards(); }
|
||||
void GuiWrapper::dealFlopCards() { myW->signalDealFlopCards0(); }
|
||||
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::nextPlayerAnimation() { myW->signalNextPlayerAnimation(); }
|
||||
|
||||
void GuiWrapper::preflopAnimation1() { myW->signalPreflopAnimation1(); }
|
||||
void GuiWrapper::preflopAnimation2() { myW->signalPreflopAnimation2(); }
|
||||
|
||||
void GuiWrapper::flopAnimation1() { myW->signalFlopAnimation1(); }
|
||||
void GuiWrapper::flopAnimation2() { myW->signalFlopAnimation2(); }
|
||||
|
||||
void GuiWrapper::turnAnimation1() { myW->signalTurnAnimation1(); }
|
||||
void GuiWrapper::turnAnimation2() { myW->signalTurnAnimation2(); }
|
||||
|
||||
void GuiWrapper::riverAnimation1() { myW->signalRiverAnimation1(); }
|
||||
void GuiWrapper::riverAnimation2() { myW->signalRiverAnimation2(); }
|
||||
|
||||
void GuiWrapper::postRiverAnimation1() { myW->signalPostRiverAnimation1(); }
|
||||
void GuiWrapper::postRiverRunAnimation1() { myW->signalPostRiverRunAnimation1(); }
|
||||
|
||||
void GuiWrapper::flipHolecardsAllIn() { myW->signalFlipHolecardsAllIn(); }
|
||||
|
||||
void GuiWrapper::nextRoundCleanGui() { myW->signalNextRoundCleanGui(); }
|
||||
|
||||
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::SignalNetClientConnect(int actionID) { myW->signalNetClientConnect(actionID); }
|
||||
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGameInfo(actionID); }
|
||||
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->signalNetClientError(errorID, osErrorID); }
|
||||
void GuiWrapper::SignalNetClientPlayerJoined(const string &playerName) { myW->signalNetClientPlayerJoined(QString::fromUtf8(playerName.c_str())); }
|
||||
void GuiWrapper::SignalNetClientPlayerLeft(const string &playerName) { myW->signalNetClientPlayerLeft(QString::fromUtf8(playerName.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::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 *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* 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 *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef GUIWRAPPER_H
|
||||
#define GUIWRAPPER_H
|
||||
|
||||
#include <guiinterface.h>
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
class Session;
|
||||
class mainWindowImpl;
|
||||
class Log;
|
||||
class Chat;
|
||||
class ConfigFile;
|
||||
|
||||
class GuiWrapper : public GuiInterface
|
||||
{
|
||||
public:
|
||||
GuiWrapper(ConfigFile*);
|
||||
|
||||
~GuiWrapper();
|
||||
|
||||
void initGui(int speed);
|
||||
|
||||
Session &getSession();
|
||||
void setSession(boost::shared_ptr<Session> session);
|
||||
|
||||
void refreshSet() const;
|
||||
void refreshCash() const;
|
||||
void refreshAction(int =-1, int =-1) const;
|
||||
void refreshChangePlayer() const;
|
||||
void refreshPot() const;
|
||||
void refreshGroupbox(int =-1, int =-1) const;
|
||||
void refreshAll() const;
|
||||
void refreshPlayerName() const;
|
||||
|
||||
void dealHoleCards();
|
||||
void dealFlopCards();
|
||||
void dealTurnCard();
|
||||
void dealRiverCard();
|
||||
|
||||
void highlightRoundLabel(std::string round) const;
|
||||
|
||||
void nextPlayerAnimation();
|
||||
|
||||
void preflopAnimation1();
|
||||
void preflopAnimation2();
|
||||
|
||||
void flopAnimation1();
|
||||
void flopAnimation2();
|
||||
|
||||
void turnAnimation1();
|
||||
void turnAnimation2();
|
||||
|
||||
void riverAnimation1();
|
||||
void riverAnimation2();
|
||||
|
||||
void postRiverAnimation1();
|
||||
void postRiverRunAnimation1();
|
||||
|
||||
void flipHolecardsAllIn();
|
||||
|
||||
void nextRoundCleanGui();
|
||||
|
||||
void meInAction();
|
||||
|
||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||
void logNewGameHandMsg(int gameID, int handID) ;
|
||||
|
||||
void SignalNetClientConnect(int actionID);
|
||||
void SignalNetClientGameInfo(int actionID);
|
||||
void SignalNetClientError(int errorID, int osErrorID);
|
||||
void SignalNetClientPlayerJoined(const std::string &playerName);
|
||||
void SignalNetClientPlayerLeft(const std::string &playerName);
|
||||
void SignalNetClientChatMsg(const std::string &playerName, const std::string &msg);
|
||||
|
||||
void SignalNetClientGameStart(boost::shared_ptr<Game> game);
|
||||
|
||||
void SignalNetServerSuccess(int actionID);
|
||||
void SignalNetServerError(int errorID, int osErrorID);
|
||||
void SignalNetServerPlayerJoined(const std::string &playerName);
|
||||
void SignalNetServerPlayerLeft(const std::string &playerName);
|
||||
|
||||
private:
|
||||
|
||||
Log *myLog;
|
||||
Chat *myChat;
|
||||
mainWindowImpl *myW;
|
||||
ConfigFile *myConfig;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* 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 *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef GUIWRAPPER_H
|
||||
#define GUIWRAPPER_H
|
||||
|
||||
#include <guiinterface.h>
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
class Session;
|
||||
class mainWindowImpl;
|
||||
class Log;
|
||||
class Chat;
|
||||
class ConfigFile;
|
||||
|
||||
class GuiWrapper : public GuiInterface
|
||||
{
|
||||
public:
|
||||
GuiWrapper(ConfigFile*);
|
||||
|
||||
~GuiWrapper();
|
||||
|
||||
void initGui(int speed);
|
||||
|
||||
Session &getSession();
|
||||
void setSession(boost::shared_ptr<Session> session);
|
||||
|
||||
void refreshSet() const;
|
||||
void refreshCash() const;
|
||||
void refreshAction(int =-1, int =-1) const;
|
||||
void refreshChangePlayer() const;
|
||||
void refreshPot() const;
|
||||
void refreshGroupbox(int =-1, int =-1) const;
|
||||
void refreshAll() const;
|
||||
void refreshPlayerName() const;
|
||||
void refreshButton() const;
|
||||
|
||||
void dealHoleCards();
|
||||
void dealFlopCards();
|
||||
void dealTurnCard();
|
||||
void dealRiverCard();
|
||||
|
||||
void highlightRoundLabel(std::string round) const;
|
||||
|
||||
void nextPlayerAnimation();
|
||||
|
||||
void preflopAnimation1();
|
||||
void preflopAnimation2();
|
||||
|
||||
void flopAnimation1();
|
||||
void flopAnimation2();
|
||||
|
||||
void turnAnimation1();
|
||||
void turnAnimation2();
|
||||
|
||||
void riverAnimation1();
|
||||
void riverAnimation2();
|
||||
|
||||
void postRiverAnimation1();
|
||||
void postRiverRunAnimation1();
|
||||
|
||||
void flipHolecardsAllIn();
|
||||
|
||||
void nextRoundCleanGui();
|
||||
|
||||
void meInAction();
|
||||
|
||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||
void logNewGameHandMsg(int gameID, int handID) ;
|
||||
|
||||
void SignalNetClientConnect(int actionID);
|
||||
void SignalNetClientGameInfo(int actionID);
|
||||
void SignalNetClientError(int errorID, int osErrorID);
|
||||
void SignalNetClientPlayerJoined(const std::string &playerName);
|
||||
void SignalNetClientPlayerLeft(const std::string &playerName);
|
||||
void SignalNetClientChatMsg(const std::string &playerName, const std::string &msg);
|
||||
|
||||
void SignalNetClientGameStart(boost::shared_ptr<Game> game);
|
||||
|
||||
void SignalNetServerSuccess(int actionID);
|
||||
void SignalNetServerError(int errorID, int osErrorID);
|
||||
void SignalNetServerPlayerJoined(const std::string &playerName);
|
||||
void SignalNetServerPlayerLeft(const std::string &playerName);
|
||||
|
||||
private:
|
||||
|
||||
Log *myLog;
|
||||
Chat *myChat;
|
||||
mainWindowImpl *myW;
|
||||
ConfigFile *myConfig;
|
||||
|
||||
};
|
||||
|
||||
#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(signalRefreshAll()), this, SLOT(refreshAll()));
|
||||
connect(this, SIGNAL(signalRefreshPlayerName()), this, SLOT(refreshPlayerName()));
|
||||
connect(this, SIGNAL(signalRefreshButton()), this, SLOT(refreshButton()));
|
||||
|
||||
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
|
||||
int activePlayersCounter = 0;
|
||||
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) {
|
||||
@@ -2021,6 +2022,11 @@ void mainWindowImpl::postRiverRunAnimation6() {
|
||||
refreshCash();
|
||||
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
|
||||
int playersPositiveCashCounter = 0;
|
||||
for (i=0; i<mySession->getCurrentGame()->getStartQuantityPlayers(); i++) {
|
||||
|
||||
@@ -81,6 +81,7 @@ signals:
|
||||
void signalRefreshGroupbox(int =-1, int =-1);
|
||||
void signalRefreshAll();
|
||||
void signalRefreshPlayerName();
|
||||
void signalRefreshButton();
|
||||
|
||||
void signalMeInAction();
|
||||
|
||||
|
||||
@@ -540,7 +540,7 @@ ClientStateWaitHand::InternalProcess(ClientThread &client, boost::shared_ptr<Net
|
||||
client.GetGui().dealHoleCards();
|
||||
client.SetState(ClientStateRunHand::Instance());
|
||||
|
||||
retVal = MSG_NET_GAME_CLIENT_HAND;
|
||||
retVal = MSG_NET_GAME_CLIENT_HAND_START;
|
||||
}
|
||||
|
||||
return MSG_SOCK_INTERNAL_PENDING;
|
||||
@@ -566,6 +566,7 @@ ClientStateRunHand::~ClientStateRunHand()
|
||||
int
|
||||
ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetPacket> packet)
|
||||
{
|
||||
int retVal = MSG_SOCK_INTERNAL_PENDING;
|
||||
ClientContext &context = client.GetContext();
|
||||
|
||||
if (packet.get())
|
||||
@@ -601,6 +602,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
||||
client.GetGui().refreshSet();
|
||||
client.GetGui().refreshAction();
|
||||
client.GetGui().refreshCash();
|
||||
client.GetGui().refreshButton();
|
||||
}
|
||||
else if (packet->ToNetPacketPlayersTurn())
|
||||
{
|
||||
@@ -612,21 +614,21 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
||||
// Set round.
|
||||
if (curGame->getCurrentHand()->getActualRound() != turnData.gameState)
|
||||
{
|
||||
// Reset player actions
|
||||
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++)
|
||||
{
|
||||
int action = curGame->getPlayerArray()[i]->getMyAction();
|
||||
if (action != 1 && action != 6)
|
||||
curGame->getPlayerArray()[i]->setMyAction(0);
|
||||
}
|
||||
// Move sets to pot
|
||||
curGame->getCurrentHand()->getBoard()->collectSets();
|
||||
curGame->getCurrentHand()->getBoard()->collectPot();
|
||||
|
||||
client.GetGui().refreshPot();
|
||||
client.GetGui().refreshSet();
|
||||
client.GetGui().refreshAction();
|
||||
client.GetGui().refreshCash();
|
||||
// Reset player actions
|
||||
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++)
|
||||
{
|
||||
int action = curGame->getPlayerArray()[i]->getMyAction();
|
||||
if (action != 1 && action != 6)
|
||||
curGame->getPlayerArray()[i]->setMyAction(0);
|
||||
}
|
||||
// Move sets to pot
|
||||
curGame->getCurrentHand()->getBoard()->collectSets();
|
||||
curGame->getCurrentHand()->getBoard()->collectPot();
|
||||
|
||||
client.GetGui().refreshPot();
|
||||
client.GetGui().refreshSet();
|
||||
client.GetGui().refreshAction();
|
||||
client.GetGui().refreshCash();
|
||||
|
||||
curGame->getCurrentHand()->setActualRound(turnData.gameState);
|
||||
}
|
||||
@@ -650,9 +652,8 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
||||
NetPacketDealFlopCards::Data cardsData;
|
||||
packet->ToNetPacketDealFlopCards()->GetData(cardsData);
|
||||
int tmpCards[5];
|
||||
tmpCards[0] = static_cast<int>(cardsData.flopCards[0]);
|
||||
tmpCards[1] = static_cast<int>(cardsData.flopCards[1]);
|
||||
tmpCards[2] = static_cast<int>(cardsData.flopCards[2]);
|
||||
for (int num = 0; num < 3; num++)
|
||||
tmpCards[num] = static_cast<int>(cardsData.flopCards[num]);
|
||||
tmpCards[3] = tmpCards[4] = 0;
|
||||
curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards);
|
||||
client.GetGui().dealFlopCards();
|
||||
@@ -677,9 +678,63 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
||||
curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards);
|
||||
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_TURN_CARD 0x000C
|
||||
#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_CHAT_TEXT 0x0201
|
||||
@@ -194,6 +196,37 @@ struct GCC_PACKED NetPacketDealRiverCardData
|
||||
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
|
||||
{
|
||||
NetPacketHeader head;
|
||||
@@ -281,6 +314,12 @@ NetPacket::Create(char *data, unsigned &dataSize)
|
||||
case NET_TYPE_DEAL_RIVER_CARD:
|
||||
tmpPacket = boost::shared_ptr<NetPacket>(new NetPacketDealRiverCard);
|
||||
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:
|
||||
tmpPacket = boost::shared_ptr<NetPacket>(new NetPacketSendChatText);
|
||||
break;
|
||||
@@ -449,6 +488,18 @@ NetPacket::ToNetPacketDealRiverCard() const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const NetPacketEndOfHandShowCards *
|
||||
NetPacket::ToNetPacketEndOfHandShowCards() const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const NetPacketEndOfHandHideCards *
|
||||
NetPacket::ToNetPacketEndOfHandHideCards() const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const NetPacketSendChatText *
|
||||
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()
|
||||
: NetPacket(NET_TYPE_SEND_CHAT_TEXT, sizeof(NetPacketSendChatTextData))
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
using namespace std;
|
||||
|
||||
#define SERVER_WAIT_TIMEOUT_MSEC 50
|
||||
#define SERVER_NEXT_HAND_DELAY_SEC 5
|
||||
|
||||
|
||||
ServerRecvState::~ServerRecvState()
|
||||
@@ -319,6 +320,11 @@ ServerRecvStateStartHand::Process(ServerRecvThread &server)
|
||||
Game &curGame = server.GetGame();
|
||||
curGame.initHand();
|
||||
|
||||
// HACK: Skip GUI notification run
|
||||
curGame.getCurrentHand()->getFlop()->resetFirstRun();
|
||||
curGame.getCurrentHand()->getTurn()->resetFirstRun();
|
||||
curGame.getCurrentHand()->getRiver()->resetFirstRun();
|
||||
|
||||
PlayerInterface **playerArray = curGame.getPlayerArray();
|
||||
|
||||
// Send cards to all players.
|
||||
@@ -380,7 +386,7 @@ ServerRecvStateStartHand::Process(ServerRecvThread &server)
|
||||
|
||||
server.SetState(ServerRecvStateStartRound::Instance());
|
||||
|
||||
return MSG_NET_GAME_SERVER_HAND;
|
||||
return MSG_NET_GAME_SERVER_HAND_START;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -403,51 +409,142 @@ ServerRecvStateStartRound::~ServerRecvStateStartRound()
|
||||
int
|
||||
ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
||||
{
|
||||
int retVal = MSG_SOCK_INTERNAL_PENDING;
|
||||
Game &curGame = server.GetGame();
|
||||
|
||||
curGame.getCurrentHand()->switchRounds();
|
||||
|
||||
// Call main loop - if state changes, call again.
|
||||
int newRound = curGame.getCurrentHand()->getActualRound();
|
||||
int curRound;
|
||||
do
|
||||
{
|
||||
curRound = newRound;
|
||||
GameRun(curGame, curRound);
|
||||
curGame.getCurrentHand()->switchRounds();
|
||||
if (!curGame.getCurrentHand()->getAllInCondition())
|
||||
GameRun(curGame);
|
||||
newRound = curGame.getCurrentHand()->getActualRound();
|
||||
|
||||
// If round changes, deal cards if needed.
|
||||
if (newRound != curRound)
|
||||
{
|
||||
// HACK: Skip GUI notification run
|
||||
GameRun(curGame, newRound);
|
||||
SendNewRoundCards(server, curGame);
|
||||
assert(newRound > curRound);
|
||||
SendNewRoundCards(server, curGame, newRound);
|
||||
}
|
||||
} while (newRound != curRound);
|
||||
|
||||
// Retrieve current player.
|
||||
PlayerInterface *curPlayer = GetCurrentPlayer(curGame);
|
||||
assert(curPlayer); // TODO throw exception
|
||||
assert(curPlayer->getMyActiveStatus()); // TODO throw exception
|
||||
if (newRound != GAME_STATE_POST_RIVER) // continue hand
|
||||
{
|
||||
if (!curGame.getCurrentHand()->getAllInCondition())
|
||||
{
|
||||
// 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);
|
||||
NetPacketPlayersTurn::Data playersTurnData;
|
||||
playersTurnData.gameState = (GameState)curGame.getCurrentHand()->getActualRound();
|
||||
playersTurnData.playerId = curPlayer->getMyUniqueID();
|
||||
static_cast<NetPacketPlayersTurn *>(notification.get())->SetData(playersTurnData);
|
||||
boost::shared_ptr<NetPacket> notification(new NetPacketPlayersTurn);
|
||||
NetPacketPlayersTurn::Data playersTurnData;
|
||||
playersTurnData.gameState = (GameState)curGame.getCurrentHand()->getActualRound();
|
||||
playersTurnData.playerId = curPlayer->getMyUniqueID();
|
||||
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
|
||||
ServerRecvStateStartRound::GameRun(Game &curGame, int state)
|
||||
ServerRecvStateStartRound::GameRun(Game &curGame)
|
||||
{
|
||||
// TODO: no switch needed here if game states are polymorphic
|
||||
switch(state) {
|
||||
switch(curGame.getCurrentHand()->getActualRound()) {
|
||||
case GAME_STATE_PREFLOP: {
|
||||
// Preflop starten
|
||||
curGame.getCurrentHand()->getPreflop()->preflopRun();
|
||||
@@ -497,10 +594,10 @@ ServerRecvStateStartRound::GetCurrentPlayer(Game &curGame)
|
||||
}
|
||||
|
||||
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
|
||||
switch(curGame.getCurrentHand()->getActualRound()) {
|
||||
switch(state) {
|
||||
case GAME_STATE_PREFLOP: {
|
||||
// nothing to do
|
||||
} break;
|
||||
@@ -510,9 +607,8 @@ ServerRecvStateStartRound::SendNewRoundCards(ServerRecvThread &server, Game &cur
|
||||
curGame.getCurrentHand()->getBoard()->getMyCards(cards);
|
||||
boost::shared_ptr<NetPacket> notifyCards(new NetPacketDealFlopCards);
|
||||
NetPacketDealFlopCards::Data notifyCardsData;
|
||||
notifyCardsData.flopCards[0] = static_cast<u_int16_t>(cards[0]);
|
||||
notifyCardsData.flopCards[1] = static_cast<u_int16_t>(cards[1]);
|
||||
notifyCardsData.flopCards[2] = static_cast<u_int16_t>(cards[2]);
|
||||
for (int num = 0; num < 3; num++)
|
||||
notifyCardsData.flopCards[num] = static_cast<u_int16_t>(cards[num]);
|
||||
static_cast<NetPacketDealFlopCards *>(notifyCards.get())->SetData(notifyCardsData);
|
||||
server.SendToAllPlayers(notifyCards);
|
||||
} 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::Instance()
|
||||
{
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define MAX_NAME_SIZE 64
|
||||
#define MAX_PASSWORD_SIZE 64
|
||||
#define MAX_CHAT_TEXT_SIZE 128
|
||||
#define MAX_NUM_PLAYER_RESULTS MAX_NUMBER_OF_PLAYERS
|
||||
|
||||
|
||||
struct NetPacketHeader;
|
||||
@@ -51,6 +52,8 @@ class NetPacketPlayersActionRejected;
|
||||
class NetPacketDealFlopCards;
|
||||
class NetPacketDealTurnCard;
|
||||
class NetPacketDealRiverCard;
|
||||
class NetPacketEndOfHandShowCards;
|
||||
class NetPacketEndOfHandHideCards;
|
||||
class NetPacketSendChatText;
|
||||
class NetPacketChatText;
|
||||
class NetPacketError;
|
||||
@@ -85,6 +88,8 @@ public:
|
||||
virtual const NetPacketDealFlopCards *ToNetPacketDealFlopCards() const;
|
||||
virtual const NetPacketDealTurnCard *ToNetPacketDealTurnCard() const;
|
||||
virtual const NetPacketDealRiverCard *ToNetPacketDealRiverCard() const;
|
||||
virtual const NetPacketEndOfHandShowCards *ToNetPacketEndOfHandShowCards() const;
|
||||
virtual const NetPacketEndOfHandHideCards *ToNetPacketEndOfHandHideCards() const;
|
||||
virtual const NetPacketSendChatText *ToNetPacketSendChatText() const;
|
||||
virtual const NetPacketChatText *ToNetPacketChatText() const;
|
||||
virtual const NetPacketError *ToNetPacketError() const;
|
||||
@@ -423,6 +428,66 @@ protected:
|
||||
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
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -81,7 +81,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
unsigned m_curUniquePlayerId;
|
||||
u_int16_t m_curUniquePlayerId;
|
||||
};
|
||||
|
||||
// Abstract State: Game is running.
|
||||
@@ -151,9 +151,9 @@ protected:
|
||||
// Protected constructor - this is a singleton.
|
||||
ServerRecvStateStartRound();
|
||||
|
||||
static void GameRun(Game &curGame, int state);
|
||||
static void GameRun(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.
|
||||
@@ -178,6 +178,30 @@ protected:
|
||||
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.
|
||||
class ServerRecvStateFinal : public ServerRecvStateRunning
|
||||
|
||||
@@ -169,6 +169,7 @@ friend class ServerRecvStateStartGame;
|
||||
friend class ServerRecvStateStartHand;
|
||||
friend class ServerRecvStateStartRound;
|
||||
friend class ServerRecvStateWaitPlayerAction;
|
||||
friend class ServerRecvStateNextHand;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
#define ERR_NET_INVALID_PASSWORD_STR 105
|
||||
#define ERR_NET_PLAYER_NAME_IN_USE 106
|
||||
#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.
|
||||
#define MSG_SOCK_INTERNAL_PENDING 0
|
||||
@@ -65,9 +66,11 @@
|
||||
// The following messages are game messages.
|
||||
#define MSG_NET_GAME_CLIENT_START 5
|
||||
#define MSG_NET_GAME_SERVER_START 6
|
||||
#define MSG_NET_GAME_CLIENT_HAND 7
|
||||
#define MSG_NET_GAME_SERVER_HAND 8
|
||||
#define MSG_NET_GAME_SERVER_ROUND 10
|
||||
#define MSG_NET_GAME_CLIENT_HAND_START 7
|
||||
#define MSG_NET_GAME_CLIENT_HAND_END 8
|
||||
#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
|
||||
|
||||
#endif
|
||||
|
||||
@@ -194,3 +194,10 @@ void Session::sendChatMessage(const std::string &message) {
|
||||
return; // only act if client is running.
|
||||
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);
|
||||
|
||||
bool isNetworkClientRunning() const; // TODO hack
|
||||
|
||||
private:
|
||||
|
||||
int currentGameID;
|
||||
|
||||
Reference in New Issue
Block a user