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