Reformatting code using Kernighan & Ritchie style, tabs, tab width=4.

Command line: astyle --style=kr --indent=force-tab=4 --lineend=linux -n -r <file names>
This commit is contained in:
lotodore
2011-02-11 20:02:08 +00:00
parent 29dca1846e
commit 02518c67b2
232 changed files with 22743 additions and 21044 deletions
+3 -3
View File
@@ -20,9 +20,9 @@
#include "clientbero.h"
ClientBeRo::ClientBeRo(HandInterface* hi, int /*id*/, unsigned /*dP*/, int sB, GameState gS)
: BeRoInterface(), myBeRoID(gS), myHand(hi), highestCardsValue(0), smallBlindPositionId(0), bigBlindPositionId(0), currentPlayersTurnId(0),
firstRoundLastPlayersTurnId(0), highestSet(0), firstRound(true), smallBlindPosition(0), smallBlind(sB), minimumRaise(2*sB), fullBetRule(false),
lastActionPlayer(0)
: BeRoInterface(), myBeRoID(gS), myHand(hi), highestCardsValue(0), smallBlindPositionId(0), bigBlindPositionId(0), currentPlayersTurnId(0),
firstRoundLastPlayersTurnId(0), highestSet(0), firstRound(true), smallBlindPosition(0), smallBlind(sB), minimumRaise(2*sB), fullBetRule(false),
lastActionPlayer(0)
{
}
+5 -4
View File
@@ -28,7 +28,8 @@ class HandInterface;
/**
@author FThauer FHammer <webmaster@pokerth.net>
*/
class ClientBeRo : public BeRoInterface{
class ClientBeRo : public BeRoInterface
{
public:
ClientBeRo(HandInterface* hi, int id, unsigned dP, int sB, GameState gS);
~ClientBeRo();
@@ -38,8 +39,8 @@ public:
int getHighestCardsValue() const;
void setHighestCardsValue(int theValue);
void setLastActionPlayer ( unsigned theValue );
unsigned getLastActionPlayer() const;
void setLastActionPlayer ( unsigned theValue );
unsigned getLastActionPlayer() const;
void setSmallBlindPositionId(unsigned theValue);
unsigned getSmallBlindPositionId() const;
@@ -58,7 +59,7 @@ public:
void setLastPlayersTurnIt(PlayerListIterator theValue);
PlayerListIterator getLastPlayersTurnIt() const;
void setHighestSet(int theValue);
int getHighestSet() const;
+6 -6
View File
@@ -24,7 +24,7 @@
using namespace std;
ClientBoard::ClientBoard(unsigned dp)
: pot(0), sets(0), dealerPosition(dp), allInCondition(false), lastActionPlayer(0)
: pot(0), sets(0), dealerPosition(dp), allInCondition(false), lastActionPlayer(0)
{
myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0;
}
@@ -90,15 +90,15 @@ ClientBoard::setSets(int theValue)
void
ClientBoard::setAllInCondition(bool theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
allInCondition = theValue;
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
allInCondition = theValue;
}
void
ClientBoard::setLastActionPlayer(unsigned theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
lastActionPlayer = theValue;
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
lastActionPlayer = theValue;
}
void
@@ -116,7 +116,7 @@ void
ClientBoard::collectPot()
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
pot += sets;
pot += sets;
sets = 0;
}
+6 -6
View File
@@ -31,7 +31,7 @@ class HandInterface;
class ClientBoard : public BoardInterface
{
public:
ClientBoard(unsigned dealerPosition);
ClientBoard(unsigned dealerPosition);
~ClientBoard();
void setPlayerLists(PlayerList, PlayerList, PlayerList);
@@ -44,8 +44,8 @@ public:
int getSets() const;
void setSets(int theValue);
void setAllInCondition(bool theValue);
void setLastActionPlayer(unsigned theValue);
void setAllInCondition(bool theValue);
void setLastActionPlayer(unsigned theValue);
void collectSets();
void collectPot();
@@ -72,9 +72,9 @@ private:
int myCards[5];
int pot;
int sets;
unsigned dealerPosition;
bool allInCondition;
unsigned lastActionPlayer;
unsigned dealerPosition;
bool allInCondition;
unsigned lastActionPlayer;
};
#endif
+4 -4
View File
@@ -22,15 +22,15 @@
using namespace std;
ClientHand::ClientHand(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)
: myFactory(f), myGui(g), myBoard(b), myLog(l), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0),
smallBlind(sB), startCash(sC), lastPlayersTurn(-1), allInCondition(0),
cardsShown(false), bettingRoundsPlayed(0)
: myFactory(f), myGui(g), myBoard(b), myLog(l), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0),
smallBlind(sB), startCash(sC), lastPlayersTurn(-1), allInCondition(0),
cardsShown(false), bettingRoundsPlayed(0)
{
PlayerListIterator it;
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
(*it)->setHand(this);
// myFlipCards auf 0 setzen
// myFlipCards auf 0 setzen
(*it)->setMyCardsFlip(0, 0);
}
+63 -63
View File
@@ -32,97 +32,97 @@
class ClientHand : public HandInterface
{
public:
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, boost::shared_ptr<BoardInterface>, Log*, PlayerList, PlayerList, PlayerList , int, int, int, int, int );
~ClientHand();
public:
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, boost::shared_ptr<BoardInterface>, Log*, PlayerList, PlayerList, PlayerList , int, int, int, int, int );
~ClientHand();
void start();
void start();
PlayerList getSeatsList() const;
PlayerList getActivePlayerList() const;
PlayerList getRunningPlayerList() const;
PlayerList getSeatsList() const;
PlayerList getActivePlayerList() const;
PlayerList getRunningPlayerList() const;
boost::shared_ptr<BoardInterface> getBoard() const;
boost::shared_ptr<BeRoInterface> getPreflop() const;
boost::shared_ptr<BeRoInterface> getFlop() const;
boost::shared_ptr<BeRoInterface> getTurn() const;
boost::shared_ptr<BeRoInterface> getRiver() const;
GuiInterface* getGuiInterface() const;
boost::shared_ptr<BeRoInterface> getCurrentBeRo() const;
boost::shared_ptr<BoardInterface> getBoard() const;
boost::shared_ptr<BeRoInterface> getPreflop() const;
boost::shared_ptr<BeRoInterface> getFlop() const;
boost::shared_ptr<BeRoInterface> getTurn() const;
boost::shared_ptr<BeRoInterface> getRiver() const;
GuiInterface* getGuiInterface() const;
boost::shared_ptr<BeRoInterface> getCurrentBeRo() const;
void setMyID ( int theValue );
int getMyID() const;
void setMyID ( int theValue );
int getMyID() const;
void setCurrentQuantityPlayers ( int theValue );
int getCurrentQuantityPlayers() const;
void setCurrentQuantityPlayers ( int theValue );
int getCurrentQuantityPlayers() const;
void setStartQuantityPlayers ( int theValue );
int getStartQuantityPlayers() const;
void setStartQuantityPlayers ( int theValue );
int getStartQuantityPlayers() const;
void setCurrentRound ( int theValue );
int getCurrentRound() const;
void setCurrentRound ( int theValue );
int getCurrentRound() const;
void setDealerPosition ( int theValue );
int getDealerPosition() const;
void setDealerPosition ( int theValue );
int getDealerPosition() const;
void setSmallBlind ( int theValue );
int getSmallBlind() const;
void setSmallBlind ( int theValue );
int getSmallBlind() const;
void setAllInCondition ( bool theValue );
bool getAllInCondition() const;
void setAllInCondition ( bool theValue );
bool getAllInCondition() const;
void setStartCash ( int theValue );
int getStartCash() const;
void setStartCash ( int theValue );
int getStartCash() const;
void setBettingRoundsPlayed ( int theValue );
int getBettingRoundsPlayed() const;
void setBettingRoundsPlayed ( int theValue );
int getBettingRoundsPlayed() const;
void setLastPlayersTurn ( int theValue );
int getLastPlayersTurn() const;
void setLastPlayersTurn ( int theValue );
int getLastPlayersTurn() const;
void setLastActionPlayer ( unsigned theValue );
unsigned getLastActionPlayer() const;
void setLastActionPlayer ( unsigned theValue );
unsigned getLastActionPlayer() const;
void setCardsShown ( bool theValue );
bool getCardsShown() const;
void setCardsShown ( bool theValue );
bool getCardsShown() const;
void switchRounds();
void switchRounds();
protected:
PlayerListIterator getSeatIt(unsigned) const;
PlayerListIterator getActivePlayerIt(unsigned) const;
PlayerListIterator getRunningPlayerIt(unsigned) const;
PlayerListIterator getSeatIt(unsigned) const;
PlayerListIterator getActivePlayerIt(unsigned) const;
PlayerListIterator getRunningPlayerIt(unsigned) const;
private:
mutable boost::recursive_mutex m_syncMutex;
mutable boost::recursive_mutex m_syncMutex;
boost::shared_ptr<EngineFactory> myFactory;
GuiInterface *myGui;
boost::shared_ptr<BoardInterface> myBoard;
Log *myLog;
boost::shared_ptr<EngineFactory> myFactory;
GuiInterface *myGui;
boost::shared_ptr<BoardInterface> myBoard;
Log *myLog;
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
int myID;
int startQuantityPlayers;
unsigned dealerPosition;
int currentRound; //0 = preflop, 1 = flop, 2 = turn, 3 = river
int smallBlind;
int startCash;
int myID;
int startQuantityPlayers;
unsigned dealerPosition;
int currentRound; //0 = preflop, 1 = flop, 2 = turn, 3 = river
int smallBlind;
int startCash;
int lastPlayersTurn;
unsigned lastActionPlayer;
int lastPlayersTurn;
unsigned lastActionPlayer;
bool allInCondition;
bool cardsShown;
bool allInCondition;
bool cardsShown;
// hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ...
int bettingRoundsPlayed;
// hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ...
int bettingRoundsPlayed;
};
#endif
+19 -18
View File
@@ -23,10 +23,10 @@ using namespace std;
ClientPlayer::ClientPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
: PlayerInterface(), myConfig(c), currentHand(0), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type),
myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0),
myAction(0), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(true), myTurn(false), myCardsFlip(false), myRoundStartCash(0),
lastMoneyWon(0), sBluff(0), sBluffStatus(false), myWinnerState(false)
: PlayerInterface(), myConfig(c), currentHand(0), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type),
myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0),
myAction(0), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(true), myTurn(false), myCardsFlip(false), myRoundStartCash(0),
lastMoneyWon(0), sBluff(0), sBluffStatus(false), myWinnerState(false)
{
myBestHandPosition[0] = myBestHandPosition[1] = myBestHandPosition[2] = myBestHandPosition[3] = myBestHandPosition[4] = 0;
myNiveau[0] = myNiveau[1] = myNiveau[2] = 0;
@@ -266,13 +266,17 @@ ClientPlayer::setMyCardsFlip(bool theValue, int state)
// log flipping cards
if (myCardsFlip) {
switch(state) {
case 1: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1], myCardsValueInt);
case 1:
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1], myCardsValueInt);
break;
case 2: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1]);
case 2:
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1]);
break;
case 3: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1], myCardsValueInt, "has");
case 3:
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1], myCardsValueInt, "has");
break;
default: ;
default:
;
}
}
}
@@ -363,8 +367,7 @@ void
ClientPlayer::setMyAggressive(bool theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
for (int i=0; i<6; i++)
{
for (int i=0; i<6; i++) {
myAggressive[i] = myAggressive[i+1];
}
myAggressive[6] = theValue;
@@ -375,14 +378,13 @@ ClientPlayer::getMyAggressive() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
int sum = 0;
for (int i=0; i<7; i++)
{
for (int i=0; i<7; i++) {
sum += myAggressive[i];
}
return sum;
}
void
void
ClientPlayer::setSBluff(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
@@ -527,10 +529,9 @@ bool ClientPlayer::checkIfINeedToShowCards()
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
std::list<unsigned> playerNeedToShowCardsList = currentHand->getBoard()->getPlayerNeedToShowCards();
for(std::list<unsigned>::iterator it = playerNeedToShowCardsList.begin(); it != playerNeedToShowCardsList.end(); ++it)
{
if(*it == myUniqueID) return true;
}
for(std::list<unsigned>::iterator it = playerNeedToShowCardsList.begin(); it != playerNeedToShowCardsList.end(); ++it) {
if(*it == myUniqueID) return true;
}
return false;
return false;
}
+6 -3
View File
@@ -29,7 +29,8 @@ class CardsValue;
class ConfigFile;
class HandInterface;
class ClientPlayer : public PlayerInterface{
class ClientPlayer : public PlayerInterface
{
public:
ClientPlayer(ConfigFile*, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
~ClientPlayer();
@@ -134,7 +135,9 @@ public:
boost::shared_ptr<SessionData> getNetSessionData();
// unused as client
unsigned getActionTimeoutCounter() const {return 0;}
unsigned getActionTimeoutCounter() const {
return 0;
}
void incrementActionTimeoutCounter() {}
void resetActionTimeoutCounter() {}
@@ -171,7 +174,7 @@ private:
int myAction; // 0 = none, 1 = fold, 2 = check, 3 = call, 4 = bet, 5 = raise, 6 = allin
int myButton; // 0 = none, 1 = dealer, 2 =small, 3 = big
bool myActiveStatus; // 0 = inactive, 1 = active
bool myStayOnTableStatus; // 0 = left, 1 = stay
bool myStayOnTableStatus; // 0 = left, 1 = stay
bool myTurn; // 0 = no, 1 = yes
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
int myRoundStartCash;