Start position of dealer is now set via network. Added files for network client engine. Added factory code.
This commit is contained in:
@@ -111,7 +111,7 @@ Server Notification: Game Start
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Message Type = 5 | Message Length = 8 |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Reserved |
|
||||
| Start Dealer Pos | Reserved |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
|
||||
+18
@@ -10,6 +10,7 @@ INCLUDEPATH += . \
|
||||
src/gui \
|
||||
src/net \
|
||||
src/engine/local_engine \
|
||||
src/engine/network_engine \
|
||||
src/config \
|
||||
src/core/tinyxml \
|
||||
src/gui/qt \
|
||||
@@ -38,6 +39,7 @@ DEPENDPATH += . \
|
||||
src/core/common \
|
||||
src/core/tinyxml \
|
||||
src/engine/local_engine \
|
||||
src/engine/network_engine \
|
||||
src/gui/qt \
|
||||
src/net/common \
|
||||
src/gui/qt/mainwindow \
|
||||
@@ -95,6 +97,14 @@ HEADERS += src/game.h \
|
||||
src/engine/local_engine/localriver.h \
|
||||
src/engine/local_engine/localturn.h \
|
||||
src/engine/local_engine/tools.h \
|
||||
src/engine/network_engine/clientboard.h \
|
||||
src/engine/network_engine/clientenginefactory.h \
|
||||
src/engine/network_engine/clientflop.h \
|
||||
src/engine/network_engine/clienthand.h \
|
||||
src/engine/network_engine/clientplayer.h \
|
||||
src/engine/network_engine/clientpreflop.h \
|
||||
src/engine/network_engine/clientriver.h \
|
||||
src/engine/network_engine/clientturn.h \
|
||||
src/gui/qt/mainwindow/mainwindowimpl.h \
|
||||
src/gui/qt/mainwindow/mycardspixmaplabel.h \
|
||||
src/gui/qt/mainwindow/startsplash/startsplash.h \
|
||||
@@ -150,6 +160,14 @@ SOURCES += src/game.cpp \
|
||||
src/engine/local_engine/localriver.cpp \
|
||||
src/engine/local_engine/localturn.cpp \
|
||||
src/engine/local_engine/tools.cpp \
|
||||
src/engine/network_engine/clientboard.cpp \
|
||||
src/engine/network_engine/clientenginefactory.cpp \
|
||||
src/engine/network_engine/clientflop.cpp \
|
||||
src/engine/network_engine/clienthand.cpp \
|
||||
src/engine/network_engine/clientplayer.cpp \
|
||||
src/engine/network_engine/clientpreflop.cpp \
|
||||
src/engine/network_engine/clientriver.cpp \
|
||||
src/engine/network_engine/clientturn.cpp \
|
||||
src/net/common/connectdata.cpp \
|
||||
src/net/common/clientcallback.cpp \
|
||||
src/net/common/clientcontext.cpp \
|
||||
|
||||
@@ -28,13 +28,15 @@
|
||||
#include "turninterface.h"
|
||||
#include "riverinterface.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
class EngineFactory{
|
||||
public:
|
||||
|
||||
virtual ~EngineFactory();
|
||||
|
||||
virtual HandInterface* createHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) =0;
|
||||
virtual HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) =0;
|
||||
virtual BoardInterface* createBoard() =0;
|
||||
virtual PlayerInterface* createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) =0;
|
||||
virtual PreflopInterface* createPreflop(HandInterface* hi, int id, int aP, int dP, int sB) =0;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
***************************************************************************/
|
||||
#include "localboard.h"
|
||||
|
||||
#include "localhand.h"
|
||||
#include "handinterface.h"
|
||||
#include <game_defs.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -41,7 +41,7 @@ LocalEngineFactory::~LocalEngineFactory()
|
||||
}
|
||||
|
||||
|
||||
HandInterface* LocalEngineFactory::createHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) { return new LocalHand(f, g, b, p, id, sP, aP, dP, sB, sC); }
|
||||
HandInterface* LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) { return new LocalHand(f, g, b, p, id, sP, aP, dP, sB, sC); }
|
||||
|
||||
BoardInterface* LocalEngineFactory::createBoard() { return new LocalBoard; }
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
LocalEngineFactory(ConfigFile*);
|
||||
~LocalEngineFactory();
|
||||
|
||||
HandInterface* createHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC);
|
||||
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC);
|
||||
BoardInterface* createBoard();
|
||||
PlayerInterface* createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
PreflopInterface* createPreflop(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) : HandInterface(), myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(0), bettingRoundsPlayed(0)
|
||||
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
|
||||
: HandInterface(), myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(0), bettingRoundsPlayed(0)
|
||||
{
|
||||
|
||||
int i, j, k;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
class LocalHand : public HandInterface{
|
||||
public:
|
||||
LocalHand(EngineFactory*, GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int, int);
|
||||
LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int, int);
|
||||
~LocalHand();
|
||||
|
||||
void start();
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
EngineFactory *myFactory;
|
||||
boost::shared_ptr<EngineFactory> myFactory;
|
||||
GuiInterface *myGui;
|
||||
BoardInterface *myBoard;
|
||||
PlayerInterface **playerArray;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "localplayer.h"
|
||||
#include "localhand.h"
|
||||
#include "handinterface.h"
|
||||
#include "tools.h"
|
||||
#include "cardsvalue.h"
|
||||
#include <configfile.h>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 "clientboard.h"
|
||||
|
||||
#include "localhand.h"
|
||||
#include <game_defs.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ClientBoard::ClientBoard()
|
||||
: playerArray(0), actualHand(0), pot(0), sets(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ClientBoard::~ClientBoard()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientBoard::setPlayer(PlayerInterface** p)
|
||||
{
|
||||
playerArray = p;
|
||||
}
|
||||
|
||||
void
|
||||
ClientBoard::setHand(HandInterface* br)
|
||||
{
|
||||
actualHand = br;
|
||||
}
|
||||
|
||||
void
|
||||
ClientBoard::collectSets()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientBoard::collectPot()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 CLIENTBOARD_H
|
||||
#define CLIENTBOARD_H
|
||||
|
||||
#include <boardinterface.h>
|
||||
|
||||
class PlayerInterface;
|
||||
class HandInterface;
|
||||
|
||||
|
||||
class ClientBoard : public BoardInterface{
|
||||
public:
|
||||
ClientBoard();
|
||||
~ClientBoard();
|
||||
|
||||
void setPlayer(PlayerInterface**);
|
||||
void setHand(HandInterface*);
|
||||
|
||||
void setMyCards(int* theValue) { int i; for(i=0; i<5; i++) myCards[i] = theValue[i]; }
|
||||
void getMyCards(int* theValue) { int i; for(i=0; i<5; i++) theValue[i] = myCards[i]; }
|
||||
|
||||
int getPot() const { return pot;}
|
||||
void setPot(int theValue) { pot = theValue;}
|
||||
int getSets() const { return sets; }
|
||||
|
||||
void collectSets();
|
||||
void collectPot();
|
||||
|
||||
private:
|
||||
PlayerInterface **playerArray;
|
||||
HandInterface *actualHand;
|
||||
|
||||
int myCards[5];
|
||||
int pot;
|
||||
int sets;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,77 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 "clientenginefactory.h"
|
||||
|
||||
#include "clienthand.h"
|
||||
#include "clientboard.h"
|
||||
#include "clientplayer.h"
|
||||
#include "clientpreflop.h"
|
||||
#include "clientflop.h"
|
||||
#include "clientturn.h"
|
||||
#include "clientriver.h"
|
||||
|
||||
#include <configfile.h>
|
||||
|
||||
|
||||
ClientEngineFactory::ClientEngineFactory(ConfigFile *c)
|
||||
: myConfig(c)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ClientEngineFactory::~ClientEngineFactory()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
|
||||
{
|
||||
return new ClientHand(f, g, b, p, id, sP, aP, dP, sB, sC);
|
||||
}
|
||||
|
||||
BoardInterface* ClientEngineFactory::createBoard()
|
||||
{
|
||||
return new ClientBoard;
|
||||
}
|
||||
|
||||
PlayerInterface* ClientEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
|
||||
{
|
||||
return new ClientPlayer(myConfig, b, id, uniqueId, type, name, avatar, sC, aS, mB);
|
||||
}
|
||||
|
||||
PreflopInterface* ClientEngineFactory::createPreflop(HandInterface* hi, int id, int aP, int dP, int sB)
|
||||
{
|
||||
return new ClientPreflop(hi, id, aP, dP, sB);
|
||||
}
|
||||
|
||||
FlopInterface* ClientEngineFactory::createFlop(HandInterface* hi, int id, int aP, int dP, int sB)
|
||||
{
|
||||
return new ClientFlop(hi, id, aP, dP, sB);
|
||||
}
|
||||
|
||||
TurnInterface* ClientEngineFactory::createTurn(HandInterface* hi, int id, int aP, int dP, int sB)
|
||||
{
|
||||
return new ClientTurn(hi, id, aP, dP, sB);
|
||||
}
|
||||
|
||||
RiverInterface* ClientEngineFactory::createRiver(HandInterface* hi, int id, int aP, int dP, int sB)
|
||||
{
|
||||
return new ClientRiver(hi, id, aP, dP, sB);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 CLIENTENGINEFACTORY_H
|
||||
#define CLIENTENGINEFACTORY_H
|
||||
|
||||
#include <enginefactory.h>
|
||||
|
||||
#include <handinterface.h>
|
||||
#include <boardinterface.h>
|
||||
#include <playerinterface.h>
|
||||
#include <preflopinterface.h>
|
||||
#include <flopinterface.h>
|
||||
#include <turninterface.h>
|
||||
#include <riverinterface.h>
|
||||
|
||||
class ConfigFile;
|
||||
|
||||
class ClientEngineFactory : public EngineFactory
|
||||
{
|
||||
public:
|
||||
ClientEngineFactory(ConfigFile*);
|
||||
~ClientEngineFactory();
|
||||
|
||||
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC);
|
||||
BoardInterface* createBoard();
|
||||
PlayerInterface* createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
PreflopInterface* createPreflop(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
FlopInterface* createFlop(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
TurnInterface* createTurn(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
RiverInterface* createRiver(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
|
||||
private:
|
||||
ConfigFile *myConfig;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,45 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 "clientflop.h"
|
||||
#include <game_defs.h>
|
||||
#include <handinterface.h>
|
||||
|
||||
//using namespace std;
|
||||
|
||||
ClientFlop::ClientFlop(HandInterface* bR, int id, int qP, int dP, int sB)
|
||||
: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstFlopRun(1), firstFlopRound(1), playersTurn(dP)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ClientFlop::~ClientFlop()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientFlop::flopRun()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientFlop::nextPlayer2()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 CLIENTFLOP_H
|
||||
#define CLIENTFLOP_H
|
||||
|
||||
#include "flopinterface.h"
|
||||
|
||||
class HandInterface;
|
||||
|
||||
class ClientFlop : public FlopInterface{
|
||||
public:
|
||||
ClientFlop(HandInterface*, int, int, int, int);
|
||||
~ClientFlop();
|
||||
|
||||
|
||||
void setPlayersTurn(const int& theValue) { playersTurn = theValue; }
|
||||
int getPlayersTurn() const { return playersTurn; }
|
||||
|
||||
void setHighestSet(const int& theValue) { highestSet = theValue; }
|
||||
int getHighestSet() const { return highestSet;}
|
||||
|
||||
void setFirstFlopRound(bool theValue) { firstFlopRound = theValue;}
|
||||
bool getFirstFlopRound() const { return firstFlopRound;}
|
||||
|
||||
void setSmallBlindPosition(const int& theValue) { smallBlindPosition = theValue;}
|
||||
int getSmallBlindPosition() const { return smallBlindPosition; }
|
||||
|
||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void flopRun();
|
||||
void nextPlayer2();
|
||||
|
||||
private:
|
||||
|
||||
HandInterface *myHand;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int dealerPosition;
|
||||
int smallBlindPosition;
|
||||
|
||||
int smallBlind;
|
||||
int highestSet;
|
||||
|
||||
bool firstFlopRun;
|
||||
bool firstFlopRound;
|
||||
int playersTurn;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,54 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 "clienthand.h"
|
||||
#include <game_defs.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
|
||||
: myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(0), bettingRoundsPlayed(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
ClientHand::~ClientHand()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientHand::start()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientHand::assignButtons()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientHand::switchRounds()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientHand::highlightRoundLabel()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 CLIENTHAND_H
|
||||
#define CLIENTHAND_H
|
||||
|
||||
#include <enginefactory.h>
|
||||
#include <guiinterface.h>
|
||||
#include <boardinterface.h>
|
||||
#include <playerinterface.h>
|
||||
#include <handinterface.h>
|
||||
#include <preflopinterface.h>
|
||||
#include <flopinterface.h>
|
||||
#include <turninterface.h>
|
||||
#include <riverinterface.h>
|
||||
|
||||
|
||||
class ClientHand : public HandInterface{
|
||||
public:
|
||||
ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int, int);
|
||||
~ClientHand();
|
||||
|
||||
void start();
|
||||
|
||||
PlayerInterface** getPlayerArray() const { return playerArray; }
|
||||
BoardInterface* getBoard() const { return myBoard; }
|
||||
PreflopInterface* getPreflop() const { return myPreflop; }
|
||||
FlopInterface* getFlop() const { return myFlop; }
|
||||
TurnInterface* getTurn() const { return myTurn; }
|
||||
RiverInterface* getRiver() const { return myRiver; }
|
||||
GuiInterface* getGuiInterface() const { return myGui; }
|
||||
|
||||
void setMyID(const int& theValue) { myID = theValue; }
|
||||
int getMyID() const { return myID; }
|
||||
|
||||
void setActualQuantityPlayers(const int& theValue) { actualQuantityPlayers = theValue; }
|
||||
int getActualQuantityPlayers() const { return actualQuantityPlayers; }
|
||||
|
||||
void setStartQuantityPlayers(const int& theValue) { startQuantityPlayers = theValue; }
|
||||
int getStartQuantityPlayers() const { return startQuantityPlayers; }
|
||||
|
||||
void setActualRound(const int& theValue) { actualRound = theValue; }
|
||||
int getActualRound() const { return actualRound; }
|
||||
|
||||
void setDealerPosition(const int& theValue) { dealerPosition = theValue; }
|
||||
int getDealerPosition() const { return dealerPosition; }
|
||||
|
||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void setAllInCondition(bool theValue) { allInCondition = theValue; }
|
||||
bool getAllInCondition() const { return allInCondition; }
|
||||
|
||||
void setStartCash(const int& theValue) { startCash = theValue; }
|
||||
int getStartCash() const { return startCash; }
|
||||
|
||||
void setActivePlayersCounter(const int& theValue) { activePlayersCounter = theValue; }
|
||||
int getActivePlayersCounter() const { return activePlayersCounter; }
|
||||
|
||||
void setBettingRoundsPlayed(const int& theValue) { bettingRoundsPlayed = theValue; }
|
||||
int getBettingRoundsPlayed() const { return bettingRoundsPlayed; }
|
||||
|
||||
void setLastPlayersTurn(const int& theValue) { lastPlayersTurn = theValue; }
|
||||
int getLastPlayersTurn() const { return lastPlayersTurn; }
|
||||
|
||||
|
||||
void assignButtons();
|
||||
|
||||
void highlightRoundLabel();
|
||||
void switchRounds();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
boost::shared_ptr<EngineFactory> myFactory;
|
||||
GuiInterface *myGui;
|
||||
BoardInterface *myBoard;
|
||||
PlayerInterface **playerArray;
|
||||
PreflopInterface *myPreflop;
|
||||
FlopInterface *myFlop;
|
||||
TurnInterface *myTurn;
|
||||
RiverInterface *myRiver;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int startQuantityPlayers;
|
||||
int dealerPosition; // -1 -> neutral
|
||||
int actualRound; //0 = preflop, 1 = flop, 2 = turn, 3 = river
|
||||
int smallBlind;
|
||||
int startCash;
|
||||
int activePlayersCounter;
|
||||
|
||||
int lastPlayersTurn;
|
||||
|
||||
bool allInCondition;
|
||||
|
||||
// hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ...
|
||||
int bettingRoundsPlayed;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 "clientplayer.h"
|
||||
#include "handinterface.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
ClientPlayer::ClientPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
|
||||
: PlayerInterface(), myConfig(c), actualHand(0), actualBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), sBluff(0), sBluffStatus(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ClientPlayer::~ClientPlayer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClientPlayer::setHand(HandInterface* br)
|
||||
{
|
||||
actualHand = br;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClientPlayer::action()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClientPlayer::preflopEngine()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClientPlayer::flopEngine()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClientPlayer::turnEngine()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClientPlayer::riverEngine()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClientPlayer::evaluation(int bet, int raise)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ClientPlayer::preflopCardsValue(int* cards)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ClientPlayer::flopCardsValue(int* cards)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClientPlayer::readFile()
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
ClientPlayer::turnCardsValue(int* cards)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ClientPlayer::preflopEngine3()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientPlayer::flopEngine3()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientPlayer::turnEngine3()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientPlayer::riverEngine3()
|
||||
{
|
||||
}
|
||||
|
||||
void ClientPlayer::setNetSessionData(boost::shared_ptr<SessionData> session)
|
||||
{
|
||||
myNetSessionData = session;
|
||||
}
|
||||
|
||||
boost::shared_ptr<SessionData> ClientPlayer::getNetSessionData()
|
||||
{
|
||||
return myNetSessionData;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 CLIENTPLAYER_H
|
||||
#define CLIENTPLAYER_H
|
||||
|
||||
#include <playerinterface.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <string>
|
||||
|
||||
|
||||
class CardsValue;
|
||||
class ConfigFile;
|
||||
class HandInterface;
|
||||
class BoardInterface;
|
||||
|
||||
class ClientPlayer : public PlayerInterface{
|
||||
public:
|
||||
ClientPlayer(ConfigFile*, BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
~ClientPlayer();
|
||||
|
||||
void setHand(HandInterface*);
|
||||
|
||||
int getMyID() const { return myID; }
|
||||
unsigned getMyUniqueID() const { return myUniqueID; }
|
||||
PlayerType getMyType() const { return myType; }
|
||||
|
||||
void setMyDude(const int& theValue) { myDude = theValue; }
|
||||
int getMyDude() const { return myDude; }
|
||||
|
||||
void setMyDude4(const int& theValue) { myDude4 = theValue; }
|
||||
int getMyDude4() const { return myDude4; }
|
||||
|
||||
void setMyName(const std::string& theValue) { myName = theValue; }
|
||||
std::string getMyName() const { return myName; }
|
||||
|
||||
void setMyAvatar(const std::string& theValue) { myAvatar = theValue; }
|
||||
std::string getMyAvatar() const { return myAvatar; }
|
||||
|
||||
void setMyCash(const int& theValue) { myCash = theValue; }
|
||||
int getMyCash() const { return myCash; }
|
||||
|
||||
void setMySet(const int& theValue) { mySet += theValue; myCash -= theValue; }
|
||||
void setMySetNull() { mySet = 0; }
|
||||
int getMySet() const { return mySet;}
|
||||
|
||||
void setMyAction(const int& theValue) { myAction = theValue; }
|
||||
int getMyAction() const { return myAction; }
|
||||
|
||||
void setMyButton(const int& theValue) { myButton = theValue; }
|
||||
int getMyButton() const { return myButton; }
|
||||
|
||||
void setMyActiveStatus(bool theValue) { myActiveStatus = theValue; }
|
||||
bool getMyActiveStatus() const { return myActiveStatus; }
|
||||
|
||||
void setMyCards(int* theValue) { int i; for(i=0; i<2; i++) myCards[i] = theValue[i]; }
|
||||
void getMyCards(int* theValue) { int i; for(i=0; i<2; i++) theValue[i] = myCards[i]; }
|
||||
|
||||
void setMyTurn(bool theValue){ myTurn = theValue;}
|
||||
bool getMyTurn() const{ return myTurn;}
|
||||
|
||||
void setMyCardsFlip(bool theValue){ myCardsFlip = theValue;}
|
||||
bool getMyCardsFlip() const{ return myCardsFlip;}
|
||||
|
||||
void setMyCardsValueInt(const int& theValue) { myCardsValueInt = theValue;}
|
||||
int getMyCardsValueInt() const { return myCardsValueInt; }
|
||||
|
||||
int* getMyBestHandPosition() { return myBestHandPosition; }
|
||||
|
||||
void setMyRoundStartCash(const int& theValue) { myRoundStartCash = theValue;}
|
||||
int getMyRoundStartCash() const { return myRoundStartCash; }
|
||||
|
||||
void setMyAverageSets(const int& theValue) { myAverageSets[0] = myAverageSets[1]; myAverageSets[1] = myAverageSets[2]; myAverageSets[2] = myAverageSets[3]; myAverageSets[3] = theValue; }
|
||||
int getMyAverageSets() const { return (myAverageSets[0]+myAverageSets[1]+myAverageSets[2]+myAverageSets[3])/4; }
|
||||
|
||||
void setMyAggressive(const bool& theValue) {
|
||||
int i;
|
||||
for(i=0; i<6; i++) {
|
||||
myAggressive[i] = myAggressive[i+1];
|
||||
}
|
||||
myAggressive[6] = theValue;
|
||||
}
|
||||
int getMyAggressive() const {
|
||||
int i, sum = 0;
|
||||
for(i=0; i<7; i++) {
|
||||
sum += myAggressive[i];
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
void setSBluff ( int theValue ) { sBluff = theValue; }
|
||||
int getSBluff() const { return sBluff; }
|
||||
|
||||
void setSBluffStatus ( bool theValue ) { sBluffStatus = theValue; }
|
||||
bool getSBluffStatus() const { return sBluffStatus; }
|
||||
|
||||
void action();
|
||||
|
||||
void preflopEngine();
|
||||
void flopEngine();
|
||||
void turnEngine();
|
||||
void riverEngine();
|
||||
|
||||
void preflopEngine3();
|
||||
void flopEngine3();
|
||||
void turnEngine3();
|
||||
void riverEngine3();
|
||||
|
||||
int preflopCardsValue(int*);
|
||||
int flopCardsValue(int*);
|
||||
int turnCardsValue(int*);
|
||||
|
||||
void readFile();
|
||||
|
||||
void evaluation(int, int);
|
||||
|
||||
void setNetSessionData(boost::shared_ptr<SessionData> session);
|
||||
boost::shared_ptr<SessionData> getNetSessionData();
|
||||
|
||||
private:
|
||||
|
||||
ConfigFile *myConfig;
|
||||
HandInterface *actualHand;
|
||||
BoardInterface *actualBoard;
|
||||
|
||||
CardsValue *myCardsValue;
|
||||
|
||||
// Konstanten
|
||||
int myID;
|
||||
unsigned myUniqueID;
|
||||
PlayerType myType;
|
||||
std::string myName;
|
||||
std::string myAvatar;
|
||||
int myDude;
|
||||
int myDude4;
|
||||
|
||||
|
||||
// Laufvariablen
|
||||
int myCardsValueInt;
|
||||
int myBestHandPosition[5];
|
||||
double myOdds;
|
||||
int myNiveau[3];
|
||||
|
||||
int myCards[2];
|
||||
int myCash;
|
||||
int mySet;
|
||||
int myAction; // 0 = none, 1 = fold, 2 = check, 3 = call, 4 = bet, 5 = raise, 6 = allin
|
||||
int myButton; // 0 = none, 1 = dealer, 2 =small, 3 = big
|
||||
bool myActiveStatus; // 0 = inactive, 1 = active
|
||||
bool myTurn; // 0 = no, 1 = yes
|
||||
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
|
||||
int myRoundStartCash;
|
||||
|
||||
int myAverageSets[4];
|
||||
bool myAggressive[7];
|
||||
|
||||
int sBluff;
|
||||
bool sBluffStatus;
|
||||
|
||||
boost::shared_ptr<SessionData> myNetSessionData;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,45 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 "clientpreflop.h"
|
||||
|
||||
#include <handinterface.h>
|
||||
#include <game_defs.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ClientPreflop::ClientPreflop(HandInterface* bR, int id, int qP, int dP, int sB)
|
||||
: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), bigBlindPosition(0), smallBlind(sB), highestSet(2*sB), preflopFirstRound(1), playersTurn(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
ClientPreflop::~ClientPreflop()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientPreflop::preflopRun()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientPreflop::nextPlayer2()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 CLIENTPREFLOP_H
|
||||
#define CLIENTPREFLOP_H
|
||||
|
||||
#include <preflopinterface.h>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
class ClientPreflop : public PreflopInterface{
|
||||
|
||||
public:
|
||||
ClientPreflop(HandInterface*, int, int, int, int);
|
||||
~ClientPreflop();
|
||||
|
||||
|
||||
void setPlayersTurn(const int& theValue) { playersTurn = theValue; }
|
||||
int getPlayersTurn() const { return playersTurn; }
|
||||
|
||||
void setHighestSet(const int& theValue) { highestSet = theValue; }
|
||||
int getHighestSet() const { return highestSet;}
|
||||
|
||||
void setPreflopFirstRound(bool theValue) { preflopFirstRound = theValue; }
|
||||
bool setPreflopFirstRound() const { return preflopFirstRound; }
|
||||
|
||||
void preflopRun();
|
||||
void nextPlayer2();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
HandInterface *myHand;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int dealerPosition;
|
||||
int bigBlindPosition;
|
||||
|
||||
int smallBlind;
|
||||
int highestSet;
|
||||
|
||||
bool preflopFirstRound;
|
||||
int playersTurn;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,53 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 "clientriver.h"
|
||||
#include <game_defs.h>
|
||||
|
||||
|
||||
//using namespace std;
|
||||
|
||||
ClientRiver::ClientRiver(HandInterface* bR, int id, int qP, int dP, int sB)
|
||||
: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), playersTurn(dP), highestCardsValue(0)
|
||||
{
|
||||
}
|
||||
|
||||
ClientRiver::~ClientRiver()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClientRiver::riverRun()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientRiver::postRiverRun()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientRiver::nextPlayer2()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientRiver::distributePot()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 CLIENTRIVER_H
|
||||
#define CLIENTRIVER_H
|
||||
|
||||
#include <riverinterface.h>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
|
||||
class ClientRiver : public RiverInterface{
|
||||
public:
|
||||
ClientRiver(HandInterface*, int, int, int, int);
|
||||
~ClientRiver();
|
||||
|
||||
void setPlayersTurn(const int& theValue) { playersTurn = theValue; }
|
||||
int getPlayersTurn() const { return playersTurn; }
|
||||
|
||||
void setHighestSet(const int& theValue) { highestSet = theValue; }
|
||||
int getHighestSet() const { return highestSet;}
|
||||
|
||||
void setFirstRiverRound(bool theValue) { firstRiverRound = theValue;}
|
||||
bool getFirstRiverRound() const { return firstRiverRound;}
|
||||
|
||||
void setSmallBlindPosition(const int& theValue) { smallBlindPosition = theValue;}
|
||||
int getSmallBlindPosition() const { return smallBlindPosition; }
|
||||
|
||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void setHighestCardsValue(const int& theValue) { highestCardsValue = theValue;}
|
||||
int getHighestCardsValue() const { return highestCardsValue;}
|
||||
|
||||
void riverRun();
|
||||
void postRiverRun();
|
||||
void nextPlayer2();
|
||||
void distributePot();
|
||||
|
||||
private:
|
||||
|
||||
HandInterface *myHand;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int dealerPosition;
|
||||
int smallBlindPosition;
|
||||
|
||||
int smallBlind;
|
||||
int highestSet;
|
||||
|
||||
bool firstRiverRun;
|
||||
bool firstRiverRound;
|
||||
int playersTurn;
|
||||
|
||||
int highestCardsValue;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 "clientturn.h"
|
||||
#include <game_defs.h>
|
||||
#include <handinterface.h>
|
||||
|
||||
//using namespace std;
|
||||
|
||||
ClientTurn::ClientTurn(HandInterface* bR, int id, int qP, int dP, int sB)
|
||||
: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstTurnRun(1), firstTurnRound(1), playersTurn(dP)
|
||||
{
|
||||
}
|
||||
|
||||
ClientTurn::~ClientTurn()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientTurn::turnRun()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ClientTurn::nextPlayer2()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* *
|
||||
* 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 CLIENTTURN_H
|
||||
#define CLIENTTURN_H
|
||||
|
||||
#include <turninterface.h>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
class ClientTurn : public TurnInterface{
|
||||
public:
|
||||
ClientTurn(HandInterface*, int, int, int, int);
|
||||
~ClientTurn();
|
||||
|
||||
void setPlayersTurn(const int& theValue) { playersTurn = theValue; }
|
||||
int getPlayersTurn() const { return playersTurn; }
|
||||
|
||||
void setHighestSet(const int& theValue) { highestSet = theValue; }
|
||||
int getHighestSet() const { return highestSet;}
|
||||
|
||||
void setFirstTurnRound(bool theValue) { firstTurnRound = theValue;}
|
||||
bool getFirstTurnRound() const { return firstTurnRound;}
|
||||
|
||||
void setSmallBlindPosition(const int& theValue) { smallBlindPosition = theValue;}
|
||||
int getSmallBlindPosition() const { return smallBlindPosition; }
|
||||
|
||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void turnRun();
|
||||
void nextPlayer2();
|
||||
|
||||
private:
|
||||
|
||||
HandInterface *myHand;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int dealerPosition;
|
||||
int smallBlindPosition;
|
||||
|
||||
int smallBlind;
|
||||
int highestSet;
|
||||
|
||||
bool firstTurnRun;
|
||||
bool firstTurnRound;
|
||||
int playersTurn;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
+9
-12
@@ -20,18 +20,22 @@
|
||||
#include "game.h"
|
||||
#include "gamedata.h"
|
||||
|
||||
#include <localenginefactory.h>
|
||||
#include <enginefactory.h>
|
||||
#include <guiinterface.h>
|
||||
#include <tools.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
Game::Game(GuiInterface* gui, const PlayerDataList &playerDataList, const GameData &gameData, int gameId, ConfigFile *c)
|
||||
: myGui(gui), actualHand(0), actualBoard(0), startQuantityPlayers(gameData.numberOfPlayers),
|
||||
Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
const PlayerDataList &playerDataList, const GameData &gameData, int gameId)
|
||||
: myGui(gui), myFactory(factory), actualHand(0), actualBoard(0),
|
||||
startQuantityPlayers(gameData.numberOfPlayers),
|
||||
startCash(gameData.startCash), startSmallBlind(gameData.smallBlind),
|
||||
startHandsBeforeRaiseSmallBlind(gameData.handsBeforeRaise),
|
||||
myGameID(gameId), actualQuantityPlayers(gameData.numberOfPlayers),
|
||||
actualSmallBlind(gameData.smallBlind), actualHandID(0), dealerPosition(0), myConfig(c)
|
||||
actualSmallBlind(gameData.smallBlind), actualHandID(0), dealerPosition(gameData.startDealerPos)
|
||||
{
|
||||
// cout << "Create Game Object" << "\n";
|
||||
int i;
|
||||
@@ -42,18 +46,11 @@ Game::Game(GuiInterface* gui, const PlayerDataList &playerDataList, const GameDa
|
||||
playerArray[i] = 0;
|
||||
}
|
||||
|
||||
//EngineFactory erstellen
|
||||
myFactory = new LocalEngineFactory(myConfig); // LocalEngine erstellen
|
||||
|
||||
|
||||
// Board erstellen
|
||||
actualBoard = myFactory->createBoard();
|
||||
|
||||
|
||||
// ersten Dealer bestimmen
|
||||
Tools myTool;
|
||||
myTool.getRandNumber(0, startQuantityPlayers-1, 1, &dealerPosition, 0);
|
||||
|
||||
// Player erstellen
|
||||
PlayerDataList::const_iterator player_i = playerDataList.begin();
|
||||
PlayerDataList::const_iterator player_end = playerDataList.end();
|
||||
|
||||
+6
-10
@@ -20,14 +20,13 @@
|
||||
#ifndef GAME_H
|
||||
#define GAME_H
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include "game_defs.h"
|
||||
#include "playerdata.h"
|
||||
#include "configfile.h"
|
||||
|
||||
#include <string>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
class GuiInterface;
|
||||
class HandInterface;
|
||||
class PlayerInterface;
|
||||
@@ -38,7 +37,7 @@ struct GameData;
|
||||
class Game {
|
||||
|
||||
public:
|
||||
Game(GuiInterface *gui, const PlayerDataList &playerDataList, const GameData &gameData, int gameId, ConfigFile*);
|
||||
Game(GuiInterface *gui, boost::shared_ptr<EngineFactory> factory, const PlayerDataList &playerDataList, const GameData &gameData, int gameId);
|
||||
|
||||
~Game();
|
||||
|
||||
@@ -59,9 +58,8 @@ public:
|
||||
void setStartCash(const int& theValue) { startCash = theValue; }
|
||||
int getStartCash() const { return startCash; }
|
||||
|
||||
void setDealerPosition(const int& theValue) { dealerPosition = theValue; }
|
||||
int getDealerPosition() const { return dealerPosition; }
|
||||
|
||||
|
||||
void setMyGameID(const int& theValue) { myGameID = theValue;}
|
||||
int getMyGameID() const { return myGameID; }
|
||||
|
||||
@@ -79,7 +77,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
EngineFactory *myFactory;
|
||||
boost::shared_ptr<EngineFactory> myFactory;
|
||||
|
||||
GuiInterface *myGui;
|
||||
HandInterface *actualHand;
|
||||
@@ -98,8 +96,6 @@ private:
|
||||
int actualSmallBlind;
|
||||
int actualHandID;
|
||||
int dealerPosition;
|
||||
|
||||
ConfigFile *myConfig;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+3
-1
@@ -25,12 +25,14 @@
|
||||
|
||||
struct GameData
|
||||
{
|
||||
GameData() : numberOfPlayers(0), startCash(0), smallBlind(0), handsBeforeRaise(1) {}
|
||||
GameData() : numberOfPlayers(0), startCash(0), smallBlind(0),
|
||||
handsBeforeRaise(1), guiSpeed(4), startDealerPos(0) {}
|
||||
int numberOfPlayers;
|
||||
int startCash;
|
||||
int smallBlind;
|
||||
int handsBeforeRaise;
|
||||
int guiSpeed;
|
||||
int startDealerPos;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -95,7 +95,7 @@ void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->SignalNetClientGam
|
||||
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(const GameData &gameData) { myW->SignalNetClientGameStart(gameData.numberOfPlayers, gameData.startCash, gameData.smallBlind, gameData.handsBeforeRaise); }
|
||||
void GuiWrapper::SignalNetClientGameStart(const GameData &gameData) { myW->SignalNetClientGameStart(); }
|
||||
|
||||
void GuiWrapper::SignalNetServerSuccess(int actionID) { }
|
||||
void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { }
|
||||
|
||||
@@ -37,9 +37,11 @@
|
||||
#include "handinterface.h"
|
||||
#include "game.h"
|
||||
#include "session.h"
|
||||
#include "tools.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "configfile.h"
|
||||
#include <gamedata.h>
|
||||
#include <generic/serverguiwrapper.h>
|
||||
|
||||
#include <net/socket_msg.h>
|
||||
@@ -561,7 +563,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
||||
|
||||
// Errors are handled globally, not within one dialog.
|
||||
connect(this, SIGNAL(SignalNetClientError(int, int)), this, SLOT(networkError(int, int)));
|
||||
connect(this, SIGNAL(SignalNetClientGameStart(int, int, int, int)), this, SLOT(networkStart(int, int, int, int)));
|
||||
connect(this, SIGNAL(SignalNetClientGameStart()), this, SLOT(networkStart()));
|
||||
|
||||
connect(this, SIGNAL(SignalNetServerPlayerJoined(QString)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(QString)));
|
||||
connect(this, SIGNAL(SignalNetServerPlayerLeft(QString)), myStartNetworkGameDialog, SLOT(removePlayer(QString)));
|
||||
@@ -619,8 +621,12 @@ void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
|
||||
//Speeds
|
||||
gameData.guiSpeed = myConfig->readConfigInt("GameSpeed");
|
||||
}
|
||||
// Set dealer pos.
|
||||
Tools myTool;
|
||||
myTool.getRandNumber(0, gameData.numberOfPlayers-1, 1, &gameData.startDealerPos, 0);
|
||||
|
||||
//Start Game!!!
|
||||
mySession->startGame(gameData);
|
||||
mySession->startLocalGame(gameData);
|
||||
}
|
||||
|
||||
|
||||
@@ -2375,14 +2381,11 @@ void mainWindowImpl::networkError(int errorID, int osErrorID) {
|
||||
myWaitingForServerGameDialog->reject();
|
||||
}
|
||||
|
||||
void mainWindowImpl::networkStart(int numberOfPlayers, int startCash, int smallBlind, int handsBeforeRaise)
|
||||
void mainWindowImpl::networkStart()
|
||||
{
|
||||
GameData gameData;
|
||||
gameData.numberOfPlayers = numberOfPlayers;
|
||||
gameData.startCash = startCash;
|
||||
gameData.smallBlind = smallBlind;
|
||||
gameData.handsBeforeRaise = handsBeforeRaise;
|
||||
mySession->startGame(gameData);
|
||||
// QMutexLocker lock(&myClientDataMutex);
|
||||
// assert(!myClientPlayerDataList.empty());
|
||||
// mySession->startClientGame(myClientGameData, myClientPlayerDataList);
|
||||
}
|
||||
|
||||
void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
#include "game_defs.h"
|
||||
#include <gamedata.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@@ -96,7 +95,7 @@ signals:
|
||||
void SignalNetClientError(int errorID, int osErrorID);
|
||||
void SignalNetClientPlayerJoined(QString playerName);
|
||||
void SignalNetClientPlayerLeft(QString playerName);
|
||||
void SignalNetClientGameStart(int numberOfPlayers, int startCash, int smallBlind, int handsBeforeRaise);
|
||||
void SignalNetClientGameStart();
|
||||
void SignalNetServerPlayerJoined(QString playerName);
|
||||
void SignalNetServerPlayerLeft(QString playerName);
|
||||
|
||||
@@ -197,7 +196,7 @@ public slots:
|
||||
void paintStartSplash();
|
||||
|
||||
void networkError(int, int);
|
||||
void networkStart(int, int, int, int);
|
||||
void networkStart();
|
||||
|
||||
void closeEvent(QCloseEvent*);
|
||||
|
||||
|
||||
@@ -115,7 +115,8 @@ struct NetPacketPlayerLeftData
|
||||
struct NetPacketGameStartData
|
||||
{
|
||||
NetPacketHeader head;
|
||||
u_int32_t reserved;
|
||||
u_int16_t startDealerPos;
|
||||
u_int16_t reserved;
|
||||
};
|
||||
|
||||
struct NetPacketHandStartData
|
||||
@@ -760,7 +761,7 @@ NetPacketGameStart::SetData(const NetPacketGameStart::Data &inData)
|
||||
NetPacketGameStartData *tmpData = (NetPacketGameStartData *)GetRawData();
|
||||
assert(tmpData);
|
||||
|
||||
tmpData->reserved = htonl(inData.reserved);
|
||||
tmpData->startDealerPos = htons(inData.startDealerPos);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -769,7 +770,7 @@ NetPacketGameStart::GetData(NetPacketGameStart::Data &outData) const
|
||||
NetPacketGameStartData *tmpData = (NetPacketGameStartData *)GetRawData();
|
||||
assert(tmpData);
|
||||
|
||||
outData.reserved = ntohl(tmpData->reserved);
|
||||
outData.startDealerPos = ntohs(tmpData->startDealerPos);
|
||||
}
|
||||
|
||||
const NetPacketGameStart *
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <core/rand.h>
|
||||
#include <gamedata.h>
|
||||
#include <game.h>
|
||||
#include <tools.h>
|
||||
#include <playerinterface.h>
|
||||
#include <handinterface.h>
|
||||
|
||||
@@ -223,8 +224,18 @@ ServerRecvStateStartGame::HandleNewConnection(ServerRecvThread &server, boost::s
|
||||
int
|
||||
ServerRecvStateStartGame::Process(ServerRecvThread &server)
|
||||
{
|
||||
GameData &gameData = server.GetGameData();
|
||||
|
||||
// Set dealer pos.
|
||||
Tools myTool;
|
||||
myTool.getRandNumber(0, gameData.numberOfPlayers-1, 1, &gameData.startDealerPos, 0);
|
||||
|
||||
boost::shared_ptr<NetPacket> answer(new NetPacketGameStart);
|
||||
|
||||
NetPacketGameStart::Data gameStartData;
|
||||
gameStartData.startDealerPos = gameData.startDealerPos;
|
||||
static_cast<NetPacketGameStart *>(answer.get())->SetData(gameStartData);
|
||||
|
||||
server.SendToAllPlayers(answer);
|
||||
server.SetState(ServerRecvStateStartHand::Instance());
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <net/receiverhelper.h>
|
||||
#include <net/socket_msg.h>
|
||||
#include <game.h>
|
||||
#include <localenginefactory.h>
|
||||
|
||||
#include <boost/lambda/lambda.hpp>
|
||||
|
||||
@@ -247,7 +248,11 @@ ServerRecvThread::InternalStartGame()
|
||||
{
|
||||
GuiInterface &gui = GetGui();
|
||||
PlayerDataList playerData = GetPlayerDataList();
|
||||
m_game.reset(new Game(&gui, playerData, GetGameData(), m_curGameId++, m_playerConfig));
|
||||
|
||||
// EngineFactory erstellen
|
||||
boost::shared_ptr<EngineFactory> factory(new LocalEngineFactory(m_playerConfig)); // LocalEngine erstellen
|
||||
|
||||
m_game.reset(new Game(&gui, factory, playerData, GetGameData(), m_curGameId++));
|
||||
SetState(SERVER_START_GAME_STATE::Instance());
|
||||
}
|
||||
|
||||
@@ -493,7 +498,7 @@ ServerRecvThread::GetGame()
|
||||
return *m_game;
|
||||
}
|
||||
|
||||
const GameData &
|
||||
GameData &
|
||||
ServerRecvThread::GetGameData() const
|
||||
{
|
||||
assert(m_gameData.get());
|
||||
|
||||
+2
-1
@@ -194,7 +194,8 @@ class NetPacketGameStart : public NetPacket
|
||||
public:
|
||||
struct Data
|
||||
{
|
||||
u_int32_t reserved;
|
||||
u_int16_t startDealerPos;
|
||||
u_int16_t reserved;
|
||||
};
|
||||
|
||||
NetPacketGameStart();
|
||||
|
||||
@@ -121,7 +121,7 @@ protected:
|
||||
ReceiverHelper &GetReceiver();
|
||||
|
||||
Game &GetGame();
|
||||
const GameData &GetGameData() const;
|
||||
GameData &GetGameData() const;
|
||||
bool CheckPassword(const std::string &password) const;
|
||||
|
||||
ServerSenderCallback &GetSenderCallback();
|
||||
|
||||
+25
-2
@@ -21,6 +21,8 @@
|
||||
#include "game.h"
|
||||
#include "guiinterface.h"
|
||||
#include "configfile.h"
|
||||
#include <localenginefactory.h>
|
||||
#include <clientenginefactory.h>
|
||||
#include <net/clientthread.h>
|
||||
#include <net/serverthread.h>
|
||||
|
||||
@@ -46,7 +48,7 @@ Session::~Session()
|
||||
}
|
||||
|
||||
|
||||
void Session::startGame(const GameData &gameData) {
|
||||
void Session::startLocalGame(const GameData &gameData) {
|
||||
|
||||
deleteGame();
|
||||
myGui->initGui(gameData.guiSpeed);
|
||||
@@ -73,7 +75,28 @@ void Session::startGame(const GameData &gameData) {
|
||||
|
||||
playerDataList.push_back(playerData);
|
||||
}
|
||||
currentGame = new Game(myGui, playerDataList, gameData, currentGameID, myConfig);
|
||||
// EngineFactory erstellen
|
||||
boost::shared_ptr<EngineFactory> factory(new LocalEngineFactory(myConfig)); // LocalEngine erstellen
|
||||
|
||||
currentGame = new Game(myGui, factory, playerDataList, gameData, currentGameID);
|
||||
|
||||
//// SPIEL-SCHLEIFE
|
||||
currentGame->initHand();
|
||||
currentGame->startHand();
|
||||
// SPIEL-SCHLEIFE
|
||||
}
|
||||
|
||||
void Session::startClientGame(const GameData &gameData, const PlayerDataList &playerDataList)
|
||||
{
|
||||
deleteGame();
|
||||
myGui->initGui(gameData.guiSpeed);
|
||||
|
||||
currentGameID++;
|
||||
|
||||
// EngineFactory erstellen
|
||||
boost::shared_ptr<EngineFactory> factory(new ClientEngineFactory(myConfig)); // LocalEngine erstellen
|
||||
|
||||
currentGame = new Game(myGui, factory, playerDataList, gameData, currentGameID);
|
||||
|
||||
//// SPIEL-SCHLEIFE
|
||||
currentGame->initHand();
|
||||
|
||||
+3
-1
@@ -20,6 +20,7 @@
|
||||
#ifndef STDSESSION_H
|
||||
#define STDSESSION_H
|
||||
#include "gamedata.h"
|
||||
#include "playerdata.h"
|
||||
#include "game_defs.h"
|
||||
#include <string>
|
||||
|
||||
@@ -36,7 +37,8 @@ public:
|
||||
|
||||
~Session();
|
||||
|
||||
void startGame(const GameData &gameData);
|
||||
void startLocalGame(const GameData &gameData);
|
||||
void startClientGame(const GameData &gameData, const PlayerDataList &playerDataList);
|
||||
void deleteGame();
|
||||
|
||||
Game *getCurrentGame();
|
||||
|
||||
Reference in New Issue
Block a user