comment out playerArray

This commit is contained in:
floty
2007-10-18 17:58:51 +00:00
parent 06a8fd5730
commit 211d8fcefc
19 changed files with 73 additions and 44 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ public:
virtual ~BoardInterface();
//
virtual void setPlayerLists(std::vector<boost::shared_ptr<PlayerInterface> >, PlayerList, PlayerList, PlayerList) =0;
virtual void setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList) =0;
virtual void setHand(HandInterface*) =0;
//
virtual void setMyCards(int* theValue) =0;
+1 -1
View File
@@ -33,7 +33,7 @@ public:
virtual ~EngineFactory();
virtual HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, 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> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) =0;
virtual BoardInterface* createBoard() =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, unsigned dP, int sB) =0;
+1 -1
View File
@@ -36,7 +36,7 @@ public:
virtual void start() = 0;
virtual std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const =0; // delete
// virtual std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const =0; // delete
virtual PlayerList getSeatsList() const =0;
virtual PlayerList getActivePlayerList() const =0;
virtual PlayerList getRunningPlayerList() const =0;
+3 -3
View File
@@ -26,7 +26,7 @@
using namespace std;
LocalBoard::LocalBoard() : BoardInterface(), playerArray(0), currentHand(0), pot(0), sets(0)
LocalBoard::LocalBoard() : BoardInterface(), /*playerArray(0),*/ currentHand(0), pot(0), sets(0)
{
}
@@ -35,8 +35,8 @@ LocalBoard::~LocalBoard()
{
}
void LocalBoard::setPlayerLists(std::vector<boost::shared_ptr<PlayerInterface> > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl) {
playerArray = sl_old; // delete
void LocalBoard::setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> > sl_old, */PlayerList sl, PlayerList apl, PlayerList rpl) {
// playerArray = sl_old; // delete
seatsList = sl;
activePlayerList = apl;
runningPlayerList = rpl;
+2 -2
View File
@@ -35,7 +35,7 @@ public:
LocalBoard();
~LocalBoard();
void setPlayerLists(std::vector<boost::shared_ptr<PlayerInterface> >, PlayerList, PlayerList, PlayerList);
void setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList);
void setHand(HandInterface*);
void setMyCards(int* theValue) { int i; for(i=0; i<5; i++) myCards[i] = theValue[i]; }
@@ -55,7 +55,7 @@ public:
private:
std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;
@@ -42,7 +42,7 @@ LocalEngineFactory::~LocalEngineFactory()
}
HandInterface* LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) { return new LocalHand(f, g, b, sl_old, sl, apl, rpl, id, sP, dP, sB, sC); }
HandInterface* LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) { return new LocalHand(f, g, b, /*sl_old,*/ sl, apl, rpl, id, sP, dP, sB, sC); }
BoardInterface* LocalEngineFactory::createBoard() { return new LocalBoard; }
+1 -1
View File
@@ -37,7 +37,7 @@ public:
LocalEngineFactory(ConfigFile*);
~LocalEngineFactory();
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
BoardInterface* createBoard();
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, unsigned dP, int sB);
+2 -2
View File
@@ -29,8 +29,8 @@
using namespace std;
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, unsigned dP, int sB,int sC)
: myFactory(f), myGui(g), myBoard(b), playerArray(sl_old), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(false),
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, unsigned dP, int sB,int sC)
: myFactory(f), myGui(g), myBoard(b), /*playerArray(sl_old),*/ seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(false),
cardsShown(false), bettingRoundsPlayed(0)
{
+3 -3
View File
@@ -34,12 +34,12 @@
class LocalHand : public HandInterface{
public:
LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, std::vector<boost::shared_ptr<PlayerInterface> >, PlayerList, PlayerList, PlayerList, int, int, unsigned, int, int);
LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, /*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList, int, int, unsigned, int, int);
~LocalHand();
void start();
std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const { return playerArray; }
// std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const { return playerArray; }
PlayerList getSeatsList() const {return seatsList;}
PlayerList getActivePlayerList() const {return activePlayerList;}
PlayerList getRunningPlayerList() const {return runningPlayerList;}
@@ -97,7 +97,7 @@ private:
GuiInterface *myGui;
BoardInterface *myBoard;
std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;
+3 -3
View File
@@ -24,7 +24,7 @@
using namespace std;
ClientBoard::ClientBoard()
: playerArray(0), currentHand(0), pot(0), sets(0)
: /*playerArray(0),*/ currentHand(0), pot(0), sets(0)
{
}
@@ -34,10 +34,10 @@ ClientBoard::~ClientBoard()
}
void
ClientBoard::setPlayerLists(std::vector<boost::shared_ptr<PlayerInterface> > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl)
ClientBoard::setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
playerArray = sl_old; // delete
// playerArray = sl_old; // delete
seatsList = sl;
activePlayerList = apl;
runningPlayerList = rpl;
+2 -2
View File
@@ -34,7 +34,7 @@ public:
ClientBoard();
~ClientBoard();
void setPlayerLists(std::vector<boost::shared_ptr<PlayerInterface> >, PlayerList, PlayerList, PlayerList);
void setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList);
void setHand(HandInterface*);
void setMyCards(int* theValue);
@@ -55,7 +55,7 @@ public:
private:
mutable boost::recursive_mutex m_syncMutex;
std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;
@@ -35,9 +35,9 @@ ClientEngineFactory::~ClientEngineFactory()
}
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
{
return new ClientHand(f, g, b, sl_old, sl, apl, rpl, id, sP, dP, sB, sC);
return new ClientHand(f, g, b, /*sl_old,*/ sl, apl, rpl, id, sP, dP, sB, sC);
}
BoardInterface* ClientEngineFactory::createBoard()
@@ -37,7 +37,7 @@ public:
ClientEngineFactory();
~ClientEngineFactory();
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
BoardInterface* createBoard();
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, unsigned dP, int sB);
+7 -7
View File
@@ -21,8 +21,8 @@
using namespace std;
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
: myFactory(f), myGui(g), myBoard(b), playerArray(sl_old), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0),
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
: myFactory(f), myGui(g), myBoard(b), /*playerArray(sl_old),*/ seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0),
smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(0),
cardsShown(false), bettingRoundsPlayed(0)
{
@@ -67,11 +67,11 @@ ClientHand::start()
{
}
std::vector<boost::shared_ptr<PlayerInterface> >
ClientHand::getPlayerArray() const
{
return playerArray;
}
// std::vector<boost::shared_ptr<PlayerInterface> >
// ClientHand::getPlayerArray() const
// {
// return playerArray;
// }
PlayerList
ClientHand::getSeatsList() const
+3 -3
View File
@@ -32,12 +32,12 @@
class ClientHand : public HandInterface
{
public:
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, std::vector<boost::shared_ptr<PlayerInterface> >, PlayerList, PlayerList, PlayerList , int, int, int, int, int );
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, /*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList , int, int, int, int, int );
~ClientHand();
void start();
std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const;
// std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const;
PlayerList getSeatsList() const;
PlayerList getActivePlayerList() const;
PlayerList getRunningPlayerList() const;
@@ -97,7 +97,7 @@ class ClientHand : public HandInterface
GuiInterface *myGui;
BoardInterface *myBoard;
std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;
+4 -4
View File
@@ -106,7 +106,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
tmpPlayer->setNetSessionData(myNetSession);
// fill player lists
playerArray.push_back(tmpPlayer); // delete
// playerArray.push_back(tmpPlayer); // delete
seatsList->push_back(tmpPlayer);
if(startQuantityPlayers > i) {
activePlayerList->push_back(tmpPlayer);
@@ -114,10 +114,10 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
(*runningPlayerList) = (*activePlayerList);
playerArray[i]->setNetSessionData(myNetSession); // delete
// playerArray[i]->setNetSessionData(myNetSession); // delete
}
currentBoard->setPlayerLists(playerArray, seatsList, activePlayerList, runningPlayerList); // delete playerArray
currentBoard->setPlayerLists(/*playerArray,*/ seatsList, activePlayerList, runningPlayerList); // delete playerArray
//start timer
blindsTimer.reset();
@@ -191,7 +191,7 @@ void Game::initHand()
(*runningPlayerList) = (*activePlayerList);
// Hand erstellen
currentHand = myFactory->createHand(myFactory, myGui, currentBoard, playerArray, seatsList, activePlayerList, runningPlayerList, currentHandID, startQuantityPlayers, dealerPosition, currentSmallBlind, startCash); // delete playerArray
currentHand = myFactory->createHand(myFactory, myGui, currentBoard, /*playerArray,*/ seatsList, activePlayerList, runningPlayerList, currentHandID, startQuantityPlayers, dealerPosition, currentSmallBlind, startCash); // delete playerArray
// Dealer-Button weiterschieben --> Achtung inactive -> TODO exception-rule !!! DELETE
+2 -2
View File
@@ -56,7 +56,7 @@ public:
HandInterface *getCurrentHand();
const HandInterface *getCurrentHand() const;
std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const {return playerArray;}
// std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const {return playerArray;}
PlayerList getSeatsList() const {return seatsList;}
PlayerList getActivePlayerList() const {return activePlayerList;}
PlayerList getRunningPlayerList() const {return runningPlayerList;}
@@ -91,7 +91,7 @@ private:
HandInterface *currentHand;
BoardInterface *currentBoard;
std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // available seats --> seatList !!! TODO // delete
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // available seats --> seatList !!! TODO // delete
PlayerList seatsList;
PlayerList activePlayerList; // used seats
PlayerList runningPlayerList; // nonfolded and nonallin active players
+13 -3
View File
@@ -2353,13 +2353,23 @@ int mainWindowImpl::getMyCallAmount() {
tempHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
if (currentHand->getPlayerArray()[0]->getMyCash()+currentHand->getPlayerArray()[0]->getMySet() <= tempHighestSet) {
// if (currentHand->getPlayerArray()[0]->getMyCash()+currentHand->getPlayerArray()[0]->getMySet() <= tempHighestSet) {
//
// return currentHand->getPlayerArray()[0]->getMyCash();
// }
// else {
// return tempHighestSet - currentHand->getPlayerArray()[0]->getMySet();
// }
return currentHand->getPlayerArray()[0]->getMyCash();
if (currentHand->getSeatsList()->front()->getMyCash()+currentHand->getSeatsList()->front()->getMySet() <= tempHighestSet) {
return currentHand->getSeatsList()->front()->getMyCash();
}
else {
return tempHighestSet - currentHand->getPlayerArray()[0]->getMySet();
return tempHighestSet - currentHand->getSeatsList()->front()->getMySet();
}
}
void mainWindowImpl::myCall(){
+21 -2
View File
@@ -720,11 +720,30 @@ void
ClientThread::RemoveDisconnectedPlayers()
{
// This should only be called between hands.
// if (m_game.get())
// {
// for (int i = 0; i < m_game->getStartQuantityPlayers(); i++)
// {
// boost::shared_ptr<PlayerInterface> tmpPlayer = m_game->getPlayerArray()[i];
// if (tmpPlayer->getMyActiveStatus())
// {
// // If a player is not in the player data list, it was disconnected.
// if (!GetPlayerDataByUniqueId(tmpPlayer->getMyUniqueID()).get())
// {
// tmpPlayer->setMyCash(0);
// tmpPlayer->setMyActiveStatus(false);
// }
// }
// }
// }
// This should only be called between hands.
if (m_game.get())
{
for (int i = 0; i < m_game->getStartQuantityPlayers(); i++)
PlayerListIterator it;
for (it = m_game->getSeatsList()->begin(); it != m_game->getSeatsList()->end(); it++)
{
boost::shared_ptr<PlayerInterface> tmpPlayer = m_game->getPlayerArray()[i];
boost::shared_ptr<PlayerInterface> tmpPlayer = *it;
if (tmpPlayer->getMyActiveStatus())
{
// If a player is not in the player data list, it was disconnected.