buggy!!!
This commit is contained in:
@@ -20,6 +20,9 @@
|
||||
#ifndef BOARDINTERFACE_H
|
||||
#define BOARDINTERFACE_H
|
||||
|
||||
#include <vector>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
class PlayerInterface;
|
||||
class HandInterface;
|
||||
|
||||
@@ -29,7 +32,7 @@ public:
|
||||
|
||||
virtual ~BoardInterface();
|
||||
//
|
||||
virtual void setPlayer(PlayerInterface**) =0;
|
||||
virtual void setPlayer(std::vector<boost::shared_ptr<PlayerInterface> >) =0;
|
||||
virtual void setHand(HandInterface*) =0;
|
||||
//
|
||||
virtual void setMyCards(int* theValue) =0;
|
||||
|
||||
@@ -33,9 +33,9 @@ public:
|
||||
|
||||
virtual ~EngineFactory();
|
||||
|
||||
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 HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<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 boost::shared_ptr<PlayerInterface> createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) =0;
|
||||
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, int aP, int dP, int sB) =0;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
|
||||
virtual void start() = 0;
|
||||
|
||||
virtual PlayerInterface** getPlayerArray() const =0;
|
||||
virtual std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const =0;
|
||||
virtual BoardInterface* getBoard() const =0;
|
||||
virtual boost::shared_ptr<BeRoInterface> getPreflop() const =0;
|
||||
virtual boost::shared_ptr<BeRoInterface> getFlop() const =0;
|
||||
|
||||
@@ -33,7 +33,7 @@ LocalBoard::~LocalBoard()
|
||||
{
|
||||
}
|
||||
|
||||
void LocalBoard::setPlayer(PlayerInterface** p) { playerArray = p; }
|
||||
void LocalBoard::setPlayer(std::vector<boost::shared_ptr<PlayerInterface> > p) { playerArray = p; }
|
||||
|
||||
void LocalBoard::setHand(HandInterface* br) { currentHand = br; }
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <boardinterface.h>
|
||||
|
||||
@@ -34,7 +35,7 @@ public:
|
||||
LocalBoard();
|
||||
~LocalBoard();
|
||||
|
||||
void setPlayer(PlayerInterface**);
|
||||
void setPlayer(std::vector<boost::shared_ptr<PlayerInterface> >);
|
||||
void setHand(HandInterface*);
|
||||
|
||||
void setMyCards(int* theValue) { int i; for(i=0; i<5; i++) myCards[i] = theValue[i]; }
|
||||
@@ -52,7 +53,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
PlayerInterface **playerArray;
|
||||
std::vector<boost::shared_ptr<PlayerInterface> > playerArray;
|
||||
HandInterface *currentHand;
|
||||
|
||||
int myCards[5];
|
||||
|
||||
@@ -42,11 +42,11 @@ LocalEngineFactory::~LocalEngineFactory()
|
||||
}
|
||||
|
||||
|
||||
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); }
|
||||
HandInterface* LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<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; }
|
||||
|
||||
PlayerInterface* LocalEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) { return new LocalPlayer(myConfig, b, id, uniqueId, type, name, avatar, sC, aS, mB); }
|
||||
boost::shared_ptr<PlayerInterface> LocalEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) { return new LocalPlayer(myConfig, b, id, uniqueId, type, name, avatar, sC, aS, mB); }
|
||||
|
||||
std::vector<boost::shared_ptr<BeRoInterface> > LocalEngineFactory::createBeRo(HandInterface* hi, int id, int aP, int dP, int sB) {
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#include <boardinterface.h>
|
||||
#include <playerinterface.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <vector>
|
||||
|
||||
class ConfigFile;
|
||||
|
||||
class LocalEngineFactory : public EngineFactory
|
||||
@@ -34,9 +37,9 @@ public:
|
||||
LocalEngineFactory(ConfigFile*);
|
||||
~LocalEngineFactory();
|
||||
|
||||
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);
|
||||
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<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);
|
||||
boost::shared_ptr<PlayerInterface> createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
|
||||
private:
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
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)
|
||||
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > p, int id, int sP, int aP, int dP, int sB,int sC)
|
||||
: myFactory(f), myGui(g), myBoard(b), playerArray(p), myBeRo(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0),
|
||||
cardsShown(false), bettingRoundsPlayed(0)
|
||||
{
|
||||
|
||||
@@ -34,12 +34,12 @@
|
||||
|
||||
class LocalHand : public HandInterface{
|
||||
public:
|
||||
LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int, int);
|
||||
LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, std::vector<boost::shared_ptr<PlayerInterface> >, int, int, int, int, int, int);
|
||||
~LocalHand();
|
||||
|
||||
void start();
|
||||
|
||||
PlayerInterface** getPlayerArray() const { return playerArray; }
|
||||
std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const { return playerArray; }
|
||||
BoardInterface* getBoard() const { return myBoard; }
|
||||
boost::shared_ptr<BeRoInterface> getPreflop() const { return myBeRo[GAME_STATE_PREFLOP]; }
|
||||
boost::shared_ptr<BeRoInterface> getFlop() const { return myBeRo[GAME_STATE_FLOP]; }
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
boost::shared_ptr<EngineFactory> myFactory;
|
||||
GuiInterface *myGui;
|
||||
BoardInterface *myBoard;
|
||||
PlayerInterface **playerArray;
|
||||
std::vector<boost::shared_ptr<PlayerInterface> > playerArray;
|
||||
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
|
||||
|
||||
int myID;
|
||||
|
||||
@@ -35,7 +35,7 @@ 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)
|
||||
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<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);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ 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)
|
||||
boost::shared_ptr<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(NULL, b, id, uniqueId, type, name, avatar, sC, aS, mB);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
#include <boardinterface.h>
|
||||
#include <playerinterface.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class ConfigFile;
|
||||
|
||||
class ClientEngineFactory : public EngineFactory
|
||||
@@ -35,7 +39,7 @@ public:
|
||||
|
||||
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);
|
||||
boost::shared_ptr<PlayerInterface> createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
|
||||
};
|
||||
|
||||
+15
-12
@@ -43,9 +43,9 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
|
||||
actualHandID = 0;
|
||||
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
playerArray[i] = 0;
|
||||
}
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// playerArray[i] = 0;
|
||||
// }
|
||||
|
||||
// Dealer Position bestimmen
|
||||
PlayerDataList::const_iterator player_i = playerDataList.begin();
|
||||
@@ -93,7 +93,10 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
}
|
||||
|
||||
//PlayerObjekte erzeugen
|
||||
playerArray[i] = myFactory->createPlayer(actualBoard, i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0);
|
||||
playerArray.push_back(myFactory->createPlayer(actualBoard, i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0));
|
||||
|
||||
|
||||
// playerArray[i] = myFactory->createPlayer(actualBoard, i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0);
|
||||
playerArray[i]->setNetSessionData(myNetSession);
|
||||
}
|
||||
actualBoard->setPlayer(playerArray);
|
||||
@@ -110,12 +113,12 @@ Game::~Game()
|
||||
delete actualHand;
|
||||
actualHand = 0;
|
||||
|
||||
PlayerInterface *tempPlayer;
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
tempPlayer = playerArray[i];
|
||||
playerArray[i] = 0;
|
||||
delete tempPlayer;
|
||||
}
|
||||
// PlayerInterface *tempPlayer;
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// tempPlayer = playerArray[i];
|
||||
// playerArray[i] = 0;
|
||||
// delete tempPlayer;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -183,9 +186,9 @@ void Game::startHand()
|
||||
actualHand->start();
|
||||
}
|
||||
|
||||
PlayerInterface *Game::getPlayerByUniqueId(unsigned id)
|
||||
boost::shared_ptr<PlayerInterface> Game::getPlayerByUniqueId(unsigned id)
|
||||
{
|
||||
PlayerInterface *tmpPlayer = NULL;
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer;
|
||||
for (int i = 0; i < startQuantityPlayers; i++)
|
||||
{
|
||||
if (playerArray[i]->getMyUniqueID() == id)
|
||||
|
||||
+4
-3
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
HandInterface *getCurrentHand();
|
||||
|
||||
PlayerInterface** getPlayerArray() {return playerArray;}
|
||||
std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() {return playerArray;}
|
||||
|
||||
//Zufgriff Startvariablen
|
||||
void setStartQuantityPlayers(int theValue) { startQuantityPlayers = theValue; }
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
void setActualHandID(int theValue) { actualHandID = theValue; }
|
||||
int getActualHandID() const { return actualHandID; }
|
||||
|
||||
PlayerInterface * getPlayerByUniqueId(unsigned id);
|
||||
boost::shared_ptr<PlayerInterface> getPlayerByUniqueId(unsigned id);
|
||||
|
||||
private:
|
||||
boost::shared_ptr<EngineFactory> myFactory;
|
||||
@@ -81,7 +81,8 @@ private:
|
||||
GuiInterface *myGui;
|
||||
HandInterface *actualHand;
|
||||
BoardInterface *actualBoard;
|
||||
PlayerInterface *playerArray[MAX_NUMBER_OF_PLAYERS];
|
||||
std::vector<boost::shared_ptr<PlayerInterface> > playerArray;
|
||||
// PlayerInterface *playerArray[MAX_NUMBER_OF_PLAYERS];
|
||||
|
||||
//Startvariablen
|
||||
int startQuantityPlayers;
|
||||
|
||||
Reference in New Issue
Block a user