run astyle

This commit is contained in:
floty
2014-03-16 21:46:52 +01:00
parent 2a78c06d03
commit b93525607e
14 changed files with 40 additions and 41 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ public:
virtual void collectSets() =0; virtual void collectSets() =0;
virtual void collectPot() =0; virtual void collectPot() =0;
virtual void distributePot(unsigned) =0; virtual void distributePot(unsigned) =0;
virtual void determinePlayerNeedToShowCards() =0; virtual void determinePlayerNeedToShowCards() =0;
virtual std::list<unsigned> getWinners() const =0; virtual std::list<unsigned> getWinners() const =0;
+1 -1
View File
@@ -45,7 +45,7 @@ public:
virtual ~EngineFactory(); virtual ~EngineFactory();
virtual boost::shared_ptr<HandInterface> createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost::shared_ptr<BoardInterface> b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) =0; virtual boost::shared_ptr<HandInterface> createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost::shared_ptr<BoardInterface> b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) =0;
virtual boost::shared_ptr<BoardInterface> createBoard() =0; virtual boost::shared_ptr<BoardInterface> createBoard() =0;
virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB) =0; virtual boost::shared_ptr<PlayerInterface> 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<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB) =0; virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB) =0;
}; };
+1 -1
View File
@@ -38,7 +38,7 @@
using namespace std; using namespace std;
LocalBeRo::LocalBeRo(HandInterface* hi, unsigned dP, int sB, GameState gS) 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(); currentPlayersTurnIt = myHand->getRunningPlayerList()->begin();
lastPlayersTurnIt = myHand->getRunningPlayerList()->begin(); lastPlayersTurnIt = myHand->getRunningPlayerList()->begin();
+2 -2
View File
@@ -81,7 +81,7 @@ protected:
return myHand; return myHand;
} }
unsigned getDealerPosition() const { unsigned getDealerPosition() const {
return dealerPosition; return dealerPosition;
} }
@@ -171,7 +171,7 @@ private:
HandInterface* myHand; HandInterface* myHand;
const GameState myBeRoID; const GameState myBeRoID;
unsigned dealerPosition; unsigned dealerPosition;
int smallBlindPosition; int smallBlindPosition;
unsigned smallBlindPositionId; unsigned smallBlindPositionId;
@@ -91,7 +91,7 @@ void LocalBeRoPostRiver::postRiverRun()
getMyHand()->getBoard()->determinePlayerNeedToShowCards(); getMyHand()->getBoard()->determinePlayerNeedToShowCards();
// Pot-Verteilung // Pot-Verteilung
getMyHand()->getBoard()->distributePot(getDealerPosition()); getMyHand()->getBoard()->distributePot(getDealerPosition());
//Pot auf 0 setzen //Pot auf 0 setzen
getMyHand()->getBoard()->setPot(0); getMyHand()->getBoard()->setPot(0);
+24 -24
View File
@@ -145,7 +145,7 @@ void LocalBoard::distributePot(unsigned dealerPosition)
// determine the number of level winners // determine the number of level winners
winnerCount = potLevel.size()-2; winnerCount = potLevel.size()-2;
if (!winnerCount) { 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 // 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) break;
} }
if(finalPot && winnerCount>0) { if(finalPot && winnerCount>0) {
// distribute the pot level sum to level winners // distribute the pot level sum to level winners
mod = (potLevel[1])%winnerCount; mod = (potLevel[1])%winnerCount;
// pot level sum divisible by winnerCount // pot level sum divisible by winnerCount
@@ -175,13 +175,13 @@ void LocalBoard::distributePot(unsigned dealerPosition)
} }
} }
if(it == seatsList->end()) { if(it == seatsList->end()) {
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: seat not found"); LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: seat not found");
} else { } else {
(*it)->setMyCash( (*it)->getMyCash() + ((potLevel[1])/winnerCount)); (*it)->setMyCash( (*it)->getMyCash() + ((potLevel[1])/winnerCount));
// filling winners vector // filling winners vector
winners.push_back((*it)->getMyUniqueID()); winners.push_back((*it)->getMyUniqueID());
(*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount ); (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount );
} }
} }
} }
@@ -196,8 +196,8 @@ void LocalBoard::distributePot(unsigned dealerPosition)
} }
} }
if(it == seatsList->end()) { if(it == seatsList->end()) {
it = seatsList->begin(); it = seatsList->begin();
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: dealer position not found"); LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: dealer position not found");
} }
for(j=0; j<winnerCount; j++) { for(j=0; j<winnerCount; j++) {
@@ -217,19 +217,19 @@ void LocalBoard::distributePot(unsigned dealerPosition)
} }
if(winnerHit) { if(winnerHit) {
if(j<mod) { if(j<mod) {
(*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount) + 1); (*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount) + 1);
// filling winners vector // filling winners vector
winners.push_back((*it)->getMyUniqueID()); winners.push_back((*it)->getMyUniqueID());
(*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + ((potLevel[1])/winnerCount) + 1 ); (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + ((potLevel[1])/winnerCount) + 1 );
} else { } else {
(*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount)); (*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount));
// filling winners vector // filling winners vector
winners.push_back((*it)->getMyUniqueID()); winners.push_back((*it)->getMyUniqueID());
(*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount ); (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount );
} }
} }
} }
} }
potCarryOver = 0; potCarryOver = 0;
+2 -2
View File
@@ -45,7 +45,7 @@ class HandInterface;
class LocalBoard : public BoardInterface class LocalBoard : public BoardInterface
{ {
public: public:
LocalBoard(); LocalBoard();
~LocalBoard(); ~LocalBoard();
void setPlayerLists(PlayerList, PlayerList, PlayerList); void setPlayerLists(PlayerList, PlayerList, PlayerList);
@@ -82,7 +82,7 @@ public:
void collectSets() ; void collectSets() ;
void collectPot() ; void collectPot() ;
void distributePot(unsigned dealerPosition); void distributePot(unsigned dealerPosition);
void determinePlayerNeedToShowCards(); void determinePlayerNeedToShowCards();
std::list<unsigned> getWinners() const { std::list<unsigned> getWinners() const {
@@ -63,7 +63,7 @@ LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface
boost::shared_ptr<BoardInterface> boost::shared_ptr<BoardInterface>
LocalEngineFactory::createBoard() LocalEngineFactory::createBoard()
{ {
return boost::shared_ptr<BoardInterface>(new LocalBoard()); return boost::shared_ptr<BoardInterface>(new LocalBoard());
} }
boost::shared_ptr<PlayerInterface> boost::shared_ptr<PlayerInterface>
+1 -1
View File
@@ -50,7 +50,7 @@ public:
~LocalEngineFactory(); ~LocalEngineFactory();
virtual boost::shared_ptr<HandInterface> createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost::shared_ptr<BoardInterface> b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); virtual boost::shared_ptr<HandInterface> createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost::shared_ptr<BoardInterface> b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
virtual boost::shared_ptr<BoardInterface> createBoard(); virtual boost::shared_ptr<BoardInterface> createBoard();
virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB); virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB);
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB); virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB);
+1 -1
View File
@@ -37,7 +37,7 @@
using namespace std; using namespace std;
ClientBoard::ClientBoard() 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; myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0;
} }
+2 -2
View File
@@ -44,7 +44,7 @@ class HandInterface;
class ClientBoard : public BoardInterface class ClientBoard : public BoardInterface
{ {
public: public:
ClientBoard(); ClientBoard();
~ClientBoard(); ~ClientBoard();
void setPlayerLists(PlayerList, PlayerList, PlayerList); void setPlayerLists(PlayerList, PlayerList, PlayerList);
@@ -63,7 +63,7 @@ public:
void collectSets(); void collectSets();
void collectPot(); void collectPot();
void distributePot(unsigned); void distributePot(unsigned);
void determinePlayerNeedToShowCards(); void determinePlayerNeedToShowCards();
std::list<unsigned> getWinners() const; std::list<unsigned> getWinners() const;
@@ -57,7 +57,7 @@ ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface
boost::shared_ptr<BoardInterface> boost::shared_ptr<BoardInterface>
ClientEngineFactory::createBoard() ClientEngineFactory::createBoard()
{ {
return boost::shared_ptr<BoardInterface>(new ClientBoard()); return boost::shared_ptr<BoardInterface>(new ClientBoard());
} }
boost::shared_ptr<PlayerInterface> boost::shared_ptr<PlayerInterface>
@@ -52,7 +52,7 @@ public:
~ClientEngineFactory(); ~ClientEngineFactory();
virtual boost::shared_ptr<HandInterface> createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost::shared_ptr<BoardInterface> b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); virtual boost::shared_ptr<HandInterface> createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost::shared_ptr<BoardInterface> b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
virtual boost::shared_ptr<BoardInterface> createBoard(); virtual boost::shared_ptr<BoardInterface> createBoard();
virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB); virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB);
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB); virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB);
}; };
+1 -2
View File
@@ -1689,8 +1689,7 @@ ServerLobbyThread::EstablishSession(boost::shared_ptr<SessionData> session)
if (session->GetWebData()) { if (session->GetWebData()) {
SessionError(session, ERR_NET_PLAYER_NAME_IN_USE); SessionError(session, ERR_NET_PLAYER_NAME_IN_USE);
return; return;
} } else {
else {
// If this is not a websocket connection, disconnect the already connected player. // If this is not a websocket connection, disconnect the already connected player.
InternalRemovePlayer(previousPlayerId, ERR_NET_PLAYER_NAME_IN_USE); InternalRemovePlayer(previousPlayerId, ERR_NET_PLAYER_NAME_IN_USE);
} }