From 211d8fcefc9ac8f26787aedf01cd5260be229e89 Mon Sep 17 00:00:00 2001 From: floty Date: Thu, 18 Oct 2007 17:58:51 +0000 Subject: [PATCH] comment out playerArray --- src/engine/boardinterface.h | 2 +- src/engine/enginefactory.h | 2 +- src/engine/handinterface.h | 2 +- src/engine/local_engine/localboard.cpp | 6 ++--- src/engine/local_engine/localboard.h | 4 ++-- .../local_engine/localenginefactory.cpp | 2 +- src/engine/local_engine/localenginefactory.h | 2 +- src/engine/local_engine/localhand.cpp | 4 ++-- src/engine/local_engine/localhand.h | 6 ++--- src/engine/network_engine/clientboard.cpp | 6 ++--- src/engine/network_engine/clientboard.h | 4 ++-- .../network_engine/clientenginefactory.cpp | 4 ++-- .../network_engine/clientenginefactory.h | 2 +- src/engine/network_engine/clienthand.cpp | 14 +++++------ src/engine/network_engine/clienthand.h | 6 ++--- src/game.cpp | 8 +++---- src/game.h | 4 ++-- src/gui/qt/mainwindow/mainwindowimpl.cpp | 16 ++++++++++--- src/net/common/clientthread.cpp | 23 +++++++++++++++++-- 19 files changed, 73 insertions(+), 44 deletions(-) diff --git a/src/engine/boardinterface.h b/src/engine/boardinterface.h index 79c8989f..53d1845a 100644 --- a/src/engine/boardinterface.h +++ b/src/engine/boardinterface.h @@ -37,7 +37,7 @@ public: virtual ~BoardInterface(); // - virtual void setPlayerLists(std::vector >, PlayerList, PlayerList, PlayerList) =0; + virtual void setPlayerLists(/*std::vector >,*/ PlayerList, PlayerList, PlayerList) =0; virtual void setHand(HandInterface*) =0; // virtual void setMyCards(int* theValue) =0; diff --git a/src/engine/enginefactory.h b/src/engine/enginefactory.h index c2766bcf..c123485a 100644 --- a/src/engine/enginefactory.h +++ b/src/engine/enginefactory.h @@ -33,7 +33,7 @@ public: virtual ~EngineFactory(); - virtual HandInterface* createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, std::vector > 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 f, GuiInterface *g, BoardInterface *b, /*std::vector > 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 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 > createBeRo(HandInterface* hi, int id, unsigned dP, int sB) =0; diff --git a/src/engine/handinterface.h b/src/engine/handinterface.h index c21cdb22..1f2b4a42 100644 --- a/src/engine/handinterface.h +++ b/src/engine/handinterface.h @@ -36,7 +36,7 @@ public: virtual void start() = 0; - virtual std::vector > getPlayerArray() const =0; // delete +// virtual std::vector > getPlayerArray() const =0; // delete virtual PlayerList getSeatsList() const =0; virtual PlayerList getActivePlayerList() const =0; virtual PlayerList getRunningPlayerList() const =0; diff --git a/src/engine/local_engine/localboard.cpp b/src/engine/local_engine/localboard.cpp index de72f55b..7ab9ab2b 100755 --- a/src/engine/local_engine/localboard.cpp +++ b/src/engine/local_engine/localboard.cpp @@ -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 > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl) { - playerArray = sl_old; // delete +void LocalBoard::setPlayerLists(/*std::vector > sl_old, */PlayerList sl, PlayerList apl, PlayerList rpl) { +// playerArray = sl_old; // delete seatsList = sl; activePlayerList = apl; runningPlayerList = rpl; diff --git a/src/engine/local_engine/localboard.h b/src/engine/local_engine/localboard.h index e0f462c0..5e81804e 100755 --- a/src/engine/local_engine/localboard.h +++ b/src/engine/local_engine/localboard.h @@ -35,7 +35,7 @@ public: LocalBoard(); ~LocalBoard(); - void setPlayerLists(std::vector >, PlayerList, PlayerList, PlayerList); + void setPlayerLists(/*std::vector >,*/ 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 > playerArray; // delete +// std::vector > playerArray; // delete PlayerList seatsList; PlayerList activePlayerList; PlayerList runningPlayerList; diff --git a/src/engine/local_engine/localenginefactory.cpp b/src/engine/local_engine/localenginefactory.cpp index 5cc52371..0e1e6fef 100644 --- a/src/engine/local_engine/localenginefactory.cpp +++ b/src/engine/local_engine/localenginefactory.cpp @@ -42,7 +42,7 @@ LocalEngineFactory::~LocalEngineFactory() } -HandInterface* LocalEngineFactory::createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, std::vector > 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 f, GuiInterface *g, BoardInterface *b, /*std::vector > 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; } diff --git a/src/engine/local_engine/localenginefactory.h b/src/engine/local_engine/localenginefactory.h index 16ac3e91..1d1fd4b3 100644 --- a/src/engine/local_engine/localenginefactory.h +++ b/src/engine/local_engine/localenginefactory.h @@ -37,7 +37,7 @@ public: LocalEngineFactory(ConfigFile*); ~LocalEngineFactory(); - HandInterface* createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, std::vector > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); + HandInterface* createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, /*std::vector > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); BoardInterface* createBoard(); boost::shared_ptr createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB); std::vector > createBeRo(HandInterface* hi, int id, unsigned dP, int sB); diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index fb41720e..206f2ee4 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -29,8 +29,8 @@ using namespace std; -LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, std::vector > 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 f, GuiInterface *g, BoardInterface *b, /*std::vector > 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) { diff --git a/src/engine/local_engine/localhand.h b/src/engine/local_engine/localhand.h index 64f58729..c3a39332 100755 --- a/src/engine/local_engine/localhand.h +++ b/src/engine/local_engine/localhand.h @@ -34,12 +34,12 @@ class LocalHand : public HandInterface{ public: - LocalHand(boost::shared_ptr f, GuiInterface*, BoardInterface*, std::vector >, PlayerList, PlayerList, PlayerList, int, int, unsigned, int, int); + LocalHand(boost::shared_ptr f, GuiInterface*, BoardInterface*, /*std::vector >,*/ PlayerList, PlayerList, PlayerList, int, int, unsigned, int, int); ~LocalHand(); void start(); - std::vector > getPlayerArray() const { return playerArray; } +// std::vector > 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 > playerArray; // delete +// std::vector > playerArray; // delete PlayerList seatsList; PlayerList activePlayerList; PlayerList runningPlayerList; diff --git a/src/engine/network_engine/clientboard.cpp b/src/engine/network_engine/clientboard.cpp index aaf90d92..d68a0059 100644 --- a/src/engine/network_engine/clientboard.cpp +++ b/src/engine/network_engine/clientboard.cpp @@ -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 > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl) +ClientBoard::setPlayerLists(/*std::vector > 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; diff --git a/src/engine/network_engine/clientboard.h b/src/engine/network_engine/clientboard.h index 2c0997ff..58506896 100644 --- a/src/engine/network_engine/clientboard.h +++ b/src/engine/network_engine/clientboard.h @@ -34,7 +34,7 @@ public: ClientBoard(); ~ClientBoard(); - void setPlayerLists(std::vector >, PlayerList, PlayerList, PlayerList); + void setPlayerLists(/*std::vector >,*/ PlayerList, PlayerList, PlayerList); void setHand(HandInterface*); void setMyCards(int* theValue); @@ -55,7 +55,7 @@ public: private: mutable boost::recursive_mutex m_syncMutex; - std::vector > playerArray; // delete +// std::vector > playerArray; // delete PlayerList seatsList; PlayerList activePlayerList; PlayerList runningPlayerList; diff --git a/src/engine/network_engine/clientenginefactory.cpp b/src/engine/network_engine/clientenginefactory.cpp index a28ec48b..85254613 100644 --- a/src/engine/network_engine/clientenginefactory.cpp +++ b/src/engine/network_engine/clientenginefactory.cpp @@ -35,9 +35,9 @@ ClientEngineFactory::~ClientEngineFactory() } -HandInterface* ClientEngineFactory::createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, std::vector > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) +HandInterface* ClientEngineFactory::createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, /*std::vector > 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() diff --git a/src/engine/network_engine/clientenginefactory.h b/src/engine/network_engine/clientenginefactory.h index 8fdffb53..1ae82389 100644 --- a/src/engine/network_engine/clientenginefactory.h +++ b/src/engine/network_engine/clientenginefactory.h @@ -37,7 +37,7 @@ public: ClientEngineFactory(); ~ClientEngineFactory(); - HandInterface* createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, std::vector > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); + HandInterface* createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, /*std::vector > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); BoardInterface* createBoard(); boost::shared_ptr createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB); std::vector > createBeRo(HandInterface* hi, int id, unsigned dP, int sB); diff --git a/src/engine/network_engine/clienthand.cpp b/src/engine/network_engine/clienthand.cpp index 5a507471..575afc3b 100644 --- a/src/engine/network_engine/clienthand.cpp +++ b/src/engine/network_engine/clienthand.cpp @@ -21,8 +21,8 @@ using namespace std; -ClientHand::ClientHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, std::vector > 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 f, GuiInterface *g, BoardInterface *b, /*std::vector > 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 > -ClientHand::getPlayerArray() const -{ - return playerArray; -} +// std::vector > +// ClientHand::getPlayerArray() const +// { +// return playerArray; +// } PlayerList ClientHand::getSeatsList() const diff --git a/src/engine/network_engine/clienthand.h b/src/engine/network_engine/clienthand.h index f0d9c895..8619a636 100644 --- a/src/engine/network_engine/clienthand.h +++ b/src/engine/network_engine/clienthand.h @@ -32,12 +32,12 @@ class ClientHand : public HandInterface { public: - ClientHand ( boost::shared_ptr f, GuiInterface*, BoardInterface*, std::vector >, PlayerList, PlayerList, PlayerList , int, int, int, int, int ); + ClientHand ( boost::shared_ptr f, GuiInterface*, BoardInterface*, /*std::vector >,*/ PlayerList, PlayerList, PlayerList , int, int, int, int, int ); ~ClientHand(); void start(); - std::vector > getPlayerArray() const; +// std::vector > 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 > playerArray; // delete +// std::vector > playerArray; // delete PlayerList seatsList; PlayerList activePlayerList; PlayerList runningPlayerList; diff --git a/src/game.cpp b/src/game.cpp index 11b36d4d..0b53abcd 100755 --- a/src/game.cpp +++ b/src/game.cpp @@ -106,7 +106,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr 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 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 diff --git a/src/game.h b/src/game.h index 977a57a7..41b0d3bf 100755 --- a/src/game.h +++ b/src/game.h @@ -56,7 +56,7 @@ public: HandInterface *getCurrentHand(); const HandInterface *getCurrentHand() const; - std::vector > getPlayerArray() const {return playerArray;} +// std::vector > 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 > playerArray; // available seats --> seatList !!! TODO // delete +// std::vector > playerArray; // available seats --> seatList !!! TODO // delete PlayerList seatsList; PlayerList activePlayerList; // used seats PlayerList runningPlayerList; // nonfolded and nonallin active players diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 035a2d9e..3275d7c5 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -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(){ diff --git a/src/net/common/clientthread.cpp b/src/net/common/clientthread.cpp index 55c4ce9c..1c13fd56 100644 --- a/src/net/common/clientthread.cpp +++ b/src/net/common/clientthread.cpp @@ -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 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 tmpPlayer = m_game->getPlayerArray()[i]; + boost::shared_ptr tmpPlayer = *it; if (tmpPlayer->getMyActiveStatus()) { // If a player is not in the player data list, it was disconnected.