run astyle

This commit is contained in:
Albert Medela
2017-08-16 13:55:18 +02:00
parent 94d87ed33e
commit 65e10c71b0
89 changed files with 888 additions and 488 deletions
+4 -2
View File
@@ -39,11 +39,13 @@ class BadWordCheck: public QObject
public:
BadWordCheck();
void setBadWords(QStringList bw) {
void setBadWords(QStringList bw)
{
badWords = bw;
}
void setBadWordsException(QStringList bwe) {
void setBadWordsException(QStringList bwe)
{
badWordsException = bwe;
}
+2 -1
View File
@@ -39,7 +39,8 @@ class CapsFloodCheck: public QObject
public:
CapsFloodCheck();
void setCapsNumberToTrigger(int n) {
void setCapsNumberToTrigger(int n)
{
capsNumberToTrigger = n;
}
bool run(QString);
+2 -1
View File
@@ -46,7 +46,8 @@ public:
~CleanerConfig();
std::string getConfigFileName() const {
std::string getConfigFileName() const
{
return configFileName;
}
+2 -1
View File
@@ -39,7 +39,8 @@ class LetterRepeatingCheck: public QObject
public:
LetterRepeatingCheck();
void setLetterNumberToTrigger(int n) {
void setLetterNumberToTrigger(int n)
{
letterNumberToTrigger = n;
}
bool run(QString);
+2 -1
View File
@@ -45,7 +45,8 @@ public:
TextFloodCheck();
~TextFloodCheck();
void setTextFloodLevelToTrigger(int level) {
void setTextFloodLevelToTrigger(int level)
{
textFloodLevelToTrigger = level;
}
+4 -2
View File
@@ -39,10 +39,12 @@ class UrlCheck: public QObject
public:
UrlCheck();
void setUrlStrings(QStringList us) {
void setUrlStrings(QStringList us)
{
urlStrings = us;
}
void setUrlExceptionStrings(QStringList ues) {
void setUrlExceptionStrings(QStringList ues)
{
urlExceptionStrings = ues;
}
bool run(QString);
+2 -1
View File
@@ -38,7 +38,8 @@ class ThreadStarter
{
public:
ThreadStarter(Thread &thread) : m_thread(thread) {}
void operator()() {
void operator()()
{
m_thread.MainWrapper();
}
+4 -2
View File
@@ -43,10 +43,12 @@ public:
PokerTHException(const char *sourcefile, int sourceline, int errorId, int osErrorCode);
virtual ~PokerTHException() throw();
int GetErrorId() const {
int GetErrorId() const
{
return m_errorId;
}
int GetOsErrorCode() const {
int GetOsErrorCode() const
{
return m_osErrorCode;
}
+4 -4
View File
@@ -482,9 +482,9 @@ ServerDBThread::EstablishDBConnection()
if (!prepareNick.exec() || !prepareAvatarBlacklist.exec() || !prepareLogin.exec() || !prepareCreateGame.exec()
|| !prepareEndGame.exec() || !prepareRelation.exec() || !prepareScore.exec() || !prepareReportAvatar.exec()
|| !prepareReportGame.exec() || !prepareAdminPlayer.exec() || !prepareBlockPlayer.exec()) {
string tmpError = string(prepareNick.error()) + prepareAvatarBlacklist.error() + prepareLogin.error() + prepareCreateGame.error() +
prepareEndGame.error() + prepareRelation.error() + prepareScore.error() + prepareReportAvatar.error() +
prepareReportGame.error() + prepareAdminPlayer.error() + prepareBlockPlayer.error();
string tmpError = string(prepareNick.error()) + prepareAvatarBlacklist.error() + prepareLogin.error() + prepareCreateGame.error() +
prepareEndGame.error() + prepareRelation.error() + prepareScore.error() + prepareReportAvatar.error() +
prepareReportGame.error() + prepareAdminPlayer.error() + prepareBlockPlayer.error();
m_connData->conn.disconnect();
m_ioService->post(boost::bind(&ServerDBCallback::ConnectFailed, &m_callback, tmpError));
m_permanentError = true;
@@ -537,7 +537,7 @@ ServerDBThread::HandleNextQuery()
++i;
}
if (!paramQuery.exec()) {
string tmpError = paramQuery.error();
string tmpError = paramQuery.error();
m_connData->conn.disconnect();
m_ioService->post(boost::bind(&ServerDBCallback::QueryError, &m_callback, tmpError));
break;
+1 -1
View File
@@ -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<unsigned> getWinners() const =0;
+1 -1
View File
@@ -45,7 +45,7 @@ public:
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<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 std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB) =0;
};
+1 -1
View File
@@ -77,7 +77,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
throw LocalException(__FILE__, __LINE__, ERR_DEALER_NOT_FOUND);
// create board
currentBoard = myFactory->createBoard();
currentBoard = myFactory->createBoard();
// create player lists
seatsList.reset(new std::list<boost::shared_ptr<PlayerInterface> >);
+32 -16
View File
@@ -63,60 +63,76 @@ public:
boost::shared_ptr<HandInterface> getCurrentHand();
const boost::shared_ptr<HandInterface> getCurrentHand() const;
PlayerList getSeatsList() const {
PlayerList getSeatsList() const
{
return seatsList;
}
PlayerList getActivePlayerList() const {
PlayerList getActivePlayerList() const
{
return activePlayerList;
}
PlayerList getRunningPlayerList() const {
PlayerList getRunningPlayerList() const
{
return runningPlayerList;
}
void setStartQuantityPlayers(int theValue) {
void setStartQuantityPlayers(int theValue)
{
startQuantityPlayers = theValue;
}
int getStartQuantityPlayers() const {
int getStartQuantityPlayers() const
{
return startQuantityPlayers;
}
void setStartSmallBlind(int theValue) {
void setStartSmallBlind(int theValue)
{
startSmallBlind = theValue;
}
int getStartSmallBlind() const {
int getStartSmallBlind() const
{
return startSmallBlind;
}
void setStartCash(int theValue) {
void setStartCash(int theValue)
{
startCash = theValue;
}
int getStartCash() const {
int getStartCash() const
{
return startCash;
}
int getMyGameID() const {
int getMyGameID() const
{
return myGameID;
}
void setCurrentSmallBlind(int theValue) {
void setCurrentSmallBlind(int theValue)
{
currentSmallBlind = theValue;
}
int getCurrentSmallBlind() const {
int getCurrentSmallBlind() const
{
return currentSmallBlind;
}
void setCurrentHandID(int theValue) {
void setCurrentHandID(int theValue)
{
currentHandID = theValue;
}
int getCurrentHandID() const {
int getCurrentHandID() const
{
return currentHandID;
}
unsigned getDealerPosition() const {
unsigned getDealerPosition() const
{
return dealerPosition;
}
void replaceDealer(unsigned oldDealer, unsigned newDealer) {
void replaceDealer(unsigned oldDealer, unsigned newDealer)
{
if (dealerPosition == oldDealer)
dealerPosition = newDealer;
}
+6 -6
View File
@@ -65,7 +65,7 @@ int CardsValue::holeCardsClass(int one, int two)
}
}
switch((one-1)%13+2) {
//Ass
//Ass
case 14: {
if((one-1)/13 == (two-1)/13) {
switch((one-1)%13-(two-1)%13) {
@@ -756,7 +756,7 @@ std::string CardsValue::determineHandName(int myCardsValueInt, PlayerList active
std::string handName;
switch(myCardsValueInt/100000000) {
// Royal Flush
// Royal Flush
case 9: {
handName = *cardStringIt_c;
@@ -1161,8 +1161,8 @@ std::string CardsValue::determineHandName(int myCardsValueInt, PlayerList active
}
}
break;
default:
{}
default: {
}
}
return handName;
@@ -1191,11 +1191,11 @@ std::list<std::string> CardsValue::translateCardsValueCode(int cardsValueCode)
switch (firstPart) {
// Royal Flush
// Royal Flush
case 9:
cardString.push_back("Royal Flush");
break;
// Straight Flush
// Straight Flush
case 8: {
cardString.push_back("Straight Flush, ");
switch(secondPart) {
+1 -1
View File
@@ -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();
+61 -31
View File
@@ -44,28 +44,34 @@ public:
LocalBeRo(HandInterface* hi, unsigned dP, int sB, GameState gS);
~LocalBeRo();
GameState getMyBeRoID() const {
GameState getMyBeRoID() const
{
return myBeRoID;
}
int getHighestCardsValue() const;
void setHighestCardsValue(int /*theValue*/) { }
void setMinimumRaise ( int theValue ) {
void setMinimumRaise ( int theValue )
{
minimumRaise = theValue;
}
int getMinimumRaise() const {
int getMinimumRaise() const
{
return minimumRaise;
}
void setFullBetRule ( bool theValue ) {
void setFullBetRule ( bool theValue )
{
fullBetRule = theValue;
}
bool getFullBetRule() const {
bool getFullBetRule() const
{
return fullBetRule;
}
void skipFirstRunGui() {
void skipFirstRunGui()
{
firstRunGui = false;
}
@@ -77,89 +83,113 @@ public:
protected:
HandInterface* getMyHand() const {
HandInterface* getMyHand() const
{
return myHand;
}
unsigned getDealerPosition() const {
unsigned getDealerPosition() const
{
return dealerPosition;
}
void setCurrentPlayersTurnId(unsigned theValue) {
void setCurrentPlayersTurnId(unsigned theValue)
{
currentPlayersTurnId = theValue;
}
unsigned getCurrentPlayersTurnId() const {
unsigned getCurrentPlayersTurnId() const
{
return currentPlayersTurnId;
}
void setFirstRoundLastPlayersTurnId(unsigned theValue) {
void setFirstRoundLastPlayersTurnId(unsigned theValue)
{
firstRoundLastPlayersTurnId = theValue;
}
unsigned getFirstRoundLastPlayersTurnId() const {
unsigned getFirstRoundLastPlayersTurnId() const
{
return firstRoundLastPlayersTurnId;
}
void setCurrentPlayersTurnIt(PlayerListIterator theValue) {
void setCurrentPlayersTurnIt(PlayerListIterator theValue)
{
currentPlayersTurnIt = theValue;
}
PlayerListIterator getCurrentPlayersTurnIt() const {
PlayerListIterator getCurrentPlayersTurnIt() const
{
return currentPlayersTurnIt;
}
void setLastPlayersTurnIt(PlayerListIterator theValue) {
void setLastPlayersTurnIt(PlayerListIterator theValue)
{
lastPlayersTurnIt = theValue;
}
PlayerListIterator getLastPlayersTurnIt() const {
PlayerListIterator getLastPlayersTurnIt() const
{
return lastPlayersTurnIt;
}
void setHighestSet(int theValue) {
void setHighestSet(int theValue)
{
highestSet = theValue;
}
int getHighestSet() const {
int getHighestSet() const
{
return highestSet;
}
void setFirstRun(bool theValue) {
void setFirstRun(bool theValue)
{
firstRun = theValue;
}
bool getFirstRun() const {
bool getFirstRun() const
{
return firstRun;
}
void setFirstRound(bool theValue) {
void setFirstRound(bool theValue)
{
firstRound = theValue;
}
bool getFirstRound() const {
bool getFirstRound() const
{
return firstRound;
}
void setSmallBlindPositionId(unsigned theValue) {
void setSmallBlindPositionId(unsigned theValue)
{
smallBlindPositionId = theValue;
}
unsigned getSmallBlindPositionId() const {
unsigned getSmallBlindPositionId() const
{
return smallBlindPositionId;
}
void setBigBlindPositionId(unsigned theValue) {
void setBigBlindPositionId(unsigned theValue)
{
bigBlindPositionId = theValue;
}
unsigned getBigBlindPositionId() const {
unsigned getBigBlindPositionId() const
{
return bigBlindPositionId;
}
void setSmallBlindPosition(int theValue) {
void setSmallBlindPosition(int theValue)
{
smallBlindPosition = theValue;
}
int getSmallBlindPosition() const {
int getSmallBlindPosition() const
{
return smallBlindPosition;
}
void setSmallBlind(int theValue) {
void setSmallBlind(int theValue)
{
smallBlind = theValue;
}
int getSmallBlind() const {
int getSmallBlind() const
{
return smallBlind;
}
@@ -171,7 +201,7 @@ private:
HandInterface* myHand;
const GameState myBeRoID;
unsigned dealerPosition;
unsigned dealerPosition;
int smallBlindPosition;
unsigned smallBlindPositionId;
@@ -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);
+4 -2
View File
@@ -44,10 +44,12 @@ public:
LocalBeRoPostRiver(HandInterface*, int, int);
~LocalBeRoPostRiver();
void setHighestCardsValue(int theValue) {
void setHighestCardsValue(int theValue)
{
highestCardsValue = theValue;
}
int getHighestCardsValue() const {
int getHighestCardsValue() const
{
return highestCardsValue;
}
+26 -14
View File
@@ -45,57 +45,69 @@ class HandInterface;
class LocalBoard : public BoardInterface
{
public:
LocalBoard();
LocalBoard();
~LocalBoard();
void setPlayerLists(PlayerList, PlayerList, PlayerList);
void setMyCards(int* theValue) {
void setMyCards(int* theValue)
{
int i;
for(i=0; i<5; i++) myCards[i] = theValue[i];
}
void getMyCards(int* theValue) {
void getMyCards(int* theValue)
{
int i;
for(i=0; i<5; i++) theValue[i] = myCards[i];
}
void setAllInCondition(bool theValue) {
void setAllInCondition(bool theValue)
{
allInCondition = theValue;
}
void setLastActionPlayerID(unsigned theValue) {
void setLastActionPlayerID(unsigned theValue)
{
lastActionPlayerID = theValue;
}
int getPot() const {
int getPot() const
{
return pot;
}
void setPot(int theValue) {
void setPot(int theValue)
{
pot = theValue;
}
int getSets() const {
int getSets() const
{
return sets;
}
void setSets(int theValue) {
void setSets(int theValue)
{
sets = theValue;
}
void collectSets() ;
void collectPot() ;
void distributePot(unsigned dealerPosition);
void distributePot(unsigned dealerPosition);
void determinePlayerNeedToShowCards();
std::list<unsigned> getWinners() const {
std::list<unsigned> getWinners() const
{
return winners;
}
void setWinners(const std::list<unsigned> &w) {
void setWinners(const std::list<unsigned> &w)
{
winners = w;
}
std::list<unsigned> getPlayerNeedToShowCards() const {
std::list<unsigned> getPlayerNeedToShowCards() const
{
return playerNeedToShowCards;
}
void setPlayerNeedToShowCards(const std::list<unsigned> &p) {
void setPlayerNeedToShowCards(const std::list<unsigned> &p)
{
playerNeedToShowCards = p;
}
@@ -63,7 +63,7 @@ LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface
boost::shared_ptr<BoardInterface>
LocalEngineFactory::createBoard()
{
return boost::shared_ptr<BoardInterface>(new LocalBoard());
return boost::shared_ptr<BoardInterface>(new LocalBoard());
}
boost::shared_ptr<PlayerInterface>
+1 -1
View File
@@ -50,7 +50,7 @@ public:
~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<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 std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB);
+4 -4
View File
@@ -362,8 +362,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
}
break;
default:
{}
default: {
}
}
@@ -696,8 +696,8 @@ void LocalHand::switchRounds()
myGui->postRiverAnimation1();
}
break;
default:
{}
default: {
}
}
+62 -31
View File
@@ -51,111 +51,142 @@ public:
void start();
PlayerList getSeatsList() const {
PlayerList getSeatsList() const
{
return seatsList;
}
PlayerList getActivePlayerList() const {
PlayerList getActivePlayerList() const
{
return activePlayerList;
}
PlayerList getRunningPlayerList() const {
PlayerList getRunningPlayerList() const
{
return runningPlayerList;
}
boost::shared_ptr<BoardInterface> getBoard() const {
boost::shared_ptr<BoardInterface> getBoard() const
{
return myBoard;
}
boost::shared_ptr<BeRoInterface> getPreflop() const {
boost::shared_ptr<BeRoInterface> getPreflop() const
{
return myBeRo[GAME_STATE_PREFLOP];
}
boost::shared_ptr<BeRoInterface> getFlop() const {
boost::shared_ptr<BeRoInterface> getFlop() const
{
return myBeRo[GAME_STATE_FLOP];
}
boost::shared_ptr<BeRoInterface> getTurn() const {
boost::shared_ptr<BeRoInterface> getTurn() const
{
return myBeRo[GAME_STATE_TURN];
}
boost::shared_ptr<BeRoInterface> getRiver() const {
boost::shared_ptr<BeRoInterface> getRiver() const
{
return myBeRo[GAME_STATE_RIVER];
}
GuiInterface* getGuiInterface() const {
GuiInterface* getGuiInterface() const
{
return myGui;
}
boost::shared_ptr<BeRoInterface> getCurrentBeRo() const {
boost::shared_ptr<BeRoInterface> getCurrentBeRo() const
{
return myBeRo[currentRound];
}
Log* getLog() const {
Log* getLog() const
{
return myLog;
}
void setMyID(int theValue) {
void setMyID(int theValue)
{
myID = theValue;
}
int getMyID() const {
int getMyID() const
{
return myID;
}
void setStartQuantityPlayers(int theValue) {
void setStartQuantityPlayers(int theValue)
{
startQuantityPlayers = theValue;
}
int getStartQuantityPlayers() const {
int getStartQuantityPlayers() const
{
return startQuantityPlayers;
}
void setCurrentRound(GameState theValue) {
void setCurrentRound(GameState theValue)
{
currentRound = theValue;
if(myLog) myLog->setCurrentRound(currentRound);
}
GameState getCurrentRound() const {
GameState getCurrentRound() const
{
return currentRound;
}
GameState getRoundBeforePostRiver() const {
GameState getRoundBeforePostRiver() const
{
return roundBeforePostRiver;
}
void setDealerPosition(int theValue) {
void setDealerPosition(int theValue)
{
dealerPosition = theValue;
}
int getDealerPosition() const {
int getDealerPosition() const
{
return dealerPosition;
}
void setSmallBlind(int theValue) {
void setSmallBlind(int theValue)
{
smallBlind = theValue;
}
int getSmallBlind() const {
int getSmallBlind() const
{
return smallBlind;
}
void setAllInCondition(bool theValue) {
void setAllInCondition(bool theValue)
{
allInCondition = theValue;
}
bool getAllInCondition() const {
bool getAllInCondition() const
{
return allInCondition;
}
void setStartCash(int theValue) {
void setStartCash(int theValue)
{
startCash = theValue;
}
int getStartCash() const {
int getStartCash() const
{
return startCash;
}
void setPreviousPlayerID(int theValue) {
void setPreviousPlayerID(int theValue)
{
previousPlayerID = theValue;
}
int getPreviousPlayerID() const {
int getPreviousPlayerID() const
{
return previousPlayerID;
}
void setLastActionPlayerID ( unsigned theValue );
unsigned getLastActionPlayerID() const {
unsigned getLastActionPlayerID() const
{
return lastActionPlayerID;
}
void setCardsShown(bool theValue) {
void setCardsShown(bool theValue)
{
cardsShown = theValue;
}
bool getCardsShown() const {
bool getCardsShown() const
{
return cardsShown;
}
+17 -17
View File
@@ -1066,8 +1066,8 @@ void LocalPlayer::action()
}
break;
default:
{}
default: {
}
}
// cout << currentHand->getCurrentBeRo()->getMinimumRaise() << endl;
@@ -1365,8 +1365,8 @@ void LocalPlayer::preflopEngine()
if(DEBUG_MODE) {
switch(myUniqueID) {
case 0:
{}
case 0: {
}
break;
case 1: {
// player 1
@@ -1494,8 +1494,8 @@ void LocalPlayer::preflopEngine()
// }
}
break;
default:
{}
default: {
}
}
@@ -1926,8 +1926,8 @@ void LocalPlayer::flopEngine()
myAction = PLAYER_ACTION_CHECK;
}
break;
default:
{}
default: {
}
}
@@ -2696,8 +2696,8 @@ void LocalPlayer::turnEngine()
}
break;
default:
{}
default: {
}
}
@@ -3206,8 +3206,8 @@ void LocalPlayer::riverEngine()
}
break;
default:
{}
default: {
}
}
@@ -3227,9 +3227,9 @@ void LocalPlayer::evaluation(int bet, int raise)
int highestSet = currentHand->getCurrentBeRo()->getHighestSet();
switch(myAction) {
// none
case 0:
{}
// none
case 0: {
}
break;
// fold
case 1: {
@@ -3337,8 +3337,8 @@ void LocalPlayer::evaluation(int bet, int raise)
case 6: {
}
break;
default:
{}
default: {
}
}
currentHand->getCurrentBeRo()->setHighestSet(highestSet);
+106 -53
View File
@@ -50,129 +50,163 @@ public:
void setHand(HandInterface *);
int getMyID() const {
int getMyID() const
{
return myID;
}
unsigned getMyUniqueID() const {
unsigned getMyUniqueID() const
{
return myUniqueID;
}
void setMyUniqueID(unsigned newId) {
void setMyUniqueID(unsigned newId)
{
myUniqueID = newId;
}
void setMyGuid(const std::string &theValue) {
void setMyGuid(const std::string &theValue)
{
myGuid = theValue;
}
std::string getMyGuid() const {
std::string getMyGuid() const
{
return myGuid;
}
PlayerType getMyType() const {
PlayerType getMyType() const
{
return myType;
}
void setMyDude(int theValue) {
void setMyDude(int theValue)
{
myDude = theValue;
}
int getMyDude() const {
int getMyDude() const
{
return myDude;
}
void setMyDude4(int theValue) {
void setMyDude4(int theValue)
{
myDude4 = theValue;
}
int getMyDude4() const {
int getMyDude4() const
{
return myDude4;
}
void setMyName(const std::string& theValue) {
void setMyName(const std::string& theValue)
{
myName = theValue;
}
std::string getMyName() const {
std::string getMyName() const
{
return myName;
}
void setMyAvatar(const std::string& theValue) {
void setMyAvatar(const std::string& theValue)
{
myAvatar = theValue;
}
std::string getMyAvatar() const {
std::string getMyAvatar() const
{
return myAvatar;
}
void setMyCash(int theValue) {
void setMyCash(int theValue)
{
myCash = theValue;
}
int getMyCash() const {
int getMyCash() const
{
return myCash;
}
void setMySet(int theValue) {
void setMySet(int theValue)
{
myLastRelativeSet = theValue;
mySet += theValue;
myCash -= theValue;
}
void setMySetAbsolute(int theValue) {
void setMySetAbsolute(int theValue)
{
mySet = theValue;
}
void setMySetNull() {
void setMySetNull()
{
mySet = 0;
myLastRelativeSet = 0;
}
int getMySet() const {
int getMySet() const
{
return mySet;
}
int getMyLastRelativeSet() const {
int getMyLastRelativeSet() const
{
return myLastRelativeSet;
}
void setMyAction(PlayerAction theValue, bool human = 0) {
void setMyAction(PlayerAction theValue, bool human = 0)
{
myAction = theValue;
// logging for seat 0
if(myAction && human) currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, myLastRelativeSet);
}
PlayerAction getMyAction() const {
PlayerAction getMyAction() const
{
return myAction;
}
void setMyButton(int theValue) {
void setMyButton(int theValue)
{
myButton = theValue;
}
int getMyButton() const {
int getMyButton() const
{
return myButton;
}
void setMyActiveStatus(bool theValue) {
void setMyActiveStatus(bool theValue)
{
myActiveStatus = theValue;
}
bool getMyActiveStatus() const {
bool getMyActiveStatus() const
{
return myActiveStatus;
}
void setMyStayOnTableStatus(bool theValue) {
void setMyStayOnTableStatus(bool theValue)
{
myStayOnTableStatus = theValue;
}
bool getMyStayOnTableStatus() const {
bool getMyStayOnTableStatus() const
{
return myStayOnTableStatus;
}
void setMyCards(int* theValue) {
void setMyCards(int* theValue)
{
int i;
for(i=0; i<2; i++) myCards[i] = theValue[i];
}
void getMyCards(int* theValue) const {
void getMyCards(int* theValue) const
{
int i;
for(i=0; i<2; i++) theValue[i] = myCards[i];
}
void setMyTurn(bool theValue) {
void setMyTurn(bool theValue)
{
myTurn = theValue;
}
bool getMyTurn() const {
bool getMyTurn() const
{
return myTurn;
}
void setMyCardsFlip(bool theValue, int state) {
void setMyCardsFlip(bool theValue, int state)
{
myCardsFlip = theValue;
// log flipping cards
if(myCardsFlip) {
@@ -191,66 +225,81 @@ public:
}
}
}
bool getMyCardsFlip() const {
bool getMyCardsFlip() const
{
return myCardsFlip;
}
void setMyCardsValueInt(int theValue) {
void setMyCardsValueInt(int theValue)
{
myCardsValueInt = theValue;
}
int getMyCardsValueInt() const {
int getMyCardsValueInt() const
{
return myCardsValueInt;
}
void setLogHoleCardsDone(bool theValue) {
void setLogHoleCardsDone(bool theValue)
{
logHoleCardsDone = theValue;
}
bool getLogHoleCardsDone() const {
bool getLogHoleCardsDone() const
{
return logHoleCardsDone;
}
void setMyBestHandPosition(int* theValue) {
void setMyBestHandPosition(int* theValue)
{
for (int i = 0; i < 5; i++)
myBestHandPosition[i] = theValue[i];
}
void getMyBestHandPosition(int* theValue) const {
void getMyBestHandPosition(int* theValue) const
{
for (int i = 0; i < 5; i++)
theValue[i] = myBestHandPosition[i];
}
void setMyRoundStartCash(int theValue) {
void setMyRoundStartCash(int theValue)
{
myRoundStartCash = theValue;
}
int getMyRoundStartCash() const {
int getMyRoundStartCash() const
{
return myRoundStartCash;
}
void setLastMoneyWon ( int theValue ) {
void setLastMoneyWon ( int theValue )
{
lastMoneyWon = theValue;
}
int getLastMoneyWon() const {
int getLastMoneyWon() const
{
return lastMoneyWon;
}
void setMyAverageSets(int theValue) {
void setMyAverageSets(int theValue)
{
myAverageSets[0] = myAverageSets[1];
myAverageSets[1] = myAverageSets[2];
myAverageSets[2] = myAverageSets[3];
myAverageSets[3] = theValue;
}
int getMyAverageSets() const {
int getMyAverageSets() const
{
return (myAverageSets[0]+myAverageSets[1]+myAverageSets[2]+myAverageSets[3])/4;
}
void setMyAggressive(bool theValue) {
void setMyAggressive(bool theValue)
{
int i;
for(i=0; i<6; i++) {
myAggressive[i] = myAggressive[i+1];
}
myAggressive[6] = theValue;
}
int getMyAggressive() const {
int getMyAggressive() const
{
int i, sum = 0;
for(i=0; i<7; i++) {
sum += myAggressive[i];
@@ -258,17 +307,21 @@ public:
return sum;
}
void setSBluff ( int theValue ) {
void setSBluff ( int theValue )
{
sBluff = theValue;
}
int getSBluff() const {
int getSBluff() const
{
return sBluff;
}
void setSBluffStatus ( bool theValue ) {
void setSBluffStatus ( bool theValue )
{
sBluffStatus = theValue;
}
bool getSBluffStatus() const {
bool getSBluffStatus() const
{
return sBluffStatus;
}
+2 -1
View File
@@ -51,7 +51,8 @@ boost::thread_specific_ptr<boost::random_device> g_rand_state;
struct nondet_rng : std::unary_function<unsigned, unsigned> {
boost::random_device &_state;
unsigned operator()(unsigned i) {
unsigned operator()(unsigned i)
{
boost::uniform_int<> rng(0, i - 1);
return rng(_state);
}
+2 -1
View File
@@ -50,7 +50,8 @@ boost::thread_specific_ptr<boost::mt19937> g_rand_state;
struct det_rng : std::unary_function<unsigned, unsigned> {
boost::mt19937 &_state;
unsigned operator()(unsigned i) {
unsigned operator()(unsigned i)
{
boost::uniform_int<> rng(0, i - 1);
return rng(_state);
}
+4 -2
View File
@@ -66,11 +66,13 @@ public:
void logAfterGame();
// void closeLogDbAtExit();
void setCurrentRound(GameState theValue) {
void setCurrentRound(GameState theValue)
{
currentRound = theValue;
}
std::string getMySqliteLogFileName() {
std::string getMySqliteLogFileName()
{
return mySqliteLogFileName.directory_string();
}
+1 -1
View File
@@ -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;
}
+2 -2
View File
@@ -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<unsigned> getWinners() const;
@@ -57,7 +57,7 @@ ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface
boost::shared_ptr<BoardInterface>
ClientEngineFactory::createBoard()
{
return boost::shared_ptr<BoardInterface>(new ClientBoard());
return boost::shared_ptr<BoardInterface>(new ClientBoard());
}
boost::shared_ptr<PlayerInterface>
@@ -52,7 +52,7 @@ public:
~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<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 std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB);
};
+2 -1
View File
@@ -63,7 +63,8 @@ public:
GuiInterface* getGuiInterface() const;
boost::shared_ptr<BeRoInterface> getCurrentBeRo() const;
Log* getLog() const {
Log* getLog() const
{
return myLog;
}
+2 -1
View File
@@ -156,7 +156,8 @@ public:
bool checkIfINeedToShowCards();
void markRemoteAction() {}
unsigned getTimeSecSinceLastRemoteAction() const {
unsigned getTimeSecSinceLastRemoteAction() const
{
return 0;
}
+4 -2
View File
@@ -48,10 +48,12 @@ public:
boost::shared_ptr<Session> getSession();
void setSession(boost::shared_ptr<Session> session);
gameTableImpl* getMyW() const {
gameTableImpl* getMyW() const
{
return NULL;
}
guiLog* getMyGuiLog() const {
guiLog* getMyGuiLog() const
{
return NULL;
}
@@ -52,7 +52,8 @@ public:
bool eventFilter(QObject *obj, QEvent *event);
public slots:
bool getSettingsCorrect() const {
bool getSettingsCorrect() const
{
return settingsCorrect;
}
+12 -6
View File
@@ -55,7 +55,8 @@ public:
~ChatTools();
void setSession(boost::shared_ptr<Session> session) {
void setSession(boost::shared_ptr<Session> session)
{
mySession = session;
}
@@ -69,24 +70,29 @@ public slots:
void fillChatLinesHistory(QString fillString);
void showChatHistoryIndex(int index);
int getChatLinesHistorySize() {
int getChatLinesHistorySize()
{
return chatLinesHistory.size();
}
void nickAutoCompletition();
void setChatTextEdited();
void setPlayerNicksList(QStringList value) {
void setPlayerNicksList(QStringList value)
{
myNickStringList = value;
}
void setMyNick ( const QString& theValue ) {
void setMyNick ( const QString& theValue )
{
myNick = theValue;
}
QString getMyNick () {
QString getMyNick ()
{
return myNick;
}
void setMyStyle ( GameTableStyleReader* theValue ) {
void setMyStyle ( GameTableStyleReader* theValue )
{
myStyle = theValue;
}
void refreshIgnoreList();
@@ -51,7 +51,8 @@ public:
createInternetGameDialogImpl(QWidget *parent = 0, ConfigFile *c = 0);
void exec(bool guestMode, QString playerName);
changeCompleteBlindsDialogImpl* getChangeCompleteBlindsDialog() {
changeCompleteBlindsDialogImpl* getChangeCompleteBlindsDialog()
{
return myChangeCompleteBlindsDialog;
}
bool eventFilter(QObject *obj, QEvent *event);
@@ -52,7 +52,8 @@ public:
createNetworkGameDialogImpl(QWidget *parent = 0, ConfigFile *c = 0);
int exec();
changeCompleteBlindsDialogImpl* getChangeCompleteBlindsDialog() {
changeCompleteBlindsDialogImpl* getChangeCompleteBlindsDialog()
{
return myChangeCompleteBlindsDialog;
}
bool eventFilter(QObject *obj, QEvent *event);
@@ -66,17 +66,20 @@ public:
int exec();
ChatTools *getMyChat() {
ChatTools *getMyChat()
{
return myChat;
}
void setSession(boost::shared_ptr<Session> session);
boost::shared_ptr<Session> getSession() {
boost::shared_ptr<Session> getSession()
{
assert(mySession.get());
return mySession;
}
void setMyW ( gameTableImpl* theValue ) {
void setMyW ( gameTableImpl* theValue )
{
myW = theValue;
}
@@ -97,13 +100,16 @@ public slots:
void updateStats(ServerStats stats);
void refreshGameStats();
void refreshPlayerStats();
void setCurrentGameName ( const QString& theValue ) {
void setCurrentGameName ( const QString& theValue )
{
currentGameName = theValue;
}
QString getCurrentGameName() const {
QString getCurrentGameName() const
{
return currentGameName;
}
gameTableImpl* getMyW() const {
gameTableImpl* getMyW() const
{
return myW;
}
void checkPlayerQuantity();
@@ -39,19 +39,24 @@ class MyGameListSortFilterProxyModel : public QSortFilterProxyModel
public:
MyGameListSortFilterProxyModel(QObject *parent = 0);
void setColumn1RegExp(QRegExp column1) {
void setColumn1RegExp(QRegExp column1)
{
column1RegExp = column1;
}
void setColumn2RegExp(QRegExp column2) {
void setColumn2RegExp(QRegExp column2)
{
column2RegExp = column2;
}
void setColumn3RegExp(QRegExp column3) {
void setColumn3RegExp(QRegExp column3)
{
column3RegExp = column3;
}
void setColumn4RegExp(QRegExp column4) {
void setColumn4RegExp(QRegExp column4)
{
column4RegExp = column4;
}
void setColumn5RegExp(QRegExp column5) {
void setColumn5RegExp(QRegExp column5)
{
column5RegExp = column5;
}
@@ -41,10 +41,12 @@ public:
MyNickListSortFilterProxyModel(QObject *parent = 0);
void setFilterState(int state);
void setLastFilterStateCountry( bool country ) {
void setLastFilterStateCountry( bool country )
{
lastFilterStateCountry = country;
}
void setLastFilterStateAlpha( bool alpha ) {
void setLastFilterStateAlpha( bool alpha )
{
lastFilterStateAlpha = alpha;
}
+9 -9
View File
@@ -113,12 +113,12 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
tabsDiag = new QDialog(this);
tabs.setupUi(tabsDiag);
textLabel_handLabel->hide();
#ifdef ANDROID
tabsDiag->setStyleSheet("QObject { font: 26px; } QDialog { background-image: url(:/android/android-data/gfx/gui/table/default_800x480/table_dark.png); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
this->setWindowState(Qt::WindowFullScreen);
#else
tabs.pushButton_settings->hide();
#endif
#ifdef ANDROID
tabsDiag->setStyleSheet("QObject { font: 26px; } QDialog { background-image: url(:/android/android-data/gfx/gui/table/default_800x480/table_dark.png); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
this->setWindowState(Qt::WindowFullScreen);
#else
tabs.pushButton_settings->hide();
#endif
tabs.label_chance->setMyStyle(myGameTableStyle);
#else
label_chance->setMyStyle(myGameTableStyle);
@@ -1290,7 +1290,7 @@ void gameTableImpl::refreshGroupbox(int playerID, int status)
} else {
switch(status) {
//inactive
//inactive
case 0: {
if (!playerID) {
//hide buttons
@@ -1325,8 +1325,8 @@ void gameTableImpl::refreshGroupbox(int playerID, int status)
myGameTableStyle->setPlayerSeatInactiveStyle(groupBoxArray[playerID]);
}
break;
default:
{}
default: {
}
}
}
}
+16 -8
View File
@@ -87,26 +87,33 @@ public:
boost::shared_ptr<Session> getSession();
SoundEvents* getMySoundEventHandler() const {
SoundEvents* getMySoundEventHandler() const
{
return mySoundEventHandler;
}
ChatTools* getMyChat() const {
ChatTools* getMyChat() const
{
return myChat;
}
ConfigFile* getMyConfig() const {
ConfigFile* getMyConfig() const
{
return myConfig;
}
GameTableStyleReader* getMyGameTableStyle() const {
GameTableStyleReader* getMyGameTableStyle() const
{
return myGameTableStyle;
}
bool getGuestMode() const {
bool getGuestMode() const
{
return guestMode;
}
void setStartWindow(startWindowImpl* s) {
void setStartWindow(startWindowImpl* s)
{
myStartWindow = s;
}
void setGuiLog(guiLog* l) {
void setGuiLog(guiLog* l)
{
myGuiLog = l;
}
@@ -211,7 +218,8 @@ public slots:
void startTimeoutAnimation(int playerId, int timoutSec);
void stopTimeoutAnimation(int playerId);
void setGameSpeed(const int theValue) {
void setGameSpeed(const int theValue)
{
guiGameSpeed = theValue; // Achtung Faktor 10!!!
setSpeeds();
}
+4 -2
View File
@@ -94,10 +94,12 @@ public:
void writeLogFileStream(QString string);
void setMySqliteLogFileName(std::string theValue) {
void setMySqliteLogFileName(std::string theValue)
{
mySqliteLogFileName = theValue;
}
std::string getMySqliteLogFileName() {
std::string getMySqliteLogFileName()
{
return mySqliteLogFileName;
}
+3 -3
View File
@@ -76,7 +76,7 @@ bool MyActionButton::event(QEvent *event)
void MyActionButton::click()
{
if (!eatMyEvents) {
QPushButton::click();
}
if (!eatMyEvents) {
QPushButton::click();
}
}
+7 -4
View File
@@ -47,21 +47,24 @@ public:
~MyActionButton();
void paintEvent(QPaintEvent * event);
void setFKeyText ( const QString& theValue ) {
void setFKeyText ( const QString& theValue )
{
fKeyText = theValue;
}
void setMyStyle ( GameTableStyleReader* theValue ) {
void setMyStyle ( GameTableStyleReader* theValue )
{
myStyle = theValue;
}
void setEatMyEvents(bool e) {
void setEatMyEvents(bool e)
{
eatMyEvents = e;
}
bool event(QEvent *e);
public slots:
void click();
void click();
private:
+10 -5
View File
@@ -49,13 +49,16 @@ public:
MyAvatarLabel(QGroupBox*);
~MyAvatarLabel();
void setMyW(gameTableImpl* theValue) {
void setMyW(gameTableImpl* theValue)
{
myW = theValue;
}
void setMyId ( int theValue ) {
void setMyId ( int theValue )
{
myId = theValue;
}
void setMyUniqueId ( int theValue ) {
void setMyUniqueId ( int theValue )
{
myUniqueId = theValue;
}
void contextMenuEvent ( QContextMenuEvent * event );
@@ -68,12 +71,14 @@ public slots:
void sendTriggerVoteOnKickSignal();
void setEnabledContextMenu(bool);
void setVoteOnKickContextMenuEnabled(bool);
void setVoteRunning ( bool theValue ) {
void setVoteRunning ( bool theValue )
{
voteRunning = theValue;
}
void setPixmap ( const QPixmap &, const bool = false);
void setPixmapAndCountry ( const QPixmap &, QString country, int seatPlace, const bool = false);
void setPixmapPath ( const QString theValue) {
void setPixmapPath ( const QString theValue)
{
myPath = theValue;
}
void paintEvent(QPaintEvent*);
+12 -6
View File
@@ -49,21 +49,26 @@ public:
~MyCardsPixmapLabel();
void setMyW ( gameTableImpl* theValue ) {
void setMyW ( gameTableImpl* theValue )
{
myW = theValue;
}
void setIsFlipside(bool theValue) {
void setIsFlipside(bool theValue)
{
isFlipside = theValue;
}
bool getIsFlipside() const {
bool getIsFlipside() const
{
return isFlipside;
}
void setFadeOutAction(bool theValue) {
void setFadeOutAction(bool theValue)
{
fadeOutAction = theValue;
}
bool getFadeOutAction() const {
bool getFadeOutAction() const
{
return fadeOutAction;
}
@@ -72,7 +77,8 @@ public:
void startFlipCards(int, const QPixmap & , const QPixmap &);
void stopFlipCardsAnimation();
void setFlipsidePix(QPixmap p) {
void setFlipsidePix(QPixmap p)
{
flipside = p;
}
+2 -1
View File
@@ -48,7 +48,8 @@ public:
MyCashLabel(QGroupBox*);
~MyCashLabel();
void setMyW(gameTableImpl* theValue) {
void setMyW(gameTableImpl* theValue)
{
myW = theValue;
}
+4 -2
View File
@@ -50,10 +50,12 @@ public:
~MyChanceLabel();
void setMyW ( gameTableImpl* theValue ) {
void setMyW ( gameTableImpl* theValue )
{
myW = theValue;
}
void setMyStyle ( GameTableStyleReader* theValue ) {
void setMyStyle ( GameTableStyleReader* theValue )
{
myStyle = theValue;
}
void paintEvent(QPaintEvent * event);
+2 -1
View File
@@ -56,7 +56,8 @@ public slots:
void blinkChatTab();
QTabBar* getMyTabBar() const {
QTabBar* getMyTabBar() const
{
return myTabBar;
}
+3 -3
View File
@@ -92,15 +92,15 @@ void MyNameLabel::setText ( const QString &t, bool trans, bool guest, bool compu
} else {
linkString = QString("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(t));
}
// truncate nicknames longer than 13 characters
QString t2 = t;
if(t2.size() > 13){
if(t2.size() > 13) {
int chop = t.size() - 13 + 3;
t2.chop(chop);
t2.append("...");
}
QString tTruncated;
if(trans) {
+2 -1
View File
@@ -48,7 +48,8 @@ public:
MyNameLabel(QGroupBox*);
~MyNameLabel();
void setMyW(gameTableImpl* theValue) {
void setMyW(gameTableImpl* theValue)
{
myW = theValue;
}
+2 -1
View File
@@ -48,7 +48,8 @@ public:
void paintEvent(QPaintEvent * event);
QTabBar* getMyTabBar() const {
QTabBar* getMyTabBar() const
{
return myTabBar;
}
+2 -1
View File
@@ -50,7 +50,8 @@ public:
~MySetLabel();
void setMyW ( gameTableImpl* theValue ) {
void setMyW ( gameTableImpl* theValue )
{
myW = theValue;
}
void paintEvent(QPaintEvent * event);
+10 -5
View File
@@ -48,15 +48,18 @@ class Slider : public QSlider
public:
Slider( QWidget* parent = 0 )
: QSlider( parent ) {
: QSlider( parent )
{
}
Slider( Qt::Orientation orientation, QWidget* parent = 0 )
: QSlider( orientation, parent ) {
: QSlider( orientation, parent )
{
}
protected:
int pixelPosToRangeValue(int pos) const { // getted from QSlider.cpp with little adapt
int pixelPosToRangeValue(int pos) const // getted from QSlider.cpp with little adapt
{
QStyleOptionSlider opt;
initStyleOption(&opt);
QRect gr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, this);
@@ -76,11 +79,13 @@ protected:
sliderMax - sliderMin, opt.upsideDown);
}
int pick(const QPoint &pt) const { // getted from QSlider.cpp with little adapt
int pick(const QPoint &pt) const // getted from QSlider.cpp with little adapt
{
return orientation() == Qt::Horizontal ? pt.x() : pt.y();
}
virtual void mousePressEvent( QMouseEvent* ev ) { // getted from QSlider.cpp with little adapt
virtual void mousePressEvent( QMouseEvent* ev ) // getted from QSlider.cpp with little adapt
{
if (maximum() == minimum() || (ev->buttons() ^ ev->button())) {
ev->ignore();
return;
+2 -1
View File
@@ -50,7 +50,8 @@ public:
~MyStatusLabel();
void setMyW ( gameTableImpl* theValue ) {
void setMyW ( gameTableImpl* theValue )
{
myW = theValue;
}
+2 -1
View File
@@ -53,7 +53,8 @@ public:
~MyTimeoutLabel();
void setMyW ( gameTableImpl* theValue ) {
void setMyW ( gameTableImpl* theValue )
{
myW = theValue;
}
+4 -2
View File
@@ -54,10 +54,12 @@ public:
boost::shared_ptr<Session> getSession();
void setSession(boost::shared_ptr<Session> session);
gameTableImpl* getMyW() const {
gameTableImpl* getMyW() const
{
return myW;
}
guiLog* getMyGuiLog() const {
guiLog* getMyGuiLog() const
{
return myGuiLog;
}
@@ -54,7 +54,8 @@ public slots:
void regUserToggled(bool);
void guestUserToggled(bool);
void okButtonCheck();
void clickLoginButton() {
void clickLoginButton()
{
pushButton_login->click();
}
+6 -3
View File
@@ -58,7 +58,8 @@ public:
explicit LogFileDialog(QWidget *parent = 0, ConfigFile *c = 0);
~LogFileDialog();
void setGuiLog(guiLog *g) {
void setGuiLog(guiLog *g)
{
myGuiLog = g;
}
int exec();
@@ -76,10 +77,12 @@ public slots:
void exportLogToHtml();
void exportLogToTxt();
void saveLogFileAs();
void showLogFilePreviewInit() {
void showLogFilePreviewInit()
{
showLogFilePreview(INIT_VIEW);
}
void showLogFilePreviewSelected() {
void showLogFilePreviewSelected()
{
showLogFilePreview(SELECTED_GAME);
}
void showLogFilePreview(ShowLogMode);
@@ -53,7 +53,8 @@ public:
newGameDialogImpl(QMainWindow *parent = 0, ConfigFile* = 0);
int exec();
changeCompleteBlindsDialogImpl* getChangeCompleteBlindsDialog() {
changeCompleteBlindsDialogImpl* getChangeCompleteBlindsDialog()
{
return myChangeCompleteBlindsDialog;
}
@@ -52,7 +52,8 @@ public:
public slots:
bool getSettingsCorrect() const {
bool getSettingsCorrect() const
{
return settingsCorrect;
}
+4 -2
View File
@@ -44,10 +44,12 @@ public:
~MyAvatarButton();
void setMyLink(QString theValue) {
void setMyLink(QString theValue)
{
myLink = theValue;
}
QString getMyLink() const {
QString getMyLink() const
{
return myLink;
}
+4 -2
View File
@@ -44,10 +44,12 @@ public:
~MyHPAvatarButton();
void setMyLink(QString theValue) {
void setMyLink(QString theValue)
{
myLink = theValue;
}
QString getMyLink() const {
QString getMyLink() const
{
return myLink;
}
@@ -44,10 +44,12 @@ public:
~MyAvatarListItem();
void setMyLink(QString theValue) {
void setMyLink(QString theValue)
{
myLink = theValue;
}
QString getMyLink() const {
QString getMyLink() const
{
return myLink;
}
@@ -63,7 +63,8 @@ public slots:
QString getAvatarLink();
void setExternalAvatar();
bool getSettingsCorrect() const {
bool getSettingsCorrect() const
{
return settingsCorrect;
}
+12 -6
View File
@@ -67,25 +67,30 @@ public:
void prepareDialog();
void exec(bool ingame);
void setPlayerNickIsChanged(bool theValue) {
void setPlayerNickIsChanged(bool theValue)
{
playerNickIsChanged = theValue;
}
bool getPlayerNickIsChanged() const {
bool getPlayerNickIsChanged() const
{
return playerNickIsChanged;
}
bool getSettingsCorrect() const {
bool getSettingsCorrect() const
{
return settingsCorrect;
}
void setGuiLog(guiLog* l) {
void setGuiLog(guiLog* l)
{
myGuiLog = l;
}
public slots:
void isAccepted();
void playerNickChanged() {
void playerNickChanged()
{
setPlayerNickIsChanged(true);
};
void setFlipsidePicFileName();
@@ -104,7 +109,8 @@ public slots:
void callManualBlindsOrderDialog();
void callNetManualBlindsOrderDialog();
void callSelectAvatarDialog() {
void callSelectAvatarDialog()
{
mySelectAvatarDialogImpl->exec();
}
@@ -56,10 +56,12 @@ public:
public slots:
void setMyW ( gameTableImpl* theValue ) {
void setMyW ( gameTableImpl* theValue )
{
myW = theValue;
}
ChatTools *getMyChat() {
ChatTools *getMyChat()
{
return myChat;
}
@@ -84,11 +86,13 @@ public slots:
void keyPressEvent ( QKeyEvent*);
bool eventFilter(QObject *obj, QEvent *event);
void setMaxPlayerNumber ( int theValue ) {
void setMaxPlayerNumber ( int theValue )
{
maxPlayerNumber = theValue;
label_maxPlayerNumber->setText(QString::number(theValue,10));
}
int getMaxPlayerNumber() const {
int getMaxPlayerNumber() const
{
return maxPlayerNumber;
}
+6 -6
View File
@@ -775,9 +775,9 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
}
break;
case ERR_SOCK_CONNECT_IPV6_FAILED: {
MyMessageBox::warning(this, tr("Network Error"),
tr("Could not connect to the server.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
QMessageBox::Close);
MyMessageBox::warning(this, tr("Network Error"),
tr("Could not connect to the server.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
QMessageBox::Close);
}
break;
case ERR_SOCK_CONNECT_TIMEOUT: {
@@ -787,9 +787,9 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
}
break;
case ERR_SOCK_CONNECT_IPV6_TIMEOUT: {
MyMessageBox::warning(this, tr("Network Error"),
tr("Connection timed out.\nPlease check the server address.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
QMessageBox::Close);
MyMessageBox::warning(this, tr("Network Error"),
tr("Connection timed out.\nPlease check the server address.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
QMessageBox::Close);
}
break;
case ERR_SOCK_SELECT_FAILED: {
+10 -5
View File
@@ -76,21 +76,26 @@ public:
startWindowImpl(ConfigFile *c, Log *l);
~startWindowImpl();
void setSession(boost::shared_ptr<Session> session) {
void setSession(boost::shared_ptr<Session> session)
{
mySession = session;
}
boost::shared_ptr<Session> getSession() {
boost::shared_ptr<Session> getSession()
{
assert(mySession.get());
return mySession;
}
boost::shared_ptr< GuiInterface > getMyServerGuiInterface() const {
boost::shared_ptr< GuiInterface > getMyServerGuiInterface() const
{
return myServerGuiInterface;
}
connectToServerDialogImpl* getMyConnectToServerDialog() const {
connectToServerDialogImpl* getMyConnectToServerDialog() const
{
return myConnectToServerDialog;
}
void setGuiLog(guiLog* l) {
void setGuiLog(guiLog* l)
{
myGuiLog = l;
}
+22 -11
View File
@@ -56,42 +56,53 @@ public:
void readStyleFile(QString);
QString getStyleDescription() const {
QString getStyleDescription() const
{
return StyleDescription;
}
QString getStyleMaintainerName() const {
QString getStyleMaintainerName() const
{
return StyleMaintainerName;
}
QString getStyleMaintainerEMail() const {
QString getStyleMaintainerEMail() const
{
return StyleMaintainerEMail;
}
QString getStyleCreateDate() const {
QString getStyleCreateDate() const
{
return StyleCreateDate;
}
QString getCurrentFileName() const {
QString getCurrentFileName() const
{
return currentFileName;
}
QString getCurrentDir() const {
QString getCurrentDir() const
{
return currentDir;
}
QString getPreview() const {
QString getPreview() const
{
return Preview;
}
QString getBigIndexesActionBottom() const {
QString getBigIndexesActionBottom() const
{
return BigIndexesActionBottom;
}
bool getFallBack() const {
bool getFallBack() const
{
return fallBack;
}
bool getLoadedSuccessfull() const {
bool getLoadedSuccessfull() const
{
return loadedSuccessfull;
}
CdStyleState getState() const {
CdStyleState getState() const
{
return myState;
}
+3 -3
View File
@@ -1422,7 +1422,7 @@ void GameTableStyleReader::setMenuBarStyle(QMenuBar *mb)
void GameTableStyleReader::setBreakButtonStyle(QPushButton *bb, int state)
{
switch(state) {
// default
// default
case 0:
#ifdef GUI_800x480
bb->setStyleSheet("QPushButton:enabled { padding: 10px; background-color: #"+BreakLobbyButtonBgColor+"; color: #"+BreakLobbyButtonTextColor+"; font-size: 26px} QPushButton:disabled { padding: 10px; background-color: #"+BreakLobbyButtonBgDisabledColor+"; color: #"+BreakLobbyButtonTextDisabledColor+"; font-weight: 900; font-size: 26px}");
@@ -1430,7 +1430,7 @@ void GameTableStyleReader::setBreakButtonStyle(QPushButton *bb, int state)
bb->setStyleSheet("QPushButton:enabled { background-color: #"+BreakLobbyButtonBgColor+"; color: #"+BreakLobbyButtonTextColor+";} QPushButton:disabled { background-color: #"+BreakLobbyButtonBgDisabledColor+"; color: #"+BreakLobbyButtonTextDisabledColor+"; font-weight: 900;}");
#endif
break;
// blink
// blink
case 1:
#ifdef GUI_800x480
bb->setStyleSheet("QPushButton { padding: 10px; background-color: #"+BreakLobbyButtonBgBlinkColor+"; color: "+BreakLobbyButtonTextBlinkColor+"; font-size: 26px}");
@@ -1558,7 +1558,7 @@ void GameTableStyleReader::setButtonsStyle(MyActionButton *br, MyActionButton *c
a->setMyStyle(this);
switch(state) {
//default
//default
case 0: {
br->setStyleSheet("QPushButton { border:none; background-repeat: no-repeat; background-position: center center; background-image: url(\""+BetRaiseButtonDefault+"\"); "+ font2String +" font-size: "+humanPlayerButtonFontSize+"px; font-weight: bold; color: #"+BetRaiseButtonTextColor+";} QPushButton:unchecked { background-repeat: no-repeat; background-position: center center; background-image: url(\""+BetRaiseButtonDefault+"\"); } QPushButton:checked { background-repeat: no-repeat; background-position: center center; background-image: url(\""+BetRaiseButtonChecked+"\");} QPushButton:hover { background-repeat: no-repeat; background-position: center center; background-image: url(\""+BetRaiseButtonHover+"\"); } QPushButton:checked:hover { background-repeat: no-repeat; background-position: center center; background-image: url(\""+BetRaiseButtonCheckedHover+"\");}");
+110 -55
View File
@@ -66,136 +66,176 @@ public:
void showItemPicsLeftErrorMessage();
void showOutdatedErrorMessage();
QString getStyleDescription() const {
QString getStyleDescription() const
{
return StyleDescription;
}
QString getStyleMaintainerName() const {
QString getStyleMaintainerName() const
{
return StyleMaintainerName;
}
QString getStyleMaintainerEMail() const {
QString getStyleMaintainerEMail() const
{
return StyleMaintainerEMail;
}
QString getStyleCreateDate() const {
QString getStyleCreateDate() const
{
return StyleCreateDate;
}
QString getCurrentFileName() const {
QString getCurrentFileName() const
{
return currentFileName;
}
QString getPreview() const {
QString getPreview() const
{
return Preview;
}
QString getDefaultAvatar() const {
QString getDefaultAvatar() const
{
return DefaultAvatar;
}
QString getDealerPuck() const {
QString getDealerPuck() const
{
return DealerPuck;
}
QString getSmallBlindPuck() const {
QString getSmallBlindPuck() const
{
return SmallBlindPuck;
}
QString getBigBlindPuck() const {
QString getBigBlindPuck() const
{
return BigBlindPuck;
}
QString getHandRanking() const {
QString getHandRanking() const
{
return HandRanking;
}
QString getTable() const {
QString getTable() const
{
return Table;
}
QString getActionPic(int);
QString getFKeyIndicatorColor() const {
QString getFKeyIndicatorColor() const
{
return FKeyIndicatorColor;
}
QString getChanceLabelImpossibleColor() const {
QString getChanceLabelImpossibleColor() const
{
return ChanceLabelImpossibleColor;
}
QString getChanceLabelPossibleColor() const {
QString getChanceLabelPossibleColor() const
{
return ChanceLabelPossibleColor;
}
QString getChatLogTextColor() const {
QString getChatLogTextColor() const
{
return ChatLogTextColor;
}
QString getChatTextNickNotifyColor() const {
QString getChatTextNickNotifyColor() const
{
return ChatTextNickNotifyColor;
}
QString getLogWinnerMainPotColor() const {
QString getLogWinnerMainPotColor() const
{
return LogWinnerMainPotColor;
}
QString getLogWinnerSidePotColor() const {
QString getLogWinnerSidePotColor() const
{
return LogWinnerSidePotColor;
}
QString getLogPlayerSitsOutColor() const {
QString getLogPlayerSitsOutColor() const
{
return LogPlayerSitsOutColor;
}
QString getLogNewGameAdminColor() const {
QString getLogNewGameAdminColor() const
{
return LogNewGameAdminColor;
}
QString getBreakLobbyButtonBgColor() const {
QString getBreakLobbyButtonBgColor() const
{
return BreakLobbyButtonBgColor;
}
QString getRatingStarsColor() const {
QString getRatingStarsColor() const
{
return RatingStarsColor;
}
QString getPlayerInfoHintTextColor() const {
QString getPlayerInfoHintTextColor() const
{
return PlayerInfoHintTextColor;
}
QString getPlayerNickTextColor() const {
QString getPlayerNickTextColor() const
{
return PlayerNickTextColor;
}
QString getPlayerCashTextColor() const {
QString getPlayerCashTextColor() const
{
return PlayerCashTextColor;
}
QString getPlayerNameLabelFontSize() const {
QString getPlayerNameLabelFontSize() const
{
return playerNameLabelFontSize;
}
QString getPlayerCashLabelFontSize() const {
QString getPlayerCashLabelFontSize() const
{
return cashFontSize;
}
QString getFont2String() const {
QString getFont2String() const
{
return font2String;
}
QString getFont1String() const {
QString getFont1String() const
{
return font1String;
}
QString getMinimumWindowWidth() const {
QString getMinimumWindowWidth() const
{
return MinimumWindowWidth;
}
QString getMinimumWindowHeight() const {
QString getMinimumWindowHeight() const
{
return MinimumWindowHeight;
}
QString getMaximumWindowWidth() const {
QString getMaximumWindowWidth() const
{
return MaximumWindowWidth;
}
QString getMaximumWindowHeight() const {
QString getMaximumWindowHeight() const
{
return MaximumWindowHeight;
}
QString getFixedWindowWidth() const {
QString getFixedWindowWidth() const
{
return FixedWindowWidth;
}
QString getFixedWindowHeight() const {
QString getFixedWindowHeight() const
{
return FixedWindowHeight;
}
QString getIfFixedWindowSize() const {
QString getIfFixedWindowSize() const
{
return IfFixedWindowSize;
}
bool getFallBack() const {
bool getFallBack() const
{
return fallBack;
}
bool getLoadedSuccessfull() const {
bool getLoadedSuccessfull() const
{
return loadedSuccessfull;
}
GtStyleState getState() const {
GtStyleState getState() const
{
return myState;
}
@@ -231,49 +271,64 @@ public:
void setShowMyCardsButtonStyle( MyActionButton *sc);
void setAwayRadioButtonsStyle(QRadioButton*);
QString getActionAllInI18NString() const {
QString getActionAllInI18NString() const
{
return ActionAllInI18NString;
}
QString getActionRaiseI18NString() const {
QString getActionRaiseI18NString() const
{
return ActionRaiseI18NString;
}
QString getActionBetI18NString() const {
QString getActionBetI18NString() const
{
return ActionBetI18NString;
}
QString getActionCallI18NString() const {
QString getActionCallI18NString() const
{
return ActionCallI18NString;
}
QString getActionCheckI18NString() const {
QString getActionCheckI18NString() const
{
return ActionCheckI18NString;
}
QString getActionFoldI18NString() const {
QString getActionFoldI18NString() const
{
return ActionFoldI18NString;
}
QString getRiverI18NString() const {
QString getRiverI18NString() const
{
return RiverI18NString;
}
QString getTurnI18NString() const {
QString getTurnI18NString() const
{
return TurnI18NString;
}
QString getFlopI18NString() const {
QString getFlopI18NString() const
{
return FlopI18NString;
}
QString getPreflopI18NString() const {
QString getPreflopI18NString() const
{
return PreflopI18NString;
}
QString getHandI18NString() const {
QString getHandI18NString() const
{
return HandI18NString;
}
QString getGameI18NString() const {
QString getGameI18NString() const
{
return GameI18NString;
}
QString getBetsI18NString() const {
QString getBetsI18NString() const
{
return BetsI18NString;
}
QString getTotalI18NString() const {
QString getTotalI18NString() const
{
return TotalI18NString;
}
QString getPotI18NString() const {
QString getPotI18NString() const
{
return PotI18NString;
}
+6 -3
View File
@@ -61,13 +61,16 @@ public slots:
void timerRefresh();
void stopTimeout();
void setMySession ( boost::shared_ptr<Session> theValue ) {
void setMySession ( boost::shared_ptr<Session> theValue )
{
mySession = theValue;
}
void setMsgID ( NetTimeoutReason theValue ) {
void setMsgID ( NetTimeoutReason theValue )
{
msgID = theValue;
}
void setTimeoutDuration ( int theValue ) {
void setTimeoutDuration ( int theValue )
{
timeoutDuration = theValue;
}
+8 -4
View File
@@ -47,16 +47,19 @@ public:
AsioSendBuffer();
virtual ~AsioSendBuffer();
inline size_t GetSendBufLeft() const {
inline size_t GetSendBufLeft() const
{
int bytesLeft = (int)(sendBufAllocated - sendBufUsed);
return bytesLeft < 0 ? (size_t)0 : (size_t)bytesLeft;
}
inline size_t GetAllocated() const {
inline size_t GetAllocated() const
{
return sendBufAllocated;
}
inline bool ReallocSendBuf() {
inline bool ReallocSendBuf()
{
bool retVal = false;
size_t allocAmount = sendBufAllocated * 2;
if (0 == allocAmount) {
@@ -73,7 +76,8 @@ public:
return retVal;
}
inline void AppendToSendBufWithoutCheck(const char *data, size_t size) {
inline void AppendToSendBufWithoutCheck(const char *data, size_t size)
{
std::memcpy(sendBuf + sendBufUsed, data, size);
sendBufUsed += size;
}
+60 -30
View File
@@ -49,96 +49,126 @@ public:
void SetSessionData(boost::shared_ptr<SessionData> sessionData);
boost::shared_ptr<boost::asio::ip::tcp::resolver> GetResolver() const;
void SetResolver(boost::shared_ptr<boost::asio::ip::tcp::resolver> resolver);
bool GetSctp() const {
bool GetSctp() const
{
return m_sctp;
}
void SetSctp(bool sctp) {
void SetSctp(bool sctp)
{
m_sctp = sctp;
}
int GetAddrFamily() const {
int GetAddrFamily() const
{
return m_addrFamily;
}
void SetAddrFamily(int addrFamily) {
void SetAddrFamily(int addrFamily)
{
m_addrFamily = addrFamily;
}
const std::string &GetServerAddr() const {
const std::string &GetServerAddr() const
{
return m_serverAddr;
}
void SetServerAddr(const std::string &serverAddr) {
void SetServerAddr(const std::string &serverAddr)
{
m_serverAddr = serverAddr;
}
const std::string &GetServerPassword() const {
const std::string &GetServerPassword() const
{
return m_serverPassword;
}
void SetServerPassword(const std::string &serverPassword) {
void SetServerPassword(const std::string &serverPassword)
{
m_serverPassword = serverPassword;
}
const std::string &GetServerListUrl() const {
const std::string &GetServerListUrl() const
{
return m_serverListUrl;
}
void SetServerListUrl(const std::string &serverListUrl) {
void SetServerListUrl(const std::string &serverListUrl)
{
m_serverListUrl = serverListUrl;
}
bool GetUseServerList() const {
bool GetUseServerList() const
{
return m_useServerList;
}
void SetUseServerList(bool use) {
void SetUseServerList(bool use)
{
m_useServerList = use;
}
unsigned GetServerPort() const {
unsigned GetServerPort() const
{
return m_serverPort;
}
void SetServerPort(unsigned serverPort) {
void SetServerPort(unsigned serverPort)
{
m_serverPort = serverPort;
}
const std::string &GetAvatarServerAddr() const {
const std::string &GetAvatarServerAddr() const
{
return m_avatarServerAddr;
}
void SetAvatarServerAddr(const std::string &avatarServerAddr) {
void SetAvatarServerAddr(const std::string &avatarServerAddr)
{
m_avatarServerAddr = avatarServerAddr;
}
const std::string &GetPassword() const {
const std::string &GetPassword() const
{
return m_password;
}
void SetPassword(const std::string &password) {
void SetPassword(const std::string &password)
{
m_password = password;
}
const std::string &GetPlayerName() const {
const std::string &GetPlayerName() const
{
return m_playerName;
}
void SetPlayerName(const std::string &playerName) {
void SetPlayerName(const std::string &playerName)
{
m_playerName = playerName;
}
PlayerRights GetPlayerRights() const {
PlayerRights GetPlayerRights() const
{
return m_playerRights;
}
void SetPlayerRights(PlayerRights rights) {
void SetPlayerRights(PlayerRights rights)
{
m_playerRights = rights;
}
const std::string &GetAvatarFile() const {
const std::string &GetAvatarFile() const
{
return m_avatarFile;
}
void SetAvatarFile(const std::string &avatarFile) {
void SetAvatarFile(const std::string &avatarFile)
{
m_avatarFile = avatarFile;
}
const std::string &GetCacheDir() const {
const std::string &GetCacheDir() const
{
return m_cacheDir;
}
void SetCacheDir(const std::string &cacheDir) {
void SetCacheDir(const std::string &cacheDir)
{
m_cacheDir = cacheDir;
}
bool GetSubscribeLobbyMsg() const {
bool GetSubscribeLobbyMsg() const
{
return m_hasSubscribedLobbyMsg;
}
void SetSubscribeLobbyMsg(bool setSubscribe) {
void SetSubscribeLobbyMsg(bool setSubscribe)
{
m_hasSubscribedLobbyMsg = setSubscribe;
}
const std::string &GetSessionGuid() const {
const std::string &GetSessionGuid() const
{
return m_sessionGuid;
}
void SetSessionGuid(const std::string &sessionGuid) {
void SetSessionGuid(const std::string &sessionGuid)
{
m_sessionGuid = sessionGuid;
}
+10 -5
View File
@@ -66,19 +66,24 @@ class PingData
public:
PingData() : pingTimer(boost::posix_time::time_duration(0, 0, 0), boost::timers::portable::microsec_timer::manual_start) {}
unsigned MinPing() {
unsigned MinPing()
{
return *std::min_element(pingValues.begin(), pingValues.end());
}
unsigned MaxPing() {
unsigned MaxPing()
{
return *std::max_element(pingValues.begin(), pingValues.end());
}
unsigned AveragePing() {
unsigned AveragePing()
{
return pingValues.empty() ? 0 : (std::accumulate(pingValues.begin(), pingValues.end(), 0) / (unsigned)pingValues.size());
}
void StartPing() {
void StartPing()
{
pingTimer.start();
}
bool EndPing() {
bool EndPing()
{
bool retVal = false;
if (pingTimer.is_running()) {
pingValues.push_back((unsigned)pingTimer.elapsed().total_milliseconds());
+1 -2
View File
@@ -535,8 +535,7 @@ ClientStateStartConnect::TimerTimeout(const boost::system::error_code& ec, boost
client->GetContext().GetSessionData()->GetAsioSocket()->close(ec);
if (client->GetContext().GetAddrFamily() == AF_INET6) {
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_IPV6_TIMEOUT, 0);
}
else {
} else {
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_TIMEOUT, 0);
}
}
+1 -2
View File
@@ -1175,8 +1175,7 @@ void
ServerGame::AddPlayerToNumJoinsPerPlayer(const std::string &playerName)
{
NumJoinsPerPlayerMap::iterator pos = m_numJoinsPerPlayer.find(playerName);
if (pos != m_numJoinsPerPlayer.end())
{
if (pos != m_numJoinsPerPlayer.end()) {
pos->second++;
} else {
m_numJoinsPerPlayer[playerName] = 1;
+56 -32
View File
@@ -107,35 +107,43 @@ public:
InternalServerCallback(ServerLobbyThread &server) : m_server(server) {}
virtual ~InternalServerCallback() {}
virtual void CloseSession(boost::shared_ptr<SessionData> session) {
virtual void CloseSession(boost::shared_ptr<SessionData> session)
{
m_server.CloseSession(session);
}
virtual void SessionError(boost::shared_ptr<SessionData> session, int errorCode) {
virtual void SessionError(boost::shared_ptr<SessionData> session, int errorCode)
{
m_server.SessionError(session, errorCode);
}
virtual void SessionTimeoutWarning(boost::shared_ptr<SessionData> session, unsigned remainingSec) {
virtual void SessionTimeoutWarning(boost::shared_ptr<SessionData> session, unsigned remainingSec)
{
m_server.SessionTimeoutWarning(session, remainingSec);
}
virtual void HandlePacket(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet) {
virtual void HandlePacket(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet)
{
m_server.DispatchPacket(session, packet);
}
virtual void SignalChatBotMessage(const string &msg) {
virtual void SignalChatBotMessage(const string &msg)
{
m_server.SendChatBotMsg(msg);
}
virtual void SignalChatBotMessage(unsigned gameId, const std::string &msg) {
virtual void SignalChatBotMessage(unsigned gameId, const std::string &msg)
{
m_server.SendChatBotMsg(gameId, msg);
}
virtual void SignalKickPlayer(unsigned playerId) {
virtual void SignalKickPlayer(unsigned playerId)
{
m_server.RemovePlayer(playerId, ERR_NET_PLAYER_KICKED);
}
virtual void SignalBanPlayer(unsigned playerId) {
virtual void SignalBanPlayer(unsigned playerId)
{
string playerName(m_server.GetPlayerNameFromId(playerId));
if (!playerName.empty()) {
m_server.GetBanManager().BanPlayerName(playerName, 1);
@@ -143,76 +151,94 @@ public:
}
}
virtual void SignalMutePlayer(unsigned playerId) {
virtual void SignalMutePlayer(unsigned playerId)
{
m_server.MutePlayerInGame(playerId);
}
virtual void ConnectSuccess() {
virtual void ConnectSuccess()
{
LOG_MSG("Successfully connected to database.");
}
virtual void ConnectFailed(string error) {
virtual void ConnectFailed(string error)
{
LOG_ERROR("DB connect error: " << error);
}
virtual void QueryError(string error) {
virtual void QueryError(string error)
{
LOG_ERROR("DB query error: " << error);
}
virtual void PlayerLoginSuccess(unsigned requestId, boost::shared_ptr<DBPlayerData> dbPlayerData) {
virtual void PlayerLoginSuccess(unsigned requestId, boost::shared_ptr<DBPlayerData> dbPlayerData)
{
m_server.UserValid(requestId, *dbPlayerData);
}
virtual void PlayerLoginFailed(unsigned requestId) {
virtual void PlayerLoginFailed(unsigned requestId)
{
m_server.UserInvalid(requestId);
}
virtual void PlayerLoginBlocked(unsigned requestId) {
virtual void PlayerLoginBlocked(unsigned requestId)
{
m_server.UserBlocked(requestId);
}
virtual void AvatarIsBlacklisted(unsigned requestId) {
virtual void AvatarIsBlacklisted(unsigned requestId)
{
m_server.AvatarBlacklisted(requestId);
}
virtual void AvatarIsOK(unsigned requestId) {
virtual void AvatarIsOK(unsigned requestId)
{
m_server.AvatarOK(requestId);
}
virtual void CreateGameSuccess(unsigned /*requestId*/) {
virtual void CreateGameSuccess(unsigned /*requestId*/)
{
// Nothing to do.
}
virtual void CreateGameFailed(unsigned requestId) {
virtual void CreateGameFailed(unsigned requestId)
{
// TODO maybe handle request id.
LOG_ERROR("DB create game failed for request " << requestId);
}
virtual void ReportAvatarSuccess(unsigned requestId, unsigned replyId) {
virtual void ReportAvatarSuccess(unsigned requestId, unsigned replyId)
{
m_server.SendReportAvatarResult(requestId, replyId, true);
}
virtual void ReportAvatarFailed(unsigned requestId, unsigned replyId) {
virtual void ReportAvatarFailed(unsigned requestId, unsigned replyId)
{
m_server.SendReportAvatarResult(requestId, replyId, false);
}
virtual void ReportGameSuccess(unsigned requestId, unsigned replyId) {
virtual void ReportGameSuccess(unsigned requestId, unsigned replyId)
{
m_server.SendReportGameResult(requestId, replyId, true);
}
virtual void ReportGameFailed(unsigned requestId, unsigned replyId) {
virtual void ReportGameFailed(unsigned requestId, unsigned replyId)
{
m_server.SendReportGameResult(requestId, replyId, false);
}
virtual void PlayerAdminList(unsigned /*requestId*/, std::list<DB_id> adminList) {
virtual void PlayerAdminList(unsigned /*requestId*/, std::list<DB_id> adminList)
{
m_server.GetBanManager().SetAdminPlayerIds(adminList);
}
virtual void BlockPlayerSuccess(unsigned requestId, unsigned replyId) {
virtual void BlockPlayerSuccess(unsigned requestId, unsigned replyId)
{
m_server.SendAdminBanPlayerResult(requestId, replyId, true);
}
virtual void BlockPlayerFailed(unsigned requestId, unsigned replyId) {
virtual void BlockPlayerFailed(unsigned requestId, unsigned replyId)
{
m_server.SendAdminBanPlayerResult(requestId, replyId, false);
}
@@ -975,9 +1001,8 @@ ServerLobbyThread::HandlePacket(boost::shared_ptr<SessionData> session, boost::s
HandleNetPacketRetrievePlayerInfo(session, packet->GetMsg()->playerinforequestmessage());
else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_AvatarRequestMessage)
HandleNetPacketRetrieveAvatar(session, packet->GetMsg()->avatarrequestmessage());
else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_ResetTimeoutMessage)
{}
else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_SubscriptionRequestMessage) {
else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_ResetTimeoutMessage) {
} else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_SubscriptionRequestMessage) {
const SubscriptionRequestMessage &subscriptionRequest = packet->GetMsg()->subscriptionrequestmessage();
if (subscriptionRequest.subscriptionaction() == SubscriptionRequestMessage::resubscribeGameList)
InternalResubscribeMsg(session);
@@ -1068,7 +1093,7 @@ ServerLobbyThread::HandleNetPacketInit(boost::shared_ptr<SessionData> session, c
// check if a guest session in lobby with same ip is already connected and
// if number of lobby guests >= SERVER_MAX_GUEST_USERS_LOBBY
if(m_serverConfig.readConfigInt("ServerRestrictGuestLogin") != 0
&& !m_sessionManager.IsGuestAllowedToConnect(session->GetClientAddr())) {
&& !m_sessionManager.IsGuestAllowedToConnect(session->GetClientAddr())) {
SessionError(session, ERR_NET_SERVER_FULL);
return;
}
@@ -1706,8 +1731,7 @@ ServerLobbyThread::EstablishSession(boost::shared_ptr<SessionData> 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);
}
+1 -1
View File
@@ -321,7 +321,7 @@ SessionData::CloseWebSocketHandle()
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) // c++11
std::error_code std_ec;
m_webData->webSocketServer->close(m_webData->webHandle, websocketpp::close::status::normal, "PokerTH server closed the connection.", std_ec);
#else
#else
boost::system::error_code ec;
m_webData->webSocketServer->close(m_webData->webHandle, websocketpp::close::status::normal, "PokerTH server closed the connection.", ec);
#endif
+2 -2
View File
@@ -61,7 +61,7 @@ WebSendBuffer::AsyncSendNextPacket(boost::shared_ptr<SessionData> session)
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
std::error_code std_ec;
webData->webSocketServer->close(webData->webHandle, websocketpp::close::status::normal, "PokerTH server closed the connection.", std_ec);
#else
#else
boost::system::error_code ec;
webData->webSocketServer->close(webData->webHandle, websocketpp::close::status::normal, "PokerTH server closed the connection.", ec);
#endif
@@ -80,7 +80,7 @@ WebSendBuffer::InternalStorePacket(boost::shared_ptr<SessionData> session, boost
std::error_code std_ec;
webData->webSocketServer->send(webData->webHandle, string((const char *)buf, packetSize), websocketpp::frame::opcode::BINARY, std_ec);
if (std_ec) {
#else
#else
boost::system::error_code ec;
webData->webSocketServer->send(webData->webHandle, string((const char *)buf, packetSize), websocketpp::frame::opcode::BINARY, ec);
if (ec) {
+4 -2
View File
@@ -65,10 +65,12 @@ public:
static boost::shared_ptr<NetPacket> Create(const char *data, size_t dataSize);
const PokerTHMessage *GetMsg() const {
const PokerTHMessage *GetMsg() const
{
return m_msg;
}
PokerTHMessage *GetMsg() {
PokerTHMessage *GetMsg()
{
return m_msg;
}
+16 -8
View File
@@ -52,16 +52,19 @@ public:
typedef typename P::endpoint P_endpoint;
ServerAcceptHelper(ServerCallback &serverCallback, boost::shared_ptr<boost::asio::io_service> ioService)
: m_ioService(ioService), m_serverCallback(serverCallback) {
: m_ioService(ioService), m_serverCallback(serverCallback)
{
m_acceptor.reset(new P_acceptor(*m_ioService));
}
virtual ~ServerAcceptHelper() {
virtual ~ServerAcceptHelper()
{
}
// Set the parameters.
virtual void Listen(unsigned serverPort, bool ipv6, const std::string &/*logDir*/,
boost::shared_ptr<ServerLobbyThread> lobbyThread) {
boost::shared_ptr<ServerLobbyThread> lobbyThread)
{
m_lobbyThread = lobbyThread;
try {
@@ -77,14 +80,16 @@ public:
}
}
virtual void Close() {
virtual void Close()
{
boost::system::error_code ec;
m_acceptor->close(ec);
// Ignore any error, because we are terminating.
}
protected:
void InternalListen(unsigned serverPort, bool ipv6) {
void InternalListen(unsigned serverPort, bool ipv6)
{
if (serverPort < 1024)
throw ServerException(__FILE__, __LINE__, ERR_SOCK_INVALID_PORT, 0);
@@ -114,7 +119,8 @@ protected:
}
void HandleAccept(boost::shared_ptr<typename P::socket> acceptedSocket,
const boost::system::error_code &error) {
const boost::system::error_code &error)
{
if (!error) {
boost::asio::socket_base::non_blocking_io command(true);
acceptedSocket->io_control(command);
@@ -136,11 +142,13 @@ protected:
}
}
ServerCallback &GetCallback() {
ServerCallback &GetCallback()
{
return m_serverCallback;
}
ServerLobbyThread &GetLobbyThread() {
ServerLobbyThread &GetLobbyThread()
{
return *m_lobbyThread;
}
+4 -2
View File
@@ -67,10 +67,12 @@ protected:
typedef std::list<boost::shared_ptr<ServerAcceptInterface> > AcceptHelperList;
ServerLobbyThread &GetLobbyThread();
ConfigFile &GetConfig() {
ConfigFile &GetConfig()
{
return m_playerConfig;
}
GuiInterface &GetGui() {
GuiInterface &GetGui()
{
return m_gui;
}
boost::shared_ptr<boost::asio::io_service> m_ioService;
+8 -4
View File
@@ -96,19 +96,23 @@ public:
const std::string &GetClientAddr() const;
void SetClientAddr(const std::string &addr);
ReceiveBuffer &GetReceiveBuffer() {
ReceiveBuffer &GetReceiveBuffer()
{
return *m_receiveBuffer;
}
SendBuffer &GetSendBuffer() {
SendBuffer &GetSendBuffer()
{
return *m_sendBuffer;
}
void Close() {
void Close()
{
m_callback.CloseSession(shared_from_this());
}
void CloseSocketHandle();
void CloseWebSocketHandle();
void HandlePacket(boost::shared_ptr<NetPacket> packet) {
void HandlePacket(boost::shared_ptr<NetPacket> packet)
{
m_callback.HandlePacket(shared_from_this(), packet);
}
+2 -1
View File
@@ -73,7 +73,8 @@ public:
boost::shared_ptr<Game> getCurrentGame();
GuiInterface *getGui();
Log* getMyLog() {
Log* getMyLog()
{
return myLog;
}
GameType getGameType();