diff --git a/src/engine/boardinterface.h b/src/engine/boardinterface.h index 6231e8ee..965cabfa 100644 --- a/src/engine/boardinterface.h +++ b/src/engine/boardinterface.h @@ -59,7 +59,7 @@ public: virtual void collectSets() =0; virtual void collectPot() =0; - virtual void distributePot(unsigned) =0; + virtual void distributePot(unsigned) =0; virtual void determinePlayerNeedToShowCards() =0; virtual std::list getWinners() const =0; diff --git a/src/engine/enginefactory.h b/src/engine/enginefactory.h index 71c93198..c13b547b 100644 --- a/src/engine/enginefactory.h +++ b/src/engine/enginefactory.h @@ -45,7 +45,7 @@ public: virtual ~EngineFactory(); virtual boost::shared_ptr createHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) =0; - virtual boost::shared_ptr createBoard() =0; + virtual boost::shared_ptr createBoard() =0; virtual boost::shared_ptr createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB) =0; virtual std::vector > createBeRo(HandInterface *hi, unsigned dP, int sB) =0; }; diff --git a/src/engine/local_engine/localbero.cpp b/src/engine/local_engine/localbero.cpp index ace5b3f2..3e9e031a 100644 --- a/src/engine/local_engine/localbero.cpp +++ b/src/engine/local_engine/localbero.cpp @@ -38,7 +38,7 @@ using namespace std; LocalBeRo::LocalBeRo(HandInterface* hi, unsigned dP, int sB, GameState gS) - : BeRoInterface(), myHand(hi), myBeRoID(gS), dealerPosition(dP), smallBlindPosition(0), smallBlindPositionId(0), bigBlindPositionId(0), smallBlind(sB), highestSet(0), minimumRaise(2*sB), fullBetRule(false), firstRun(true), firstRunGui(true), firstRound(true), firstHeadsUpRound(true), currentPlayersTurnId(0), firstRoundLastPlayersTurnId(0), logBoardCardsDone(false) + : BeRoInterface(), myHand(hi), myBeRoID(gS), dealerPosition(dP), smallBlindPosition(0), smallBlindPositionId(0), bigBlindPositionId(0), smallBlind(sB), highestSet(0), minimumRaise(2*sB), fullBetRule(false), firstRun(true), firstRunGui(true), firstRound(true), firstHeadsUpRound(true), currentPlayersTurnId(0), firstRoundLastPlayersTurnId(0), logBoardCardsDone(false) { currentPlayersTurnIt = myHand->getRunningPlayerList()->begin(); lastPlayersTurnIt = myHand->getRunningPlayerList()->begin(); diff --git a/src/engine/local_engine/localbero.h b/src/engine/local_engine/localbero.h index a8be1ca1..ecc784c2 100644 --- a/src/engine/local_engine/localbero.h +++ b/src/engine/local_engine/localbero.h @@ -81,7 +81,7 @@ protected: return myHand; } - unsigned getDealerPosition() const { + unsigned getDealerPosition() const { return dealerPosition; } @@ -171,7 +171,7 @@ private: HandInterface* myHand; const GameState myBeRoID; - unsigned dealerPosition; + unsigned dealerPosition; int smallBlindPosition; unsigned smallBlindPositionId; diff --git a/src/engine/local_engine/localberopostriver.cpp b/src/engine/local_engine/localberopostriver.cpp index a9a2aca5..02a279ce 100644 --- a/src/engine/local_engine/localberopostriver.cpp +++ b/src/engine/local_engine/localberopostriver.cpp @@ -91,7 +91,7 @@ void LocalBeRoPostRiver::postRiverRun() getMyHand()->getBoard()->determinePlayerNeedToShowCards(); // Pot-Verteilung - getMyHand()->getBoard()->distributePot(getDealerPosition()); + getMyHand()->getBoard()->distributePot(getDealerPosition()); //Pot auf 0 setzen getMyHand()->getBoard()->setPot(0); diff --git a/src/engine/local_engine/localboard.cpp b/src/engine/local_engine/localboard.cpp index 92f75b40..bf5ba436 100755 --- a/src/engine/local_engine/localboard.cpp +++ b/src/engine/local_engine/localboard.cpp @@ -145,7 +145,7 @@ void LocalBoard::distributePot(unsigned dealerPosition) // determine the number of level winners winnerCount = potLevel.size()-2; if (!winnerCount) { - LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: no winner found"); + LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: no winner found"); } // check if this is the final pot level for at least one winner @@ -161,7 +161,7 @@ void LocalBoard::distributePot(unsigned dealerPosition) if(finalPot) break; } - if(finalPot && winnerCount>0) { + if(finalPot && winnerCount>0) { // distribute the pot level sum to level winners mod = (potLevel[1])%winnerCount; // pot level sum divisible by winnerCount @@ -175,13 +175,13 @@ void LocalBoard::distributePot(unsigned dealerPosition) } } if(it == seatsList->end()) { - LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: seat not found"); - } else { - (*it)->setMyCash( (*it)->getMyCash() + ((potLevel[1])/winnerCount)); - // filling winners vector - winners.push_back((*it)->getMyUniqueID()); - (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount ); - } + LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: seat not found"); + } else { + (*it)->setMyCash( (*it)->getMyCash() + ((potLevel[1])/winnerCount)); + // filling winners vector + winners.push_back((*it)->getMyUniqueID()); + (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount ); + } } } @@ -196,8 +196,8 @@ void LocalBoard::distributePot(unsigned dealerPosition) } } if(it == seatsList->end()) { - it = seatsList->begin(); - LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: dealer position not found"); + it = seatsList->begin(); + LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: dealer position not found"); } for(j=0; jsetMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount) + 1); - // filling winners vector - winners.push_back((*it)->getMyUniqueID()); - (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + ((potLevel[1])/winnerCount) + 1 ); - } else { - (*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount)); - // filling winners vector - winners.push_back((*it)->getMyUniqueID()); - (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount ); - } - } + if(winnerHit) { + if(jsetMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount) + 1); + // filling winners vector + winners.push_back((*it)->getMyUniqueID()); + (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + ((potLevel[1])/winnerCount) + 1 ); + } else { + (*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount)); + // filling winners vector + winners.push_back((*it)->getMyUniqueID()); + (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount ); + } + } } } potCarryOver = 0; diff --git a/src/engine/local_engine/localboard.h b/src/engine/local_engine/localboard.h index 47155432..2f586c58 100755 --- a/src/engine/local_engine/localboard.h +++ b/src/engine/local_engine/localboard.h @@ -45,7 +45,7 @@ class HandInterface; class LocalBoard : public BoardInterface { public: - LocalBoard(); + LocalBoard(); ~LocalBoard(); void setPlayerLists(PlayerList, PlayerList, PlayerList); @@ -82,7 +82,7 @@ public: void collectSets() ; void collectPot() ; - void distributePot(unsigned dealerPosition); + void distributePot(unsigned dealerPosition); void determinePlayerNeedToShowCards(); std::list getWinners() const { diff --git a/src/engine/local_engine/localenginefactory.cpp b/src/engine/local_engine/localenginefactory.cpp index a270f224..25d78f06 100644 --- a/src/engine/local_engine/localenginefactory.cpp +++ b/src/engine/local_engine/localenginefactory.cpp @@ -63,7 +63,7 @@ LocalEngineFactory::createHand(boost::shared_ptr f, GuiInterface boost::shared_ptr LocalEngineFactory::createBoard() { - return boost::shared_ptr(new LocalBoard()); + return boost::shared_ptr(new LocalBoard()); } boost::shared_ptr diff --git a/src/engine/local_engine/localenginefactory.h b/src/engine/local_engine/localenginefactory.h index e357a19d..ef7f347f 100644 --- a/src/engine/local_engine/localenginefactory.h +++ b/src/engine/local_engine/localenginefactory.h @@ -50,7 +50,7 @@ public: ~LocalEngineFactory(); virtual boost::shared_ptr createHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); - virtual boost::shared_ptr createBoard(); + virtual boost::shared_ptr createBoard(); virtual boost::shared_ptr createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB); virtual std::vector > createBeRo(HandInterface *hi, unsigned dP, int sB); diff --git a/src/engine/network_engine/clientboard.cpp b/src/engine/network_engine/clientboard.cpp index 2e797882..e00acd50 100644 --- a/src/engine/network_engine/clientboard.cpp +++ b/src/engine/network_engine/clientboard.cpp @@ -37,7 +37,7 @@ using namespace std; ClientBoard::ClientBoard() - : pot(0), sets(0), allInCondition(false), lastActionPlayerID(0) + : pot(0), sets(0), allInCondition(false), lastActionPlayerID(0) { myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0; } diff --git a/src/engine/network_engine/clientboard.h b/src/engine/network_engine/clientboard.h index a4b7dc12..66ed8774 100644 --- a/src/engine/network_engine/clientboard.h +++ b/src/engine/network_engine/clientboard.h @@ -44,7 +44,7 @@ class HandInterface; class ClientBoard : public BoardInterface { public: - ClientBoard(); + ClientBoard(); ~ClientBoard(); void setPlayerLists(PlayerList, PlayerList, PlayerList); @@ -63,7 +63,7 @@ public: void collectSets(); void collectPot(); - void distributePot(unsigned); + void distributePot(unsigned); void determinePlayerNeedToShowCards(); std::list getWinners() const; diff --git a/src/engine/network_engine/clientenginefactory.cpp b/src/engine/network_engine/clientenginefactory.cpp index 3bc581bc..b18a0f8c 100644 --- a/src/engine/network_engine/clientenginefactory.cpp +++ b/src/engine/network_engine/clientenginefactory.cpp @@ -57,7 +57,7 @@ ClientEngineFactory::createHand(boost::shared_ptr f, GuiInterface boost::shared_ptr ClientEngineFactory::createBoard() { - return boost::shared_ptr(new ClientBoard()); + return boost::shared_ptr(new ClientBoard()); } boost::shared_ptr diff --git a/src/engine/network_engine/clientenginefactory.h b/src/engine/network_engine/clientenginefactory.h index 8eb31e9f..c1564625 100644 --- a/src/engine/network_engine/clientenginefactory.h +++ b/src/engine/network_engine/clientenginefactory.h @@ -52,7 +52,7 @@ public: ~ClientEngineFactory(); virtual boost::shared_ptr createHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); - virtual boost::shared_ptr createBoard(); + virtual boost::shared_ptr createBoard(); virtual boost::shared_ptr createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB); virtual std::vector > createBeRo(HandInterface *hi, unsigned dP, int sB); }; diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 96da31a1..4e63dc5e 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -1689,8 +1689,7 @@ ServerLobbyThread::EstablishSession(boost::shared_ptr session) if (session->GetWebData()) { SessionError(session, ERR_NET_PLAYER_NAME_IN_USE); return; - } - else { + } else { // If this is not a websocket connection, disconnect the already connected player. InternalRemovePlayer(previousPlayerId, ERR_NET_PLAYER_NAME_IN_USE); }