Compare commits
29
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
015d6b7c72 | ||
|
|
304eac07a3 | ||
|
|
cf60947efc | ||
|
|
b79c60e246 | ||
|
|
a2d7c2e916 | ||
|
|
16f3f6ceb2 | ||
|
|
61bdbe8e06 | ||
|
|
027ba4c2f7 | ||
|
|
b51c346695 | ||
|
|
1d86cd3835 | ||
|
|
c1d7266e50 | ||
|
|
f3c86990c9 | ||
|
|
ceb123d21d | ||
|
|
df2cf5287a | ||
|
|
72d8e59d18 | ||
|
|
590f9f7a33 | ||
|
|
6dffbaeea5 | ||
|
|
0f59c0ad57 | ||
|
|
ac85136ac2 | ||
|
|
c2fa235e80 | ||
|
|
36149eddfe | ||
|
|
e4d358f97a | ||
|
|
316f2f43c3 | ||
|
|
757f12f35b | ||
|
|
8a1e3a4371 | ||
|
|
1f0e256fe6 | ||
|
|
b93525607e | ||
|
|
2a78c06d03 | ||
|
|
ef96b76c1d |
No files matched your search
@@ -11,7 +11,7 @@ Linux:
|
|||||||
- libgsasl version >= 1.4 --> http://www.gnu.org/software/gsasl/
|
- libgsasl version >= 1.4 --> http://www.gnu.org/software/gsasl/
|
||||||
- libboost_thread, libboost_filesystem, libboost_datetime, libboost_program_options,
|
- libboost_thread, libboost_filesystem, libboost_datetime, libboost_program_options,
|
||||||
libboost_iostreams, libboost_asio, libboost_regex, libboost_random, libboost_uuid
|
libboost_iostreams, libboost_asio, libboost_regex, libboost_random, libboost_uuid
|
||||||
(version >= 1.44, latest always recommended) --> http://www.boost.org/
|
(version >= 1.49, latest always recommended) --> http://www.boost.org/
|
||||||
- libSDL_mixer, libSDL --> http://www.libsdl.org/
|
- libSDL_mixer, libSDL --> http://www.libsdl.org/
|
||||||
- libSQLite3 --> http://sqlite.org/
|
- libSQLite3 --> http://sqlite.org/
|
||||||
- libtinyxml > 2.0 --> http://www.sourceforge.net/projects/tinyxml
|
- libtinyxml > 2.0 --> http://www.sourceforge.net/projects/tinyxml
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright 2014 PokerTH GbR <webmaster@pokerth.net> -->
|
||||||
|
<application>
|
||||||
|
<id type="desktop">pokerth.desktop</id>
|
||||||
|
<metadata_license>CC-BY-3.0</metadata_license>
|
||||||
|
<project_license>AGPL-3.0</project_license>
|
||||||
|
<name>PokerTH</name>
|
||||||
|
<summary>Poker game with single- and multiplayer support</summary>
|
||||||
|
<description>
|
||||||
|
<p>PokerTH is a poker game for the popular Texas Hold'em Poker variant. You can play singleplayer games with up to 9 computer-opponents or meet other PokerTH players around the world via internet games. Also multiplayer games in your LAN are possible with the network game mode. If you like to change the look and feel of the PokerTH gametable or the card deck just visit the styles gallery and choose your favourite style. To compare your poker skills with the other PokerTH players you can check your game results and rankings on our website.</p>
|
||||||
|
</description>
|
||||||
|
<screenshots>
|
||||||
|
<screenshot type="default" width="624" height="351">http://www.pokerth.net/pokerth_appdata_table1.png</screenshot>
|
||||||
|
<screenshot width="624" height="351">http://www.pokerth.net/pokerth_appdata_table2.png</screenshot>
|
||||||
|
</screenshots>
|
||||||
|
<url type="homepage">http://www.pokerth.net</url>
|
||||||
|
<updatecontact>webmaster@pokerth.net</updatecontact>
|
||||||
|
</application>
|
||||||
+14
-1
@@ -422,6 +422,8 @@ unix:!mac {
|
|||||||
boost_iostreams-mt
|
boost_iostreams-mt
|
||||||
BOOST_REGEX = boost_regex \
|
BOOST_REGEX = boost_regex \
|
||||||
boost_regex-mt
|
boost_regex-mt
|
||||||
|
BOOST_CHRONO = boost_chrono \
|
||||||
|
boost_chrono-mt
|
||||||
BOOST_SYS = boost_system \
|
BOOST_SYS = boost_system \
|
||||||
boost_system-mt
|
boost_system-mt
|
||||||
BOOST_RANDOM = boost_random \
|
BOOST_RANDOM = boost_random \
|
||||||
@@ -463,6 +465,14 @@ unix:!mac {
|
|||||||
message("Found $$lib")
|
message("Found $$lib")
|
||||||
BOOST_REGEX = -l$$lib
|
BOOST_REGEX = -l$$lib
|
||||||
}
|
}
|
||||||
|
for(lib, BOOST_CHRONO):exists($${dir}/lib$${lib}.so*) {
|
||||||
|
message("Found $$lib")
|
||||||
|
BOOST_CHRONO = -l$$lib
|
||||||
|
}
|
||||||
|
for(lib, BOOST_CHRONO):exists($${dir}/lib$${lib}.a) {
|
||||||
|
message("Found $$lib")
|
||||||
|
BOOST_CHRONO = -l$$lib
|
||||||
|
}
|
||||||
!android{
|
!android{
|
||||||
for(lib, BOOST_RANDOM):exists($${dir}/lib$${lib}.so*) {
|
for(lib, BOOST_RANDOM):exists($${dir}/lib$${lib}.so*) {
|
||||||
message("Found $$lib")
|
message("Found $$lib")
|
||||||
@@ -487,9 +497,10 @@ unix:!mac {
|
|||||||
$$BOOST_FS \
|
$$BOOST_FS \
|
||||||
$$BOOST_IOSTREAMS \
|
$$BOOST_IOSTREAMS \
|
||||||
$$BOOST_REGEX \
|
$$BOOST_REGEX \
|
||||||
|
$$BOOST_CHRONO \
|
||||||
$$BOOST_RANDOM \
|
$$BOOST_RANDOM \
|
||||||
$$BOOST_SYS
|
$$BOOST_SYS
|
||||||
!count(BOOST_LIBS, 6):error("Unable to find boost libraries in PREFIX=$${PREFIX}")
|
!count(BOOST_LIBS, 7):error("Unable to find boost libraries in PREFIX=$${PREFIX}")
|
||||||
if($$system(sdl-config --version)):error("sdl-config not found in PATH - libSDL_mixer, libSDL are required!")
|
if($$system(sdl-config --version)):error("sdl-config not found in PATH - libSDL_mixer, libSDL are required!")
|
||||||
UNAME = $$system(uname -s)
|
UNAME = $$system(uname -s)
|
||||||
BSD = $$find(UNAME, "BSD")
|
BSD = $$find(UNAME, "BSD")
|
||||||
@@ -509,6 +520,7 @@ unix:!mac {
|
|||||||
$$BOOST_FS \
|
$$BOOST_FS \
|
||||||
$$BOOST_IOSTREAMS \
|
$$BOOST_IOSTREAMS \
|
||||||
$$BOOST_REGEX \
|
$$BOOST_REGEX \
|
||||||
|
$$BOOST_CHRONO \
|
||||||
$$BOOST_SYS
|
$$BOOST_SYS
|
||||||
!count(BOOST_LIBS, 5):error("Unable to find boost libraries in PREFIX=$${PREFIX}/armv5")
|
!count(BOOST_LIBS, 5):error("Unable to find boost libraries in PREFIX=$${PREFIX}/armv5")
|
||||||
LIBS += -ltinyxml
|
LIBS += -ltinyxml
|
||||||
@@ -575,6 +587,7 @@ mac {
|
|||||||
LIBS += /usr/local/lib/libboost_thread.a
|
LIBS += /usr/local/lib/libboost_thread.a
|
||||||
LIBS += /usr/local/lib/libboost_filesystem.a
|
LIBS += /usr/local/lib/libboost_filesystem.a
|
||||||
LIBS += /usr/local/lib/libboost_regex.a
|
LIBS += /usr/local/lib/libboost_regex.a
|
||||||
|
LIBS += /usr/local/lib/libboost_chrono.a
|
||||||
LIBS += /usr/local/lib/libboost_random.a
|
LIBS += /usr/local/lib/libboost_random.a
|
||||||
LIBS += /usr/local/lib/libboost_system.a
|
LIBS += /usr/local/lib/libboost_system.a
|
||||||
LIBS += /usr/local/lib/libboost_iostreams.a
|
LIBS += /usr/local/lib/libboost_iostreams.a
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ SOURCES += \
|
|||||||
src/net/common/servergame.cpp \
|
src/net/common/servergame.cpp \
|
||||||
src/net/common/servergamestate.cpp \
|
src/net/common/servergamestate.cpp \
|
||||||
src/net/common/serverlobbythread.cpp \
|
src/net/common/serverlobbythread.cpp \
|
||||||
|
src/net/common/serverdelaytime.cpp \
|
||||||
src/net/common/serverbanmanager.cpp \
|
src/net/common/serverbanmanager.cpp \
|
||||||
src/net/common/servercallback.cpp \
|
src/net/common/servercallback.cpp \
|
||||||
src/net/common/serveradminbot.cpp \
|
src/net/common/serveradminbot.cpp \
|
||||||
|
|||||||
+13
-2
@@ -70,6 +70,7 @@ HEADERS += \
|
|||||||
src/net/senderhelper.h \
|
src/net/senderhelper.h \
|
||||||
src/net/serveraccepthelper.h \
|
src/net/serveraccepthelper.h \
|
||||||
src/net/serverlobbythread.h \
|
src/net/serverlobbythread.h \
|
||||||
|
src/net/serverdelaytime.h \
|
||||||
src/net/socket_helper.h \
|
src/net/socket_helper.h \
|
||||||
src/net/socket_msg.h \
|
src/net/socket_msg.h \
|
||||||
src/net/socket_startup.h \
|
src/net/socket_startup.h \
|
||||||
@@ -180,6 +181,7 @@ unix : !mac {
|
|||||||
BOOST_THREAD = boost_thread boost_thread-mt
|
BOOST_THREAD = boost_thread boost_thread-mt
|
||||||
BOOST_PROGRAM_OPTIONS = boost_program_options boost_program_options-mt
|
BOOST_PROGRAM_OPTIONS = boost_program_options boost_program_options-mt
|
||||||
BOOST_IOSTREAMS = boost_iostreams boost_iostreams-mt
|
BOOST_IOSTREAMS = boost_iostreams boost_iostreams-mt
|
||||||
|
BOOST_CHRONO = boost_chrono boost_chrono-mt
|
||||||
BOOST_SYS = boost_system boost_system-mt
|
BOOST_SYS = boost_system boost_system-mt
|
||||||
BOOST_REGEX = boost_regex boost_regex-mt
|
BOOST_REGEX = boost_regex boost_regex-mt
|
||||||
BOOST_RANDOM = boost_random boost_random-mt
|
BOOST_RANDOM = boost_random boost_random-mt
|
||||||
@@ -231,6 +233,14 @@ unix : !mac {
|
|||||||
message("Found $$lib")
|
message("Found $$lib")
|
||||||
BOOST_REGEX = -l$$lib
|
BOOST_REGEX = -l$$lib
|
||||||
}
|
}
|
||||||
|
for(lib, BOOST_CHRONO):exists($${dir}/lib$${lib}.so*) {
|
||||||
|
message("Found $$lib")
|
||||||
|
BOOST_CHRONO = -l$$lib
|
||||||
|
}
|
||||||
|
for(lib, BOOST_CHRONO):exists($${dir}/lib$${lib}.a) {
|
||||||
|
message("Found $$lib")
|
||||||
|
BOOST_CHRONO = -l$$lib
|
||||||
|
}
|
||||||
for(lib, BOOST_RANDOM):exists($${dir}/lib$${lib}.so*) {
|
for(lib, BOOST_RANDOM):exists($${dir}/lib$${lib}.so*) {
|
||||||
message("Found $$lib")
|
message("Found $$lib")
|
||||||
BOOST_RANDOM = -l$$lib
|
BOOST_RANDOM = -l$$lib
|
||||||
@@ -249,8 +259,8 @@ unix : !mac {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BOOST_LIBS = $$BOOST_THREAD $$BOOST_FS $$BOOST_PROGRAM_OPTIONS $$BOOST_IOSTREAMS $$BOOST_REGEX $$BOOST_RANDOM $$BOOST_SYS
|
BOOST_LIBS = $$BOOST_THREAD $$BOOST_FS $$BOOST_PROGRAM_OPTIONS $$BOOST_IOSTREAMS $$BOOST_REGEX $$BOOST_CHRONO $$BOOST_RANDOM $$BOOST_SYS
|
||||||
!count(BOOST_LIBS, 7){
|
!count(BOOST_LIBS, 8){
|
||||||
error("Unable to find boost libraries in PREFIX=$${PREFIX}")
|
error("Unable to find boost libraries in PREFIX=$${PREFIX}")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,6 +311,7 @@ mac {
|
|||||||
LIBS += /usr/local/lib/libboost_thread.a
|
LIBS += /usr/local/lib/libboost_thread.a
|
||||||
LIBS += /usr/local/lib/libboost_filesystem.a
|
LIBS += /usr/local/lib/libboost_filesystem.a
|
||||||
LIBS += /usr/local/lib/libboost_regex.a
|
LIBS += /usr/local/lib/libboost_regex.a
|
||||||
|
LIBS += /usr/local/lib/libboost_chrono.a
|
||||||
LIBS += /usr/local/lib/libboost_random.a
|
LIBS += /usr/local/lib/libboost_random.a
|
||||||
LIBS += /usr/local/lib/libboost_system.a
|
LIBS += /usr/local/lib/libboost_system.a
|
||||||
LIBS += /usr/local/lib/libboost_iostreams.a
|
LIBS += /usr/local/lib/libboost_iostreams.a
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
};
|
};
|
||||||
|
|||||||
+8
-6
@@ -56,10 +56,10 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
|||||||
|
|
||||||
dealerPosition = startData.startDealerPlayerId;
|
dealerPosition = startData.startDealerPlayerId;
|
||||||
|
|
||||||
if(DEBUG_MODE) {
|
// debug mode
|
||||||
startSmallBlind = 10;
|
if(myLog) {
|
||||||
currentSmallBlind = startSmallBlind;
|
myLog->debugMode_getStartSmallBlind(&startSmallBlind,¤tSmallBlind);
|
||||||
dealerPosition = 4;
|
myLog->debugMode_getStartDealerPosition(&dealerPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@@ -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> >);
|
||||||
@@ -109,6 +109,9 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
|||||||
++player_i;
|
++player_i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// debug mode
|
||||||
|
if(myLog) myLog->debugMode_getPlayerStartCash(&myStartCash, i);
|
||||||
|
|
||||||
// create player objects
|
// create player objects
|
||||||
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(i, uniqueId, type, myName, myAvatarFile, myStartCash, startQuantityPlayers > i, myStayOnTableStatus, 0);
|
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(i, uniqueId, type, myName, myAvatarFile, myStartCash, startQuantityPlayers > i, myStayOnTableStatus, 0);
|
||||||
tmpPlayer->setIsSessionActive(true);
|
tmpPlayer->setIsSessionActive(true);
|
||||||
@@ -212,7 +215,6 @@ void Game::startHand()
|
|||||||
|
|
||||||
// log new hand
|
// log new hand
|
||||||
myGui->logNewGameHandMsg(myGameID, currentHandID);
|
myGui->logNewGameHandMsg(myGameID, currentHandID);
|
||||||
myGui->flushLogAtGame(myGameID);
|
|
||||||
|
|
||||||
currentHand->start();
|
currentHand->start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1054,17 +1054,9 @@ vector< vector<int> > ArrayData::getHandChancePreflop(int handCode)
|
|||||||
|
|
||||||
int check = -1;
|
int check = -1;
|
||||||
|
|
||||||
int i;
|
|
||||||
|
|
||||||
vector< vector<int> > chance(2);
|
vector< vector<int> > chance(2);
|
||||||
|
chance[0].assign(10,0);
|
||||||
chance[0].resize(10);
|
chance[1].assign(10,0);
|
||||||
chance[1].resize(10);
|
|
||||||
|
|
||||||
for(i=0; i<10; i++) {
|
|
||||||
chance[0][i] = 0;
|
|
||||||
chance[1][i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned val = 0; val < NUM_HAND_CHANCE_PREFLOP; val++) {
|
for (unsigned val = 0; val < NUM_HAND_CHANCE_PREFLOP; val++) {
|
||||||
if(handCode == handChancePreflop[val].hand) {
|
if(handCode == handChancePreflop[val].hand) {
|
||||||
|
|||||||
@@ -221,450 +221,313 @@ int CardsValue::holeCardsClass(int one, int two)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CardsValue::holeCardsToIntCode(int* cards)
|
int CardsValue::holeCardsToIntCode(int holeCards[2])
|
||||||
{
|
{
|
||||||
|
|
||||||
// Code der HoleCards ermitteln
|
// Code der HoleCards ermitteln
|
||||||
if(cards[0]%13 == cards[1]%13) {
|
if(holeCards[0]%13 == holeCards[1]%13) {
|
||||||
return ((cards[0]%13)*1000 + (cards[0]%13)*10);
|
return ((holeCards[0]%13)*1000 + (holeCards[0]%13)*10);
|
||||||
} else {
|
} else {
|
||||||
if(cards[0]%13 < cards[1]%13) {
|
if(holeCards[0]%13 < holeCards[1]%13) {
|
||||||
if(cards[0]/13 == cards[1]/13) {
|
if(holeCards[0]/13 == holeCards[1]/13) {
|
||||||
return ((cards[0]%13)*1000 + (cards[1]%13)*10 + 1);
|
return ((holeCards[0]%13)*1000 + (holeCards[1]%13)*10 + 1);
|
||||||
} else {
|
} else {
|
||||||
return ((cards[0]%13)*1000 + (cards[1]%13)*10);
|
return ((holeCards[0]%13)*1000 + (holeCards[1]%13)*10);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(cards[0]/13 == cards[1]/13) {
|
if(holeCards[0]/13 == holeCards[1]/13) {
|
||||||
return ((cards[1]%13)*1000 + (cards[0]%13)*10 + 1);
|
return ((holeCards[1]%13)*1000 + (holeCards[0]%13)*10 + 1);
|
||||||
} else {
|
} else {
|
||||||
return ((cards[1]%13)*1000 + (cards[0]%13)*10);
|
return ((holeCards[1]%13)*1000 + (holeCards[0]%13)*10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DO NOT USE, THIS MAY LEAK MEMORY
|
static const int straight[10] = { 7936, 3968, 1984, 992, 496, 248, 124, 62, 31, 4111 };
|
||||||
int* CardsValue::intCodeToHoleCards(int code)
|
|
||||||
|
int CardsValue::cardsValueShort(int cards[4])
|
||||||
{
|
{
|
||||||
|
|
||||||
// one possibility !!!
|
int color_idx;
|
||||||
|
int card_idx;
|
||||||
|
|
||||||
int* cards = new int[2];
|
// Royal Flush, Straight Flush, Flush
|
||||||
|
for(color_idx=0; color_idx<4; color_idx++) { // check all colors
|
||||||
cards[0] = code/1000;
|
if(bitcount(cards[color_idx])>=5) { // check if at least 5 cards of one color
|
||||||
cards[1] = (code-cards[0]*1000)/10;
|
if((cards[color_idx] & straight[0]) == straight[0]) // check for Royal Flush
|
||||||
|
return 9;
|
||||||
if(cards[0]==cards[1]) {
|
else { // check for Straight Flush
|
||||||
cards[1] +=13;
|
for(card_idx=1; card_idx<10; card_idx++) {
|
||||||
} else {
|
if((cards[color_idx] & straight[card_idx]) == straight[card_idx]) {
|
||||||
if(code%10 == 0) cards[1] +=13;
|
return 8; // Straight Flush
|
||||||
}
|
|
||||||
|
|
||||||
return cards;
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
int CardsValue::cardsValue(int* cards, int* position)
|
|
||||||
{
|
|
||||||
|
|
||||||
int array[7][3];
|
|
||||||
int j1, j2, j3, j4, j5, k1, k2, ktemp[3];
|
|
||||||
|
|
||||||
// Kartenwerte umwandeln (z.B. [ 11 (Karo K�ig) -> 0 11 ] oder [ 31 (Pik 7) -> 2 5 ] )
|
|
||||||
for(j1=0; j1<7; j1++) {
|
|
||||||
array[j1][0] = cards[j1]/13;
|
|
||||||
array[j1][1] = cards[j1]%13;
|
|
||||||
array[j1][2] = j1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Karten nach Farben sortieren: Kreuz - Pik - Herz - Karo
|
|
||||||
for(k1=0; k1<7; k1++) {
|
|
||||||
for(k2=k1+1; k2<7; k2++) {
|
|
||||||
if(array[k1][0]<array[k2][0]) {
|
|
||||||
ktemp[0] = array[k1][0];
|
|
||||||
ktemp[1] = array[k1][1];
|
|
||||||
ktemp[2] = array[k1][2];
|
|
||||||
array[k1][0] = array[k2][0];
|
|
||||||
array[k1][1] = array[k2][1];
|
|
||||||
array[k1][2] = array[k2][2];
|
|
||||||
array[k2][0] = ktemp[0];
|
|
||||||
array[k2][1] = ktemp[1];
|
|
||||||
array[k2][2] = ktemp[2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Karten innerhalb der Farben nach der Gr�e sortieren: Ass - K�ig - Dame - ... - 4 - 3 - 2
|
|
||||||
for(k1=0; k1<7; k1++) {
|
|
||||||
for(k2=k1+1; k2<7; k2++) {
|
|
||||||
if(array[k1][0]==array[k2][0] && array[k1][1]<array[k2][1]) {
|
|
||||||
ktemp[0] = array[k1][0];
|
|
||||||
ktemp[1] = array[k1][1];
|
|
||||||
ktemp[2] = array[k1][2];
|
|
||||||
array[k1][0] = array[k2][0];
|
|
||||||
array[k1][1] = array[k2][1];
|
|
||||||
array[k1][2] = array[k2][2];
|
|
||||||
array[k2][0] = ktemp[0];
|
|
||||||
array[k2][1] = ktemp[1];
|
|
||||||
array[k2][2] = ktemp[2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Karten auf Bl�ter testen. Klasseneinteilung absteigend: 9 - Royal Flush, 8 - Straight Flush, ... 2 - Zwei Paare, 1 - Ein Paar, 0 - Nischt
|
|
||||||
|
|
||||||
// auf Royal Flush (Klasse 9) und Straight Flush (Klasse 8) testen
|
|
||||||
for(j1=0; j1<3; j1++) {
|
|
||||||
// 5 Karten gleiche Farbe ?
|
|
||||||
if(array[j1][0] == array[j1+1][0] && array[j1][0] == array[j1+2][0] && array[j1][0] == array[j1+3][0] && array[j1][0] == array[j1+4][0]) {
|
|
||||||
// zus�zlich in Stra�nform ?
|
|
||||||
if(array[j1][1]-1 == array[j1+1][1] && array[j1+1][1]-1 == array[j1+2][1] && array[j1+2][1]-1 == array[j1+3][1] && array[j1+3][1]-1 == array[j1+4][1]) {
|
|
||||||
// mit Ass an der Spitze ?
|
|
||||||
if(array[j1][1] == 12) {
|
|
||||||
// Royal Flush (9*100000000)
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
for(j2=0; j2<5; j2++) {
|
|
||||||
position[j2] = array[j1+j2][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 900000000;
|
|
||||||
}
|
|
||||||
// sonst nur Straight Flush (8*100000000 + (h�hste Straight-Karte)*1000000)
|
|
||||||
else {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
for(j2=0; j2<5; j2++) {
|
|
||||||
position[j2] = array[j1+j2][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 800000000+array[j1][1]*1000000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Straight Flush Ausnahme: 5-4-3-2-A
|
|
||||||
for(j1=0; j1<3; j1++) {
|
|
||||||
// 5 Karten gleiche Farbe ?
|
|
||||||
if(array[j1][0] == array[j1+1][0] && array[j1][0] == array[j1+2][0] && array[j1][0] == array[j1+3][0] && array[j1][0] == array[j1+4][0]) {
|
|
||||||
for(j2=j1+1; j2<4; j2++) {
|
|
||||||
if(array[j1][1]-9==array[j2][1] && array[j2][1]-1==array[j2+1][1] && array[j2+1][1]-1==array[j2+2][1] && array[j2+2][1]-1==array[j2+3][1] && array[j1][0]==array[j2+2][0] && array[j1][0]==array[j2+3][0]) {
|
|
||||||
// Straight Flush mit 5 als höchste Karte -> 8*100000000+3*1000000
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
position[0] = array[j1][2];
|
|
||||||
for(j3=0; j3<4; j3++) {
|
|
||||||
position[j3+1] = array[j2+j3][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 800000000+3*1000000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// auf Flush (Klasse 5) testen
|
|
||||||
for(j1=0; j1<3; j1++) {
|
|
||||||
if(array[j1][0] == array[j1+1][0] && array[j1][0] == array[j1+2][0] && array[j1][0] == array[j1+3][0] && array[j1][0] == array[j1+4][0]) {
|
|
||||||
// Flush -> 5*10000000 + h�ste Flush Karten mit absteigender Wertung
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
for(j2=0; j2<5; j2++) {
|
|
||||||
position[j2] = array[j1+j2][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 500000000+array[j1][1]*1000000+array[j1+1][1]*10000+array[j1+2][1]*100+array[j1+3][1]*10+array[j1+4][1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Karten fr den Vierling-, Full-House-, Drilling- und Paartest umsortieren
|
|
||||||
for(k1=0; k1<7; k1++) {
|
|
||||||
for(k2=k1+1; k2<7; k2++) {
|
|
||||||
if(array[k1][1]<array[k2][1]) {
|
|
||||||
ktemp[0] = array[k1][0];
|
|
||||||
ktemp[1] = array[k1][1];
|
|
||||||
ktemp[2] = array[k1][2];
|
|
||||||
array[k1][0] = array[k2][0];
|
|
||||||
array[k1][1] = array[k2][1];
|
|
||||||
array[k1][2] = array[k2][2];
|
|
||||||
array[k2][0] = ktemp[0];
|
|
||||||
array[k2][1] = ktemp[1];
|
|
||||||
array[k2][2] = ktemp[2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// nach Position sortieren: erst board, dann hole cards
|
|
||||||
for(k1=0; k1<7; k1++) {
|
|
||||||
for(k2=k1+1; k2<7; k2++) {
|
|
||||||
if(array[k1][1]==array[k2][1] && array[k1][2]<array[k2][2]) {
|
|
||||||
ktemp[0] = array[k1][0];
|
|
||||||
ktemp[1] = array[k1][1];
|
|
||||||
ktemp[2] = array[k1][2];
|
|
||||||
array[k1][0] = array[k2][0];
|
|
||||||
array[k1][1] = array[k2][1];
|
|
||||||
array[k1][2] = array[k2][2];
|
|
||||||
array[k2][0] = ktemp[0];
|
|
||||||
array[k2][1] = ktemp[1];
|
|
||||||
array[k2][2] = ktemp[2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// auf Vierling (Klasse 7) testen
|
|
||||||
for(j1=0; j1<4; j1++) {
|
|
||||||
if(array[j1][1] == array[j1+1][1] && array[j1][1] == array[j1+2][1] && array[j1][1] == array[j1+3][1]) {
|
|
||||||
// Position des Kickers ermitteln und der Blattwertung als dritte Gewichtung hinzuaddieren
|
|
||||||
if(j1==0) {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
for(j2=0; j2<5; j2++) {
|
|
||||||
position[j2] = array[j2][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 700000000+array[j1][1]*1000000+array[j1+4][1]*10000;
|
|
||||||
} else {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
for(j2=0; j2<4; j2++) {
|
|
||||||
position[j2] = array[j1+j2][2];
|
|
||||||
}
|
|
||||||
position[4] = array[0][2];
|
|
||||||
}
|
|
||||||
return 700000000+array[j1][1]*1000000+array[0][1]*10000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hilfsvariablen fr die Full-House-Paar- und -Drilling-Zuordnung
|
|
||||||
int drei, zwei;
|
|
||||||
|
|
||||||
// auf Straight (Klasse 4) und Full House (Klasse 6) testen
|
|
||||||
for(j1=0; j1<7; j1++) {
|
|
||||||
for(j2=j1+1; j2<7; j2++) {
|
|
||||||
for(j3=j2+1; j3<7; j3++) {
|
|
||||||
for(j4=j3+1; j4<7; j4++) {
|
|
||||||
for(j5=j4+1; j5<7; j5++) {
|
|
||||||
// Straight
|
|
||||||
if(array[j1][1]-1 == array[j2][1] && array[j2][1]-1 == array[j3][1] && array[j3][1]-1 == array[j4][1] && array[j4][1]-1 == array[j5][1]) {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
position[0] = array[j1][2];
|
|
||||||
position[1] = array[j2][2];
|
|
||||||
position[2] = array[j3][2];
|
|
||||||
position[3] = array[j4][2];
|
|
||||||
position[4] = array[j5][2];
|
|
||||||
}
|
|
||||||
return 400000000+array[j1][1]*1000000;
|
|
||||||
}
|
|
||||||
// Full House
|
|
||||||
if((array[j1][1] == array[j2][1] && array[j1][1] == array[j3][1] && array[j4][1] == array[j5][1]) || (array[j3][1] == array[j4][1] && array[j3][1] == array[j5][1] && array[j1][1] == array[j2][1])) {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
position[0] = array[j1][2];
|
|
||||||
position[1] = array[j2][2];
|
|
||||||
position[2] = array[j3][2];
|
|
||||||
position[3] = array[j4][2];
|
|
||||||
position[4] = array[j5][2];
|
|
||||||
}
|
|
||||||
// Paar und Drilling des Full House ermitteln ermitteln
|
|
||||||
if(array[j3][1]==array[j1][1]) {
|
|
||||||
drei = array[j1][1];
|
|
||||||
zwei = array[j4][1];
|
|
||||||
} else {
|
|
||||||
drei = array[j4][1];
|
|
||||||
zwei = array[j1][1];
|
|
||||||
}
|
|
||||||
return 600000000+drei*1000000+zwei*10000;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 5; // Flush
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// auf Straight-Spezialfall ( 5 4 3 2 A ) testen
|
int AND = cards[0] & cards[1] & cards[2] & cards[3];
|
||||||
for(j1=0; j1<7; j1++) {
|
|
||||||
for(j2=j1+1; j2<7; j2++) {
|
// Four of a Kind
|
||||||
for(j3=j2+1; j3<7; j3++) {
|
if(AND) {
|
||||||
for(j4=j3+1; j4<7; j4++) {
|
return 7;
|
||||||
for(j5=j4+1; j5<7; j5++) {
|
}
|
||||||
if(array[j1][1]-9 == array[j2][1] && array[j2][1]-1 == array[j3][1] && array[j3][1]-1 == array[j4][1] && array[j4][1]-1 == array[j5][1]) {
|
|
||||||
if(position) {
|
int OR = cards[0] | cards[1] | cards[2] | cards[3];
|
||||||
// Position-Array fuellen
|
|
||||||
position[0] = array[j1][2];
|
// Straight
|
||||||
position[1] = array[j2][2];
|
for(card_idx=0; card_idx<10; card_idx++) {
|
||||||
position[2] = array[j3][2];
|
if((OR & straight[card_idx]) == straight[card_idx]) {
|
||||||
position[3] = array[j4][2];
|
return 4;
|
||||||
position[4] = array[j5][2];
|
|
||||||
}
|
|
||||||
return 400000000+array[j2][1]*1000000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// auf Drilling (Klasse 3) testen
|
int color_1_idx, color_2_idx, color_3_idx, color_4_idx, color_5_idx;
|
||||||
for(j1=0; j1<5; j1++) {
|
int temp;
|
||||||
if(array[j1][1] == array[j1+1][1] && array[j1][1] == array[j1+2][1]) {
|
|
||||||
// Kicker ermitteln
|
// Full House, Three of a Kind
|
||||||
if(j1==0) {
|
for(color_1_idx=0; color_1_idx<2; color_1_idx++) {
|
||||||
if(position) {
|
for(color_2_idx=color_1_idx+1; color_2_idx<3; color_2_idx++) {
|
||||||
// Position-Array fuellen
|
for(color_3_idx=color_2_idx+1; color_3_idx<4; color_3_idx++) {
|
||||||
for(j2=0; j2<5; j2++) {
|
temp = cards[color_1_idx] & cards[color_2_idx] & cards[color_3_idx];
|
||||||
position[j2] = array[j2][2];
|
if(bitcount(temp) == 2) { // two times Three of a Kind
|
||||||
}
|
return 6; // Full House
|
||||||
}
|
|
||||||
return 300000000+array[j1][1]*1000000+array[j1+3][1]*10000+array[j1+4][1]*100;
|
|
||||||
} else {
|
|
||||||
if(j1==1) {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
for(j2=0; j2<5; j2++) {
|
|
||||||
position[j2] = array[j2][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 300000000+array[j1][1]*1000000+array[j1-1][1]*10000+array[j1+3][1]*100;
|
|
||||||
} else {
|
} else {
|
||||||
if(position) {
|
if(temp) {
|
||||||
// Position-Array fuellen
|
for(color_4_idx=0; color_4_idx<3; color_4_idx++) {
|
||||||
for(j2=0; j2<3; j2++) {
|
for(color_5_idx=color_4_idx+1; color_5_idx<4; color_5_idx++) {
|
||||||
position[j2] = array[j1+j2][2];
|
if(~temp & cards[color_4_idx] & cards[color_5_idx]) { // search for additional pair
|
||||||
|
return 6; // Full House
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
position[3] = array[0][2];
|
return 3; // Three of a Kind
|
||||||
position[4] = array[1][2];
|
|
||||||
}
|
}
|
||||||
return 300000000+array[j1][1]*1000000+array[0][1]*10000+array[1][1]*100;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// auf Zwei Paare (Klasse 2) testen
|
// Two Pairs, Two of a Kind
|
||||||
for(j1=0; j1<4; j1++) {
|
for(color_1_idx=0; color_1_idx<3; color_1_idx++) {
|
||||||
for(j2=j1+2; j2<6; j2++) {
|
for(color_2_idx=color_1_idx+1; color_2_idx<4; color_2_idx++) {
|
||||||
if(array[j1][1] == array[j1+1][1] && array[j2][1] == array[j2+1][1]) {
|
temp = cards[color_1_idx] & cards[color_2_idx];
|
||||||
// Kicker ermitteln
|
if(bitcount(temp) >= 2) { // at least two times Two of a Kind
|
||||||
if(j1==0) {
|
return 2; // Two Pairs
|
||||||
if(j2==2) {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
position[0] = array[j1][2];
|
|
||||||
position[1] = array[j1+1][2];
|
|
||||||
position[2] = array[j2][2];
|
|
||||||
position[3] = array[j2+1][2];
|
|
||||||
position[4] = array[j2+2][2];
|
|
||||||
}
|
|
||||||
return 200000000+array[j1][1]*1000000+array[j2][1]*10000+array[j2+2][1]*100;
|
|
||||||
} else {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
position[0] = array[j1][2];
|
|
||||||
position[1] = array[j1+1][2];
|
|
||||||
position[2] = array[j2][2];
|
|
||||||
position[3] = array[j2+1][2];
|
|
||||||
position[4] = array[j1+2][2];
|
|
||||||
}
|
|
||||||
return 200000000+array[j1][1]*1000000+array[j2][1]*10000+array[j1+2][1]*100;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
position[0] = array[j1][2];
|
|
||||||
position[1] = array[j1+1][2];
|
|
||||||
position[2] = array[j2][2];
|
|
||||||
position[3] = array[j2+1][2];
|
|
||||||
position[4] = array[0][2];
|
|
||||||
}
|
|
||||||
return 200000000+array[j1][1]*1000000+array[j2][1]*10000+array[0][1]*100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// auf Paar (Klasse 1) testen
|
|
||||||
for(j1=0; j1<6; j1++) {
|
|
||||||
if(array[j1][1] == array[j1+1][1]) {
|
|
||||||
// Kicker ermitteln
|
|
||||||
if(j1==0) {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
for(j2=0; j2<5; j2++) {
|
|
||||||
position[j2] = array[j2][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 100000000+array[j1][1]*1000000+array[j1+2][1]*10000+array[j1+3][1]*100+array[j1+4][1];
|
|
||||||
}
|
|
||||||
if(j1==1) {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
for(j2=0; j2<5; j2++) {
|
|
||||||
position[j2] = array[j2][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 100000000+array[j1][1]*1000000+array[j1-1][1]*10000+array[j1+2][1]*100+array[j1+3][1];
|
|
||||||
}
|
|
||||||
if(j1==2) {
|
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
for(j2=0; j2<5; j2++) {
|
|
||||||
position[j2] = array[j2][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 100000000+array[j1][1]*1000000+array[j1-2][1]*10000+array[j1-1][1]*100+array[j1+2][1];
|
|
||||||
} else {
|
} else {
|
||||||
if(position) {
|
if(temp) { // search for second pair
|
||||||
// Position-Array fuellen
|
for(color_3_idx=0; color_3_idx<3; color_3_idx++) {
|
||||||
for(j2=0; j2<2; j2++) {
|
for(color_4_idx=color_3_idx+1; color_4_idx<4; color_4_idx++) {
|
||||||
position[j2] = array[j1+j2][2];
|
if(~temp & cards[color_3_idx] & cards[color_4_idx]) {
|
||||||
|
return 2; // Two Pairs
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
position[2] = array[0][2];
|
return 1; // Two of a Kind
|
||||||
position[3] = array[1][2];
|
|
||||||
position[4] = array[2][2];
|
|
||||||
}
|
}
|
||||||
return 100000000+array[j1][1]*1000000+array[0][1]*10000+array[1][1]*100+array[2][1];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Highest Card (Klasse 0) + Kicker
|
return 0; // High Card
|
||||||
if(position) {
|
|
||||||
// Position-Array fuellen
|
|
||||||
for(j2=0; j2<5; j2++) {
|
|
||||||
position[j2] = array[j2][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return array[0][1]*1000000+array[1][1]*10000+array[2][1]*100+array[3][1]*10+array[4][1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CardsValue::cardsValue(int cards[4], int bestHand[4])
|
||||||
std::vector< std::vector<int> > CardsValue::calcCardsChance(GameState beRoID, int* playerCards, int* boardCards)
|
|
||||||
{
|
{
|
||||||
int i,j;
|
int color_1_idx;
|
||||||
|
int card_idx;
|
||||||
|
KickerValue kickerValue1;
|
||||||
|
|
||||||
|
// Royal Flush, Straight Flush, Flush
|
||||||
|
for(color_1_idx=0; color_1_idx<4; color_1_idx++) { // check all colors
|
||||||
|
if(bitcount(cards[color_1_idx])>=5) { // check if at least 5 cards of one color
|
||||||
|
if((cards[color_1_idx] & straight[0]) == straight[0]) { // check for Royal Flush
|
||||||
|
if(bestHand) bestHand[color_1_idx] = straight[0];
|
||||||
|
return 900000000; // Royal Flush
|
||||||
|
} else {
|
||||||
|
for(card_idx=1; card_idx<10; card_idx++) {
|
||||||
|
if((cards[color_1_idx] & straight[card_idx]) == straight[card_idx]) { // check for Straight Flush
|
||||||
|
if(bestHand) bestHand[color_1_idx] = straight[card_idx];
|
||||||
|
return (800000000+(12-card_idx)*1000000); // Straight Flush
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Flush
|
||||||
|
kickerValue1 = determineKickerValue(cards[color_1_idx],0,4);
|
||||||
|
if(bestHand) bestHand[color_1_idx] = kickerValue1.select;
|
||||||
|
return 500000000 + kickerValue1.factorValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int AND = cards[0] & cards[1] & cards[2] & cards[3];
|
||||||
|
int OR = cards[0] | cards[1] | cards[2] | cards[3];
|
||||||
|
int temp1;
|
||||||
|
KickerValue kickerValue2;
|
||||||
|
|
||||||
|
// Four of a Kind
|
||||||
|
if(AND) {
|
||||||
|
kickerValue1 = determineKickerValue(AND,0,0);
|
||||||
|
kickerValue2 = determineKickerValue(OR & ~AND,1,1);
|
||||||
|
if(bestHand) {
|
||||||
|
temp1 = kickerValue2.select;
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
bestHand[color_1_idx] = (cards[color_1_idx] & (kickerValue1.select | temp1));
|
||||||
|
if(bestHand[color_1_idx] & temp1) temp1 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 700000000 + kickerValue1.factorValue + kickerValue2.factorValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Straight
|
||||||
|
for(card_idx=0; card_idx<10; card_idx++) {
|
||||||
|
if((OR & straight[card_idx]) == straight[card_idx]) {
|
||||||
|
if(bestHand) {
|
||||||
|
temp1 = straight[card_idx];
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
bestHand[color_1_idx] += (temp1 & cards[color_1_idx]);
|
||||||
|
temp1 &= ~bestHand[color_1_idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 400000000 + (12-card_idx)*1000000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int color_2_idx, color_3_idx;
|
||||||
|
|
||||||
|
// Full House, Three of a Kind
|
||||||
|
temp1 = 0;
|
||||||
|
for(color_1_idx=0; color_1_idx<2; color_1_idx++) {
|
||||||
|
for(color_2_idx=color_1_idx+1; color_2_idx<3; color_2_idx++) {
|
||||||
|
for(color_3_idx=color_2_idx+1; color_3_idx<4; color_3_idx++) {
|
||||||
|
temp1 |= cards[color_1_idx] & cards[color_2_idx] & cards[color_3_idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(temp1) {
|
||||||
|
if(bitcount(temp1) == 2) {
|
||||||
|
// two times Three of a Kind
|
||||||
|
if(bestHand) {
|
||||||
|
kickerValue1 = determineKickerValue(temp1,0,0);
|
||||||
|
kickerValue2 = determineKickerValue(kickerValue1.remain,1,1);
|
||||||
|
int temp2 = 0;
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
if(temp2<2) bestHand[color_1_idx] += (cards[color_1_idx] & (kickerValue1.select | kickerValue2.select));
|
||||||
|
else bestHand[color_1_idx] += (cards[color_1_idx] & kickerValue1.select);
|
||||||
|
if(cards[color_1_idx] & kickerValue2.select) temp2++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 600000000 + determineKickerValue(temp1,0,1).factorValue;
|
||||||
|
} else {
|
||||||
|
// one times Three of a Kind
|
||||||
|
int temp2 = temp1;
|
||||||
|
temp1 = 0;
|
||||||
|
// check for additional pair
|
||||||
|
for(color_1_idx=0; color_1_idx<3; color_1_idx++) {
|
||||||
|
for(color_2_idx=color_1_idx+1; color_2_idx<4; color_2_idx++) {
|
||||||
|
temp1 |= cards[color_1_idx] & cards[color_2_idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
temp1 &= ~temp2; // remove Three of a Kind from found pairs
|
||||||
|
if(temp1) {
|
||||||
|
// with additional pair
|
||||||
|
kickerValue1 = determineKickerValue(temp2,0,0);
|
||||||
|
kickerValue2 = determineKickerValue(temp1,1,1);
|
||||||
|
if(bestHand) {
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) bestHand[color_1_idx] = (cards[color_1_idx] & (kickerValue1.select | kickerValue2.select));
|
||||||
|
}
|
||||||
|
return 600000000 + kickerValue1.factorValue + kickerValue2.factorValue; // Full House
|
||||||
|
} else {
|
||||||
|
// without addition pair
|
||||||
|
kickerValue1 = determineKickerValue(temp2,0,0);
|
||||||
|
kickerValue2 = determineKickerValue(OR & ~temp2,1,2);
|
||||||
|
if(bestHand) {
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) bestHand[color_1_idx] = (cards[color_1_idx] & (kickerValue1.select | kickerValue2.select));
|
||||||
|
}
|
||||||
|
return 300000000 + kickerValue1.factorValue + kickerValue2.factorValue; // Three of a Kind
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Two Pairs, Two of a Kind
|
||||||
|
temp1 = 0;
|
||||||
|
for(color_1_idx=0; color_1_idx<3; color_1_idx++) {
|
||||||
|
for(color_2_idx=color_1_idx+1; color_2_idx<4; color_2_idx++) {
|
||||||
|
temp1 |= (cards[color_1_idx] & cards[color_2_idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(temp1) {
|
||||||
|
if(bitcount(temp1) >= 2) { // at least two times Two of a Kind
|
||||||
|
kickerValue1 = determineKickerValue(temp1,0,1);
|
||||||
|
kickerValue2 = determineKickerValue(OR & ~kickerValue1.select,2,2);
|
||||||
|
if(bestHand) {
|
||||||
|
temp1 = (kickerValue1.select | kickerValue2.select);
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
bestHand[color_1_idx] += (cards[color_1_idx] & temp1);
|
||||||
|
if(bestHand[color_1_idx] & kickerValue2.select) temp1 &= ~kickerValue2.select;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 200000000 + kickerValue1.factorValue + kickerValue2.factorValue; // Two Pairs
|
||||||
|
} else {
|
||||||
|
kickerValue1 = determineKickerValue(temp1,0,0);
|
||||||
|
kickerValue2 = determineKickerValue(OR & ~temp1,1,3);
|
||||||
|
if(bestHand) {
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
bestHand[color_1_idx] += (cards[color_1_idx] & (kickerValue1.select | kickerValue2.select));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 100000000 + kickerValue1.factorValue + kickerValue2.factorValue; // Two of a Kind
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// High Card
|
||||||
|
kickerValue1 = determineKickerValue(OR,0,4);
|
||||||
|
if(bestHand) {
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
bestHand[color_1_idx] += (cards[color_1_idx] & kickerValue1.select);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return kickerValue1.factorValue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int factor_kicker_short[4] = {1000000,10000,100,1};
|
||||||
|
static const int factor_kicker_long[5] = {1000000,10000,100,10,1};
|
||||||
|
|
||||||
|
KickerValue CardsValue::determineKickerValue(int testValue, int factorPointerStart, int factorPointerEnd)
|
||||||
|
{
|
||||||
|
KickerValue kickerValue;
|
||||||
|
kickerValue.factorValue = 0;
|
||||||
|
kickerValue.remain = testValue;
|
||||||
|
kickerValue.select = 0;
|
||||||
|
int compareValue = 4096;
|
||||||
|
int factorPointer = factorPointerStart;
|
||||||
|
for(int card_idx=0; (factorPointer<=factorPointerEnd) & (card_idx<13); card_idx++) {
|
||||||
|
if(kickerValue.remain >= compareValue) {
|
||||||
|
if(factorPointerEnd - factorPointerStart==4) kickerValue.factorValue += (12-card_idx)*factor_kicker_long[factorPointer];
|
||||||
|
else kickerValue.factorValue += (12-card_idx)*factor_kicker_short[factorPointer];
|
||||||
|
kickerValue.remain &= ~compareValue;
|
||||||
|
factorPointer++;
|
||||||
|
}
|
||||||
|
compareValue >>= 1;
|
||||||
|
}
|
||||||
|
kickerValue.select = testValue & ~kickerValue.remain;
|
||||||
|
return kickerValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector< std::vector<int> > CardsValue::calcCardsChance(GameState beRoID, int playerCards[2], int boardCards[5])
|
||||||
|
{
|
||||||
std::vector< std::vector<int> > chance(2);
|
std::vector< std::vector<int> > chance(2);
|
||||||
|
chance[0].assign(10,0);
|
||||||
|
chance[1].assign(10,0);
|
||||||
|
|
||||||
chance[0].resize(10);
|
int cards[4] = { 0,0,0,0 };
|
||||||
chance[1].resize(10);
|
|
||||||
|
|
||||||
for(i=0; i<10; i++) {
|
|
||||||
chance[0][i] = 0;
|
|
||||||
chance[1][i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cards[7];
|
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
|
|
||||||
cards[0] = playerCards[0];
|
int card_idx_1;
|
||||||
cards[1] = playerCards[1];
|
for(card_idx_1=0; card_idx_1<2; card_idx_1++) cards[playerCards[card_idx_1]/13] |= (1 << (playerCards[card_idx_1]%13));
|
||||||
for(i=0; i<5; i++) cards[i+2] = boardCards[i];
|
|
||||||
|
|
||||||
switch(beRoID) {
|
switch(beRoID) {
|
||||||
case GAME_STATE_PREFLOP: {
|
case GAME_STATE_PREFLOP: {
|
||||||
@@ -675,50 +538,60 @@ std::vector< std::vector<int> > CardsValue::calcCardsChance(GameState beRoID, in
|
|||||||
break;
|
break;
|
||||||
case GAME_STATE_FLOP: {
|
case GAME_STATE_FLOP: {
|
||||||
|
|
||||||
for(i=0; i<51; i++) {
|
for(card_idx_1=0; card_idx_1<3; card_idx_1++) cards[boardCards[card_idx_1]/13] |= (1 << (boardCards[card_idx_1]%13));
|
||||||
if(i!=cards[0] && i!=cards[1] && i!=cards[2] && i!=cards[3] && i!=cards[4]) {
|
|
||||||
for(j=i+1; j<52; j++) {
|
for(card_idx_1=0; card_idx_1<51; card_idx_1++) {
|
||||||
if(j!=cards[0] && j!=cards[1] && j!=cards[2] && j!=cards[3] && j!=cards[4]) {
|
if((cards[card_idx_1/13] & (1 << (card_idx_1%13))) == 0) {
|
||||||
cards[5] = i;
|
cards[card_idx_1/13] |= (1 << (card_idx_1%13));
|
||||||
cards[6] = j;
|
for(int card_idx_2=card_idx_1+1; card_idx_2<52; card_idx_2++) {
|
||||||
(chance[0][cardsValue(cards,0)/100000000])++;
|
if((cards[card_idx_2/13] & (1 << (card_idx_2%13))) == 0) {
|
||||||
|
cards[card_idx_2/13] |= (1 << (card_idx_2%13));
|
||||||
|
(chance[0][cardsValueShort(cards)])++;
|
||||||
sum++;
|
sum++;
|
||||||
|
cards[card_idx_2/13] &= ~(1 << (card_idx_2%13));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cards[card_idx_1/13] &= ~(1 << (card_idx_1%13));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0; i<10; i++) {
|
|
||||||
if(chance[0][i] > 0) chance[1][i] = 1;
|
|
||||||
chance[0][i] = (int)(((double)chance[0][i]/(double)sum)*100.0+0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GAME_STATE_TURN: {
|
case GAME_STATE_TURN: {
|
||||||
|
|
||||||
for(i=0; i<52; i++) {
|
for(card_idx_1=0; card_idx_1<4; card_idx_1++) cards[boardCards[card_idx_1]/13] |= (1 << (boardCards[card_idx_1]%13));
|
||||||
if(i!=cards[0] && i!=cards[1] && i!=cards[2] && i!=cards[3] && i!=cards[4] && i!=cards[5]) {
|
|
||||||
cards[6] = i;
|
for(card_idx_1=0; card_idx_1<52; card_idx_1++) {
|
||||||
(chance[0][cardsValue(cards,0)/100000000])++;
|
if((cards[card_idx_1/13] & (1 << (card_idx_1%13))) == 0) {
|
||||||
|
cards[card_idx_1/13] |= (1 << (card_idx_1%13));
|
||||||
|
(chance[0][cardsValueShort(cards)])++;
|
||||||
sum++;
|
sum++;
|
||||||
|
cards[card_idx_1/13] &= ~(1 << (card_idx_1%13));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0; i<10; i++) {
|
|
||||||
if(chance[0][i] > 0) chance[1][i] = 1;
|
|
||||||
chance[0][i] = (int)(((double)chance[0][i]/(double)sum)*100.0+0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GAME_STATE_RIVER: {
|
case GAME_STATE_RIVER: {
|
||||||
chance[0][cardsValue(cards,0)/100000000] = 100;
|
|
||||||
chance[1][cardsValue(cards,0)/100000000] = 1;
|
for(card_idx_1=0; card_idx_1<5; card_idx_1++) cards[boardCards[card_idx_1]/13] |= (1 << (boardCards[card_idx_1]%13));
|
||||||
|
|
||||||
|
chance[0][cardsValueShort(cards)] = 1;
|
||||||
|
sum = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(beRoID>GAME_STATE_PREFLOP) {
|
||||||
|
for(int hand_idx=0; hand_idx<10; hand_idx++) {
|
||||||
|
if(chance[0][hand_idx] > 0) chance[1][hand_idx] = 1;
|
||||||
|
chance[0][hand_idx] = (int)(((double)chance[0][hand_idx]/(double)sum)*100.0+0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return chance;
|
return chance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2320,6 +2193,44 @@ std::list<std::string> CardsValue::translateCardsValueCode(int cardsValueCode)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CardsValue::bitcount(int in)
|
||||||
|
{
|
||||||
|
int count=0 ;
|
||||||
|
while (in) {
|
||||||
|
count++ ;
|
||||||
|
in &= (in - 1) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
return count ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
CardsValue::bestHandToPosition(int bestHand[4], int cardArray[7], int position[5])
|
||||||
|
{
|
||||||
|
|
||||||
|
for(int card_idx=0; card_idx<5; card_idx++) position[card_idx] = -1;
|
||||||
|
|
||||||
|
int position_ctr = 0;
|
||||||
|
for(int color_idx=0; color_idx<4; color_idx++) {
|
||||||
|
for(int card_idx_1=0; card_idx_1<13; card_idx_1++) {
|
||||||
|
if(bestHand[color_idx] & (1<<card_idx_1)) {
|
||||||
|
for(int card_idx_2=0; card_idx_2<7; card_idx_2++) {
|
||||||
|
if(cardArray[card_idx_2] == color_idx*13+card_idx_1) {
|
||||||
|
if(position_ctr<5) {
|
||||||
|
position[position_ctr] = card_idx_2;
|
||||||
|
position_ctr++;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(position_ctr!=5) return 0;
|
||||||
|
else return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//int** CardsValue::showdown(GameState beRoID, int** playerCards, int playerCount) {
|
//int** CardsValue::showdown(GameState beRoID, int** playerCards, int playerCount) {
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -38,18 +38,28 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
struct KickerValue {
|
||||||
|
int factorValue;
|
||||||
|
int select;
|
||||||
|
int remain;
|
||||||
|
};
|
||||||
|
|
||||||
class CardsValue
|
class CardsValue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static int holeCardsClass(int, int);
|
static int holeCardsClass(int, int);
|
||||||
static int cardsValue(int*, int*);
|
static int cardsValueShort(int[4]);
|
||||||
|
static int cardsValue(int[4], int[4] = 0);
|
||||||
|
static KickerValue determineKickerValue(int, int, int);
|
||||||
static std::string determineHandName(int myCardsValueInt, PlayerList activePlayerList);
|
static std::string determineHandName(int myCardsValueInt, PlayerList activePlayerList);
|
||||||
static std::list<std::string> translateCardsValueCode(int cardsValueCode);
|
static std::list<std::string> translateCardsValueCode(int cardsValueCode);
|
||||||
|
|
||||||
static int holeCardsToIntCode(int*);
|
static int holeCardsToIntCode(int[2]);
|
||||||
static int* intCodeToHoleCards(int);
|
|
||||||
|
|
||||||
static std::vector< std::vector<int> > calcCardsChance(GameState, int*, int*);
|
static std::vector< std::vector<int> > calcCardsChance(GameState, int[2], int[5]);
|
||||||
|
|
||||||
|
static int bitcount(int in);
|
||||||
|
static int bestHandToPosition(int bestHand[4], int cardArray[7], int position[5]);
|
||||||
//static int** showdown(GameState, int**, int);
|
//static int** showdown(GameState, int**, int);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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();
|
||||||
@@ -147,26 +147,26 @@ void LocalBeRo::run()
|
|||||||
//log the turned cards
|
//log the turned cards
|
||||||
if(!logBoardCardsDone) {
|
if(!logBoardCardsDone) {
|
||||||
|
|
||||||
int tempBoardCardsArray[5];
|
int boardCards[5];
|
||||||
|
|
||||||
myHand->getBoard()->getMyCards(tempBoardCardsArray);
|
myHand->getBoard()->getMyCards(boardCards);
|
||||||
|
|
||||||
switch(myBeRoID) {
|
switch(myBeRoID) {
|
||||||
case GAME_STATE_FLOP:
|
case GAME_STATE_FLOP:
|
||||||
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2]);
|
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, boardCards[0], boardCards[1], boardCards[2]);
|
||||||
break;
|
break;
|
||||||
case GAME_STATE_TURN:
|
case GAME_STATE_TURN:
|
||||||
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3]);
|
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, boardCards[0], boardCards[1], boardCards[2], boardCards[3]);
|
||||||
break;
|
break;
|
||||||
case GAME_STATE_RIVER:
|
case GAME_STATE_RIVER:
|
||||||
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
|
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, boardCards[0], boardCards[1], boardCards[2], boardCards[3], boardCards[4]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR - wrong myBeRoID");
|
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR - wrong myBeRoID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(myHand->getLog()) myHand->getLog()->logBoardCards(tempBoardCardsArray);
|
if(myHand->getLog()) myHand->getLog()->logBoardCards(boardCards);
|
||||||
logBoardCardsDone = true;
|
logBoardCardsDone = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ protected:
|
|||||||
return myHand;
|
return myHand;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getDealerPosition() const {
|
unsigned getDealerPosition() const {
|
||||||
return dealerPosition;
|
return dealerPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ private:
|
|||||||
HandInterface* myHand;
|
HandInterface* myHand;
|
||||||
|
|
||||||
const GameState myBeRoID;
|
const GameState myBeRoID;
|
||||||
unsigned dealerPosition;
|
unsigned dealerPosition;
|
||||||
int smallBlindPosition;
|
int smallBlindPosition;
|
||||||
|
|
||||||
unsigned smallBlindPositionId;
|
unsigned smallBlindPositionId;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ void LocalBeRoPostRiver::postRiverRun()
|
|||||||
getMyHand()->getBoard()->determinePlayerNeedToShowCards();
|
getMyHand()->getBoard()->determinePlayerNeedToShowCards();
|
||||||
|
|
||||||
// Pot-Verteilung
|
// Pot-Verteilung
|
||||||
getMyHand()->getBoard()->distributePot(getDealerPosition());
|
getMyHand()->getBoard()->distributePot(getDealerPosition());
|
||||||
|
|
||||||
//Pot auf 0 setzen
|
//Pot auf 0 setzen
|
||||||
getMyHand()->getBoard()->setPot(0);
|
getMyHand()->getBoard()->setPot(0);
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ void LocalBoard::distributePot(unsigned dealerPosition)
|
|||||||
// determine the number of level winners
|
// determine the number of level winners
|
||||||
winnerCount = potLevel.size()-2;
|
winnerCount = potLevel.size()-2;
|
||||||
if (!winnerCount) {
|
if (!winnerCount) {
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_NO_WINNER);
|
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: no winner found");
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if this is the final pot level for at least one winner
|
// check if this is the final pot level for at least one winner
|
||||||
@@ -161,7 +161,7 @@ void LocalBoard::distributePot(unsigned dealerPosition)
|
|||||||
if(finalPot) break;
|
if(finalPot) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(finalPot) {
|
if(finalPot && winnerCount>0) {
|
||||||
// distribute the pot level sum to level winners
|
// distribute the pot level sum to level winners
|
||||||
mod = (potLevel[1])%winnerCount;
|
mod = (potLevel[1])%winnerCount;
|
||||||
// pot level sum divisible by winnerCount
|
// pot level sum divisible by winnerCount
|
||||||
@@ -175,13 +175,13 @@ void LocalBoard::distributePot(unsigned dealerPosition)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(it == seatsList->end()) {
|
if(it == seatsList->end()) {
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: seat not found");
|
||||||
|
} else {
|
||||||
|
(*it)->setMyCash( (*it)->getMyCash() + ((potLevel[1])/winnerCount));
|
||||||
|
// filling winners vector
|
||||||
|
winners.push_back((*it)->getMyUniqueID());
|
||||||
|
(*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount );
|
||||||
}
|
}
|
||||||
(*it)->setMyCash( (*it)->getMyCash() + ((potLevel[1])/winnerCount));
|
|
||||||
|
|
||||||
// filling winners vector
|
|
||||||
winners.push_back((*it)->getMyUniqueID());
|
|
||||||
(*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,8 @@ void LocalBoard::distributePot(unsigned dealerPosition)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(it == seatsList->end()) {
|
if(it == seatsList->end()) {
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
it = seatsList->begin();
|
||||||
|
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: dealer position not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
for(j=0; j<winnerCount; j++) {
|
for(j=0; j<winnerCount; j++) {
|
||||||
@@ -216,16 +217,18 @@ void LocalBoard::distributePot(unsigned dealerPosition)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(j<mod) {
|
if(winnerHit) {
|
||||||
(*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount) + 1);
|
if(j<mod) {
|
||||||
// filling winners vector
|
(*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount) + 1);
|
||||||
winners.push_back((*it)->getMyUniqueID());
|
// filling winners vector
|
||||||
(*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + ((potLevel[1])/winnerCount) + 1 );
|
winners.push_back((*it)->getMyUniqueID());
|
||||||
} else {
|
(*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + ((potLevel[1])/winnerCount) + 1 );
|
||||||
(*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount));
|
} else {
|
||||||
// filling winners vector
|
(*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount));
|
||||||
winners.push_back((*it)->getMyUniqueID());
|
// filling winners vector
|
||||||
(*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount );
|
winners.push_back((*it)->getMyUniqueID());
|
||||||
|
(*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class HandInterface;
|
|||||||
class LocalBoard : public BoardInterface
|
class LocalBoard : public BoardInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LocalBoard();
|
LocalBoard();
|
||||||
~LocalBoard();
|
~LocalBoard();
|
||||||
|
|
||||||
void setPlayerLists(PlayerList, PlayerList, PlayerList);
|
void setPlayerLists(PlayerList, PlayerList, PlayerList);
|
||||||
@@ -82,7 +82,7 @@ public:
|
|||||||
void collectSets() ;
|
void collectSets() ;
|
||||||
void collectPot() ;
|
void collectPot() ;
|
||||||
|
|
||||||
void distributePot(unsigned dealerPosition);
|
void distributePot(unsigned dealerPosition);
|
||||||
void determinePlayerNeedToShowCards();
|
void determinePlayerNeedToShowCards();
|
||||||
|
|
||||||
std::list<unsigned> getWinners() const {
|
std::list<unsigned> getWinners() const {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface
|
|||||||
boost::shared_ptr<BoardInterface>
|
boost::shared_ptr<BoardInterface>
|
||||||
LocalEngineFactory::createBoard()
|
LocalEngineFactory::createBoard()
|
||||||
{
|
{
|
||||||
return boost::shared_ptr<BoardInterface>(new LocalBoard());
|
return boost::shared_ptr<BoardInterface>(new LocalBoard());
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<PlayerInterface>
|
boost::shared_ptr<PlayerInterface>
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
@@ -53,12 +53,12 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
|||||||
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
||||||
(*it)->setHand(this);
|
(*it)->setHand(this);
|
||||||
// set myFlipCards 0
|
// set myFlipCards 0
|
||||||
(*it)->setMyCardsFlip(0, 0);
|
(*it)->setMyHoleCardsFlip(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate cards and assign to board and player
|
// generate cards and assign to board and player
|
||||||
const int NumCards = 52;
|
const int NumCards = 52;
|
||||||
int cardsArray[NumCards] = {
|
int cards[NumCards] = {
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||||
@@ -66,40 +66,50 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
|||||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
||||||
50, 51
|
50, 51
|
||||||
};
|
};
|
||||||
Tools::ShuffleArrayNonDeterministic(cardsArray, NumCards);
|
Tools::ShuffleArrayNonDeterministic(cards, NumCards);
|
||||||
int tempBoardArray[5];
|
int boardCards[5];
|
||||||
int tempPlayerArray[2];
|
int playerHoleCards[2];
|
||||||
int tempPlayerAndBoardArray[7];
|
int playerCards[7];
|
||||||
int bestHandPos[5];
|
|
||||||
int sBluff;
|
int sBluff;
|
||||||
for(i=0; i<5; i++) {
|
|
||||||
tempBoardArray[i] = cardsArray[i];
|
// board cards
|
||||||
tempPlayerAndBoardArray[i+2] = cardsArray[i];
|
for(i=0; i<5; i++) boardCards[i] = cards[i];
|
||||||
}
|
|
||||||
|
// debug mode
|
||||||
|
if(myLog) myLog->debugMode_getBoardCards(boardCards,myID);
|
||||||
|
|
||||||
|
// prepare whole player hand
|
||||||
|
for(i=0; i<5; i++) playerCards[i+2] = boardCards[i];
|
||||||
|
|
||||||
k = 0;
|
k = 0;
|
||||||
myBoard->setMyCards(tempBoardArray);
|
myBoard->setMyCards(boardCards);
|
||||||
for(it=activePlayerList->begin(); it!=activePlayerList->end(); ++it, k++) {
|
for(it=activePlayerList->begin(); it!=activePlayerList->end(); ++it, k++) {
|
||||||
|
|
||||||
(*it)->getMyBestHandPosition(bestHandPos);
|
// hole cards
|
||||||
|
for(j=0; j<2; j++) playerHoleCards[j] = cards[2*k+j+5];
|
||||||
|
(*it)->setMyHoleCards(playerHoleCards);
|
||||||
|
if(myLog) myLog->debugMode_getPlayerCards(playerHoleCards,myID,k); // debug mode
|
||||||
|
|
||||||
for(j=0; j<2; j++) {
|
// complete whole player hand
|
||||||
tempPlayerArray[j] = cardsArray[2*k+j+5];
|
for(j=0; j<2; j++) playerCards[j] = playerHoleCards[j];
|
||||||
tempPlayerAndBoardArray[j] = cardsArray[2*k+j+5];
|
|
||||||
|
// determine cards value
|
||||||
|
int bestHand[4] = { 0,0,0,0 };
|
||||||
|
int playerCardsColor[4] = { 0,0,0,0 };
|
||||||
|
for(j=0; j<7; j++) playerCardsColor[playerCards[j]/13] |= (1 << playerCards[j]%13);
|
||||||
|
(*it)->setMyCardsValueInt(CardsValue::cardsValue(playerCardsColor,bestHand));
|
||||||
|
|
||||||
|
// determine position of best 5 cards
|
||||||
|
int bestHandPos[5];
|
||||||
|
if(CardsValue::bestHandToPosition(bestHand,playerCards,bestHandPos)) {
|
||||||
|
(*it)->setMyBestHandPosition(bestHandPos);
|
||||||
|
} else {
|
||||||
|
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR getMyBestHandPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
(*it)->setMyCards(tempPlayerArray);
|
// set round start cash
|
||||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray, bestHandPos));
|
|
||||||
(*it)->setMyBestHandPosition(bestHandPos);
|
|
||||||
(*it)->setMyRoundStartCash((*it)->getMyCash());
|
(*it)->setMyRoundStartCash((*it)->getMyCash());
|
||||||
|
|
||||||
// error-check
|
|
||||||
for(j=0; j<5; j++) {
|
|
||||||
if (bestHandPos[j] == -1) {
|
|
||||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR getMyBestHandPosition");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set sBluff for all players --> TODO for ai-player in internet
|
// set sBluff for all players --> TODO for ai-player in internet
|
||||||
if((*it)->getMyID() != 0) {
|
if((*it)->getMyID() != 0) {
|
||||||
Tools::GetRand(1, 100, 1, &sBluff);
|
Tools::GetRand(1, 100, 1, &sBluff);
|
||||||
@@ -108,274 +118,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!! DEBUGGER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
|
// determine dealer, small blind, big blind
|
||||||
|
|
||||||
if(DEBUG_MODE) {
|
|
||||||
|
|
||||||
//QSqlDatabase *mySqliteLogDb;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// myGui->getMyW()->getSession();
|
|
||||||
|
|
||||||
//QSqlDatabase * test = myGui->getMyLog()->getMySqliteLogDb();
|
|
||||||
|
|
||||||
// if(!mySqliteLogDb->open()) {
|
|
||||||
// MyMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().c_str(), QMessageBox::Cancel);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int temp5Array[5];
|
|
||||||
|
|
||||||
switch(myID) {
|
|
||||||
|
|
||||||
case 1: {
|
|
||||||
|
|
||||||
tempBoardArray[0] = 4;
|
|
||||||
tempBoardArray[1] = 19;
|
|
||||||
tempBoardArray[2] = 20;
|
|
||||||
tempBoardArray[3] = 43;
|
|
||||||
tempBoardArray[4] = 49;
|
|
||||||
|
|
||||||
myBoard->setMyCards(tempBoardArray);
|
|
||||||
|
|
||||||
tempPlayerAndBoardArray[2] = tempBoardArray[0];
|
|
||||||
tempPlayerAndBoardArray[3] = tempBoardArray[1];
|
|
||||||
tempPlayerAndBoardArray[4] = tempBoardArray[2];
|
|
||||||
tempPlayerAndBoardArray[5] = tempBoardArray[3];
|
|
||||||
tempPlayerAndBoardArray[6] = tempBoardArray[4];
|
|
||||||
|
|
||||||
// player0
|
|
||||||
it = seatsList->begin();
|
|
||||||
|
|
||||||
tempPlayerArray[0] = 18;
|
|
||||||
tempPlayerArray[1] = 17;
|
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
|
|
||||||
(*it)->setMyCards(tempPlayerArray);
|
|
||||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
|
|
||||||
(*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player1
|
|
||||||
++it;
|
|
||||||
|
|
||||||
tempPlayerArray[0] = 31;
|
|
||||||
tempPlayerArray[1] = 8;
|
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
|
|
||||||
(*it)->setMyCards(tempPlayerArray);
|
|
||||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
|
|
||||||
(*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player2
|
|
||||||
++it;
|
|
||||||
|
|
||||||
tempPlayerArray[0] = 26;
|
|
||||||
tempPlayerArray[1] = 27;
|
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
|
|
||||||
(*it)->setMyCards(tempPlayerArray);
|
|
||||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
|
|
||||||
(*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player3
|
|
||||||
++it;
|
|
||||||
|
|
||||||
tempPlayerArray[0] = 31;
|
|
||||||
tempPlayerArray[1] = 30;
|
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
|
|
||||||
(*it)->setMyCards(tempPlayerArray);
|
|
||||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
|
|
||||||
(*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player4
|
|
||||||
++it;
|
|
||||||
|
|
||||||
tempPlayerArray[0] = 50;
|
|
||||||
tempPlayerArray[1] = 51;
|
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
|
|
||||||
(*it)->setMyCards(tempPlayerArray);
|
|
||||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
|
|
||||||
(*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player5
|
|
||||||
++it;
|
|
||||||
|
|
||||||
tempPlayerArray[0] = 25;
|
|
||||||
tempPlayerArray[1] = 24;
|
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
|
|
||||||
(*it)->setMyCards(tempPlayerArray);
|
|
||||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
|
|
||||||
(*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player6
|
|
||||||
++it;
|
|
||||||
|
|
||||||
tempPlayerArray[0] = 38;
|
|
||||||
tempPlayerArray[1] = 37;
|
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
|
|
||||||
(*it)->setMyCards(tempPlayerArray);
|
|
||||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
|
|
||||||
(*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player7
|
|
||||||
++it;
|
|
||||||
|
|
||||||
tempPlayerArray[0] = 32;
|
|
||||||
tempPlayerArray[1] = 33;
|
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
|
|
||||||
(*it)->setMyCards(tempPlayerArray);
|
|
||||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
|
|
||||||
(*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player8
|
|
||||||
++it;
|
|
||||||
|
|
||||||
tempPlayerArray[0] = 19;
|
|
||||||
tempPlayerArray[1] = 20;
|
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
|
|
||||||
(*it)->setMyCards(tempPlayerArray);
|
|
||||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
|
|
||||||
(*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2: {
|
|
||||||
|
|
||||||
/* tempBoardArray[0] = 48;
|
|
||||||
tempBoardArray[1] = 21;
|
|
||||||
tempBoardArray[2] = 4;
|
|
||||||
tempBoardArray[3] = 9;
|
|
||||||
tempBoardArray[4] = 0;
|
|
||||||
|
|
||||||
myBoard->setMyCards(tempBoardArray);
|
|
||||||
|
|
||||||
tempPlayerAndBoardArray[2] = tempBoardArray[0];
|
|
||||||
tempPlayerAndBoardArray[3] = tempBoardArray[1];
|
|
||||||
tempPlayerAndBoardArray[4] = tempBoardArray[2];
|
|
||||||
tempPlayerAndBoardArray[5] = tempBoardArray[3];
|
|
||||||
tempPlayerAndBoardArray[6] = tempBoardArray[4];*/
|
|
||||||
|
|
||||||
// player0
|
|
||||||
it = seatsList->begin();
|
|
||||||
|
|
||||||
// tempPlayerArray[0] = 9;
|
|
||||||
// tempPlayerArray[1] = 5;
|
|
||||||
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
//
|
|
||||||
// (*it)->setMyCards(tempPlayerArray);
|
|
||||||
// (*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
//
|
|
||||||
// (*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player1
|
|
||||||
++it;
|
|
||||||
|
|
||||||
// tempPlayerArray[0] = 47;
|
|
||||||
// tempPlayerArray[1] = 22;
|
|
||||||
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
//
|
|
||||||
// (*it)->setMyCards(tempPlayerArray);
|
|
||||||
// (*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
//
|
|
||||||
// (*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player2
|
|
||||||
++it;
|
|
||||||
|
|
||||||
// tempPlayerArray[0] = 33;
|
|
||||||
// tempPlayerArray[1] = 27;
|
|
||||||
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
//
|
|
||||||
// (*it)->setMyCards(tempPlayerArray);
|
|
||||||
// (*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
//
|
|
||||||
// (*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player3
|
|
||||||
++it;
|
|
||||||
|
|
||||||
// tempPlayerArray[0] = 38;
|
|
||||||
// tempPlayerArray[1] = 22;
|
|
||||||
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
//
|
|
||||||
// (*it)->setMyCards(tempPlayerArray);
|
|
||||||
// (*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
//
|
|
||||||
// (*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player4
|
|
||||||
++it;
|
|
||||||
|
|
||||||
// tempPlayerArray[0] = 25;
|
|
||||||
// tempPlayerArray[1] = 16;
|
|
||||||
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
//
|
|
||||||
// (*it)->setMyCards(tempPlayerArray);
|
|
||||||
// (*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
//
|
|
||||||
// (*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
// player5
|
|
||||||
++it;
|
|
||||||
|
|
||||||
// tempPlayerArray[0] = 27;
|
|
||||||
// tempPlayerArray[1] = 10;
|
|
||||||
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
||||||
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
//
|
|
||||||
// (*it)->setMyCards(tempPlayerArray);
|
|
||||||
// (*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
||||||
//
|
|
||||||
// (*it)->setMyBestHandPosition(temp5Array);
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
// ----------------------------------------
|
|
||||||
|
|
||||||
// determine dealer, SB, BB
|
|
||||||
|
|
||||||
assignButtons();
|
assignButtons();
|
||||||
|
|
||||||
setBlinds();
|
setBlinds();
|
||||||
|
|
||||||
if(myLog) myLog->logNewHandMsg(myID, dealerPosition+1, smallBlind, smallBlindPosition+1, 2*smallBlind, bigBlindPosition+1, seatsList);
|
if(myLog) myLog->logNewHandMsg(myID, dealerPosition+1, smallBlind, smallBlindPosition+1, 2*smallBlind, bigBlindPosition+1, seatsList);
|
||||||
@@ -401,7 +145,6 @@ void LocalHand::start()
|
|||||||
} else {
|
} else {
|
||||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): Log Error: cannot find sBID or bBID");
|
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): Log Error: cannot find sBID or bBID");
|
||||||
}
|
}
|
||||||
myGui->flushLogAtHand();
|
|
||||||
|
|
||||||
// deal cards
|
// deal cards
|
||||||
myGui->dealHoleCards();
|
myGui->dealHoleCards();
|
||||||
@@ -416,20 +159,19 @@ void LocalHand::start()
|
|||||||
void LocalHand::assignButtons()
|
void LocalHand::assignButtons()
|
||||||
{
|
{
|
||||||
|
|
||||||
size_t i;
|
PlayerListIterator seatIt;
|
||||||
PlayerListIterator it;
|
|
||||||
|
|
||||||
// delete all buttons
|
// delete all buttons
|
||||||
for (it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
for (seatIt=seatsList->begin(); seatIt!=seatsList->end(); ++seatIt) {
|
||||||
(*it)->setMyButton(BUTTON_NONE);
|
(*seatIt)->setMyButton(BUTTON_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign dealer button
|
// assign dealer button
|
||||||
it = getSeatIt(dealerPosition);
|
seatIt = getSeatIt(dealerPosition);
|
||||||
if(it == seatsList->end()) {
|
if(seatIt == seatsList->end()) {
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||||
}
|
}
|
||||||
(*it)->setMyButton(BUTTON_DEALER);
|
(*seatIt)->setMyButton(BUTTON_DEALER);
|
||||||
|
|
||||||
|
|
||||||
// assign Small Blind next to dealer. ATTENTION: in heads up it is big blind
|
// assign Small Blind next to dealer. ATTENTION: in heads up it is big blind
|
||||||
@@ -440,40 +182,40 @@ void LocalHand::assignButtons()
|
|||||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<seatsList->size(); i++) {
|
for(size_t i=0; i<seatsList->size(); i++) {
|
||||||
|
|
||||||
++dealerPositionIt;
|
++dealerPositionIt;
|
||||||
if(dealerPositionIt == seatsList->end()) dealerPositionIt = seatsList->begin();
|
if(dealerPositionIt == seatsList->end()) dealerPositionIt = seatsList->begin();
|
||||||
|
|
||||||
it = getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() );
|
PlayerListIterator activePlayerIt = getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() );
|
||||||
if(it != activePlayerList->end() ) {
|
if(activePlayerIt != activePlayerList->end() ) {
|
||||||
nextActivePlayerFound = true;
|
nextActivePlayerFound = true;
|
||||||
if(activePlayerList->size() > 2) {
|
if(activePlayerList->size() > 2) {
|
||||||
//small blind normal
|
//small blind normal
|
||||||
(*it)->setMyButton(2);
|
(*activePlayerIt)->setMyButton(2);
|
||||||
smallBlindPosition = (*it)->getMyUniqueID();
|
smallBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||||
} else {
|
} else {
|
||||||
//big blind in heads up
|
//big blind in heads up
|
||||||
(*it)->setMyButton(3);
|
(*activePlayerIt)->setMyButton(3);
|
||||||
bigBlindPosition = (*it)->getMyUniqueID();
|
bigBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||||
// lastPlayerAction for showing cards
|
// lastPlayerAction for showing cards
|
||||||
}
|
}
|
||||||
|
|
||||||
// first player after dealer have to show his cards first (in showdown)
|
// first player after dealer have to show his cards first (in showdown)
|
||||||
lastActionPlayerID = (*it)->getMyUniqueID();
|
lastActionPlayerID = (*activePlayerIt)->getMyUniqueID();
|
||||||
myBoard->setLastActionPlayerID(lastActionPlayerID);
|
myBoard->setLastActionPlayerID(lastActionPlayerID);
|
||||||
|
|
||||||
++it;
|
++activePlayerIt;
|
||||||
if(it == activePlayerList->end()) it = activePlayerList->begin();
|
if(activePlayerIt == activePlayerList->end()) activePlayerIt = activePlayerList->begin();
|
||||||
|
|
||||||
if(activePlayerList->size() > 2) {
|
if(activePlayerList->size() > 2) {
|
||||||
//big blind normal
|
//big blind normal
|
||||||
(*it)->setMyButton(3);
|
(*activePlayerIt)->setMyButton(3);
|
||||||
bigBlindPosition = (*it)->getMyUniqueID();
|
bigBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||||
} else {
|
} else {
|
||||||
//small blind in heads up
|
//small blind in heads up
|
||||||
(*it)->setMyButton(2);
|
(*activePlayerIt)->setMyButton(2);
|
||||||
smallBlindPosition = (*it)->getMyUniqueID();
|
smallBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -653,11 +395,11 @@ void LocalHand::switchRounds()
|
|||||||
|
|
||||||
//log board cards for allin
|
//log board cards for allin
|
||||||
if(currentRound >= GAME_STATE_FLOP) {
|
if(currentRound >= GAME_STATE_FLOP) {
|
||||||
int tempBoardCardsArray[5];
|
int boardCards[5];
|
||||||
|
|
||||||
myBoard->getMyCards(tempBoardCardsArray);
|
myBoard->getMyCards(boardCards);
|
||||||
myGui->logDealBoardCardsMsg(currentRound, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
|
myGui->logDealBoardCardsMsg(currentRound, boardCards[0], boardCards[1], boardCards[2], boardCards[3], boardCards[4]);
|
||||||
if(myLog) myLog->logBoardCards(tempBoardCardsArray);
|
if(myLog) myLog->logBoardCards(boardCards);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+737
-1938
File diff suppressed because it is too large.
Load diff
@@ -48,8 +48,9 @@ public:
|
|||||||
|
|
||||||
~LocalPlayer();
|
~LocalPlayer();
|
||||||
|
|
||||||
void setHand(HandInterface *);
|
void setHand(HandInterface *theValue) {
|
||||||
|
currentHand = theValue;
|
||||||
|
}
|
||||||
int getMyID() const {
|
int getMyID() const {
|
||||||
return myID;
|
return myID;
|
||||||
}
|
}
|
||||||
@@ -156,13 +157,13 @@ public:
|
|||||||
return myStayOnTableStatus;
|
return myStayOnTableStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMyCards(int* theValue) {
|
void setMyHoleCards(int* theValue) {
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<2; i++) myCards[i] = theValue[i];
|
for(i=0; i<2; i++) myHoleCards[i] = theValue[i];
|
||||||
}
|
}
|
||||||
void getMyCards(int* theValue) const {
|
void getMyHoleCards(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] = myHoleCards[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMyTurn(bool theValue) {
|
void setMyTurn(bool theValue) {
|
||||||
@@ -172,27 +173,27 @@ public:
|
|||||||
return myTurn;
|
return myTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMyCardsFlip(bool theValue, int state) {
|
void setMyHoleCardsFlip(bool theValue, int state) {
|
||||||
myCardsFlip = theValue;
|
myHoleCardsFlip = theValue;
|
||||||
// log flipping cards
|
// log flipping cards
|
||||||
if(myCardsFlip) {
|
if(myHoleCardsFlip) {
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case 1:
|
case 1:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt);
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1]);
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1]);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt, "has");
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt, "has");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool getMyCardsFlip() const {
|
bool getMyHoleCardsFlip() const {
|
||||||
return myCardsFlip;
|
return myHoleCardsFlip;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMyCardsValueInt(int theValue) {
|
void setMyCardsValueInt(int theValue) {
|
||||||
@@ -281,10 +282,10 @@ public:
|
|||||||
void turnEngine();
|
void turnEngine();
|
||||||
void riverEngine();
|
void riverEngine();
|
||||||
|
|
||||||
void preflopEngine3();
|
// void preflopEngine3();
|
||||||
void flopEngine3();
|
// void flopEngine3();
|
||||||
void turnEngine3();
|
// void turnEngine3();
|
||||||
void riverEngine3();
|
// void riverEngine3();
|
||||||
|
|
||||||
int flopCardsValue(int*);
|
int flopCardsValue(int*);
|
||||||
int turnCardsValue(int*);
|
int turnCardsValue(int*);
|
||||||
@@ -328,7 +329,7 @@ private:
|
|||||||
int myNiveau[3];
|
int myNiveau[3];
|
||||||
bool logHoleCardsDone;
|
bool logHoleCardsDone;
|
||||||
|
|
||||||
int myCards[2];
|
int myHoleCards[2];
|
||||||
int myCash;
|
int myCash;
|
||||||
int mySet;
|
int mySet;
|
||||||
int myLastRelativeSet;
|
int myLastRelativeSet;
|
||||||
@@ -337,7 +338,7 @@ private:
|
|||||||
bool myActiveStatus; // 0 = inactive, 1 = active
|
bool myActiveStatus; // 0 = inactive, 1 = active
|
||||||
bool myStayOnTableStatus; // 0 = left, 1 = stay
|
bool myStayOnTableStatus; // 0 = left, 1 = stay
|
||||||
bool myTurn; // 0 = no, 1 = yes
|
bool myTurn; // 0 = no, 1 = yes
|
||||||
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
|
bool myHoleCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
|
||||||
int myRoundStartCash;
|
int myRoundStartCash;
|
||||||
int lastMoneyWon;
|
int lastMoneyWon;
|
||||||
|
|
||||||
|
|||||||
@@ -82,4 +82,3 @@ void Tools::GetRand(int minValue, int maxValue, unsigned count, int *out)
|
|||||||
*startPtr++ = gen();
|
*startPtr++ = gen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+518
-400
File diff suppressed because it is too large.
Load diff
@@ -66,6 +66,16 @@ public:
|
|||||||
void logAfterGame();
|
void logAfterGame();
|
||||||
// void closeLogDbAtExit();
|
// void closeLogDbAtExit();
|
||||||
|
|
||||||
|
void debugMode_getStartSmallBlind(int* startSmallBlind, int* currentSmallBlind);
|
||||||
|
void debugMode_getStartDealerPosition(unsigned* dealerPosition);
|
||||||
|
void debugMode_getBoardCards(int* tempBoardArray, int handID);
|
||||||
|
void debugMode_getPlayerCards(int* tempPlayerArray, int handID, int seatID);
|
||||||
|
void debugMode_getPlayerStartCash(int* startCash, int seatID);
|
||||||
|
void debugMode_getPlayerAction(PlayerAction* playerAction, int* bet, int* raise, GameState gameState, int handID, int seatID, int mySet);
|
||||||
|
bool getDebugMode() {
|
||||||
|
return debug_mode;
|
||||||
|
}
|
||||||
|
|
||||||
void setCurrentRound(GameState theValue) {
|
void setCurrentRound(GameState theValue) {
|
||||||
currentRound = theValue;
|
currentRound = theValue;
|
||||||
}
|
}
|
||||||
@@ -85,6 +95,8 @@ private:
|
|||||||
int currentHandID;
|
int currentHandID;
|
||||||
GameState currentRound;
|
GameState currentRound;
|
||||||
std::string sql;
|
std::string sql;
|
||||||
|
|
||||||
|
bool debug_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LOG_H
|
#endif // LOG_H
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boos
|
|||||||
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
||||||
(*it)->setHand(this);
|
(*it)->setHand(this);
|
||||||
// myFlipCards auf 0 setzen
|
// myFlipCards auf 0 setzen
|
||||||
(*it)->setMyCardsFlip(0, 0);
|
(*it)->setMyHoleCardsFlip(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// roundStartCashArray fuellen
|
// roundStartCashArray fuellen
|
||||||
|
|||||||
@@ -38,12 +38,12 @@ using namespace std;
|
|||||||
ClientPlayer::ClientPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB)
|
ClientPlayer::ClientPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB)
|
||||||
: PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type),
|
: PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type),
|
||||||
myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), logHoleCardsDone(false), myCash(sC), mySet(0), myLastRelativeSet(0),
|
myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), logHoleCardsDone(false), myCash(sC), mySet(0), myLastRelativeSet(0),
|
||||||
myAction(PLAYER_ACTION_NONE), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(sotS), myTurn(false), myCardsFlip(false), myRoundStartCash(0),
|
myAction(PLAYER_ACTION_NONE), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(sotS), myTurn(false), myHoleCardsFlip(false), myRoundStartCash(0),
|
||||||
lastMoneyWon(0), sBluff(0), sBluffStatus(false), m_isSessionActive(false), m_isKicked(false), m_isMuted(false)
|
lastMoneyWon(0), sBluff(0), sBluffStatus(false), m_isSessionActive(false), m_isKicked(false), m_isMuted(false)
|
||||||
{
|
{
|
||||||
myBestHandPosition[0] = myBestHandPosition[1] = myBestHandPosition[2] = myBestHandPosition[3] = myBestHandPosition[4] = 0;
|
myBestHandPosition[0] = myBestHandPosition[1] = myBestHandPosition[2] = myBestHandPosition[3] = myBestHandPosition[4] = 0;
|
||||||
myNiveau[0] = myNiveau[1] = myNiveau[2] = 0;
|
myNiveau[0] = myNiveau[1] = myNiveau[2] = 0;
|
||||||
myCards[0] = myCards[1] = 0;
|
myHoleCards[0] = myHoleCards[1] = 0;
|
||||||
myAverageSets[0] = myAverageSets[1] = myAverageSets[2] = myAverageSets[3] = 0;
|
myAverageSets[0] = myAverageSets[1] = myAverageSets[2] = myAverageSets[3] = 0;
|
||||||
myAggressive[0] = myAggressive[1] = myAggressive[2] = myAggressive[3] = myAggressive[4] = myAggressive[5] = myAggressive[6] = false;
|
myAggressive[0] = myAggressive[1] = myAggressive[2] = myAggressive[3] = myAggressive[4] = myAggressive[5] = myAggressive[6] = false;
|
||||||
}
|
}
|
||||||
@@ -264,19 +264,19 @@ ClientPlayer::getMyStayOnTableStatus() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientPlayer::setMyCards(int* theValue)
|
ClientPlayer::setMyHoleCards(int* theValue)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
myCards[i] = theValue[i];
|
myHoleCards[i] = theValue[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientPlayer::getMyCards(int* theValue) const
|
ClientPlayer::getMyHoleCards(int* theValue) const
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
theValue[i] = myCards[i];
|
theValue[i] = myHoleCards[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -294,21 +294,21 @@ ClientPlayer::getMyTurn() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientPlayer::setMyCardsFlip(bool theValue, int state)
|
ClientPlayer::setMyHoleCardsFlip(bool theValue, int state)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||||
myCardsFlip = theValue;
|
myHoleCardsFlip = theValue;
|
||||||
// log flipping cards
|
// log flipping cards
|
||||||
if (myCardsFlip) {
|
if (myHoleCardsFlip) {
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case 1:
|
case 1:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt);
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1]);
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1]);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt, "has");
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt, "has");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
@@ -317,10 +317,10 @@ ClientPlayer::setMyCardsFlip(bool theValue, int state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ClientPlayer::getMyCardsFlip() const
|
ClientPlayer::getMyHoleCardsFlip() const
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||||
return myCardsFlip;
|
return myHoleCardsFlip;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -89,14 +89,14 @@ public:
|
|||||||
void setMyStayOnTableStatus(bool theValue);
|
void setMyStayOnTableStatus(bool theValue);
|
||||||
bool getMyStayOnTableStatus() const;
|
bool getMyStayOnTableStatus() const;
|
||||||
|
|
||||||
void setMyCards(int* theValue);
|
void setMyHoleCards(int* theValue);
|
||||||
void getMyCards(int* theValue) const;
|
void getMyHoleCards(int* theValue) const;
|
||||||
|
|
||||||
void setMyTurn(bool theValue);
|
void setMyTurn(bool theValue);
|
||||||
bool getMyTurn() const;
|
bool getMyTurn() const;
|
||||||
|
|
||||||
void setMyCardsFlip(bool theValue, int state);
|
void setMyHoleCardsFlip(bool theValue, int state);
|
||||||
bool getMyCardsFlip() const;
|
bool getMyHoleCardsFlip() const;
|
||||||
|
|
||||||
void setMyCardsValueInt(int theValue);
|
void setMyCardsValueInt(int theValue);
|
||||||
int getMyCardsValueInt() const;
|
int getMyCardsValueInt() const;
|
||||||
@@ -184,7 +184,7 @@ private:
|
|||||||
int myNiveau[3];
|
int myNiveau[3];
|
||||||
bool logHoleCardsDone;
|
bool logHoleCardsDone;
|
||||||
|
|
||||||
int myCards[2];
|
int myHoleCards[2];
|
||||||
int myCash;
|
int myCash;
|
||||||
int mySet;
|
int mySet;
|
||||||
int myLastRelativeSet;
|
int myLastRelativeSet;
|
||||||
@@ -193,7 +193,7 @@ private:
|
|||||||
bool myActiveStatus; // 0 = inactive, 1 = active
|
bool myActiveStatus; // 0 = inactive, 1 = active
|
||||||
bool myStayOnTableStatus; // 0 = left, 1 = stay
|
bool myStayOnTableStatus; // 0 = left, 1 = stay
|
||||||
bool myTurn; // 0 = no, 1 = yes
|
bool myTurn; // 0 = no, 1 = yes
|
||||||
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
|
bool myHoleCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
|
||||||
int myRoundStartCash;
|
int myRoundStartCash;
|
||||||
int lastMoneyWon;
|
int lastMoneyWon;
|
||||||
|
|
||||||
|
|||||||
@@ -87,14 +87,14 @@ public:
|
|||||||
virtual void setMyStayOnTableStatus(bool theValue) =0;
|
virtual void setMyStayOnTableStatus(bool theValue) =0;
|
||||||
virtual bool getMyStayOnTableStatus() const =0;
|
virtual bool getMyStayOnTableStatus() const =0;
|
||||||
|
|
||||||
virtual void setMyCards(int* theValue) =0;
|
virtual void setMyHoleCards(int* theValue) =0;
|
||||||
virtual void getMyCards(int* theValue) const =0;
|
virtual void getMyHoleCards(int* theValue) const =0;
|
||||||
|
|
||||||
virtual void setMyTurn(bool theValue) =0;
|
virtual void setMyTurn(bool theValue) =0;
|
||||||
virtual bool getMyTurn() const =0;
|
virtual bool getMyTurn() const =0;
|
||||||
|
|
||||||
virtual void setMyCardsFlip(bool theValue, int state) =0;
|
virtual void setMyHoleCardsFlip(bool theValue, int state) =0;
|
||||||
virtual bool getMyCardsFlip() const =0;
|
virtual bool getMyHoleCardsFlip() const =0;
|
||||||
|
|
||||||
virtual void setMyCardsValueInt(int theValue) =0;
|
virtual void setMyCardsValueInt(int theValue) =0;
|
||||||
virtual int getMyCardsValueInt() const =0;
|
virtual int getMyCardsValueInt() const =0;
|
||||||
|
|||||||
+2
-5
@@ -37,10 +37,6 @@
|
|||||||
#define MIN_GUI_SPEED 1
|
#define MIN_GUI_SPEED 1
|
||||||
#define MAX_GUI_SPEED 11
|
#define MAX_GUI_SPEED 11
|
||||||
|
|
||||||
#define DEBUG_MODE 0
|
|
||||||
#define SQLITE_LOG 1
|
|
||||||
#define HTML_LOG 0
|
|
||||||
|
|
||||||
#define POKERTH_VERSION_MAJOR 1
|
#define POKERTH_VERSION_MAJOR 1
|
||||||
#define POKERTH_VERSION_MINOR 11
|
#define POKERTH_VERSION_MINOR 11
|
||||||
#define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR)
|
#define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR)
|
||||||
@@ -58,7 +54,8 @@
|
|||||||
enum ServerMode {
|
enum ServerMode {
|
||||||
SERVER_MODE_LAN,
|
SERVER_MODE_LAN,
|
||||||
SERVER_MODE_INTERNET_NOAUTH,
|
SERVER_MODE_INTERNET_NOAUTH,
|
||||||
SERVER_MODE_INTERNET_AUTH
|
SERVER_MODE_INTERNET_AUTH,
|
||||||
|
SERVER_MODE_LAN_LOCAL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ServerTransportProtocol {
|
enum ServerTransportProtocol {
|
||||||
|
|||||||
@@ -105,8 +105,6 @@ void ServerGuiWrapper::logNewBlindsSetsMsg(int /*sbSet*/, int /*bbSet*/, std::st
|
|||||||
void ServerGuiWrapper::logDealBoardCardsMsg(int /*roundID*/, int /*card1*/, int /*card2*/, int /*card3*/, int /*card4*/, int /*card5*/) {}
|
void ServerGuiWrapper::logDealBoardCardsMsg(int /*roundID*/, int /*card1*/, int /*card2*/, int /*card3*/, int /*card4*/, int /*card5*/) {}
|
||||||
void ServerGuiWrapper::logFlipHoleCardsMsg(std::string /*playerName*/, int /*card1*/, int /*card2*/, int /*cardsValueInt*/, std::string /*showHas*/) {}
|
void ServerGuiWrapper::logFlipHoleCardsMsg(std::string /*playerName*/, int /*card1*/, int /*card2*/, int /*cardsValueInt*/, std::string /*showHas*/) {}
|
||||||
void ServerGuiWrapper::logPlayerWinGame(std::string /*playerName*/, int /*gameID*/) {}
|
void ServerGuiWrapper::logPlayerWinGame(std::string /*playerName*/, int /*gameID*/) {}
|
||||||
void ServerGuiWrapper::flushLogAtGame(int /*gameID*/) {}
|
|
||||||
void ServerGuiWrapper::flushLogAtHand() {}
|
|
||||||
|
|
||||||
void ServerGuiWrapper::SignalNetClientServerListAdd(unsigned serverId)
|
void ServerGuiWrapper::SignalNetClientServerListAdd(unsigned serverId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -118,8 +118,6 @@ public:
|
|||||||
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) ;
|
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) ;
|
||||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
|
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
|
||||||
void logPlayerWinGame(std::string playerName, int gameID);
|
void logPlayerWinGame(std::string playerName, int gameID);
|
||||||
void flushLogAtGame(int gameID);
|
|
||||||
void flushLogAtHand();
|
|
||||||
|
|
||||||
void SignalNetClientConnect(int actionID);
|
void SignalNetClientConnect(int actionID);
|
||||||
void SignalNetClientGameInfo(int actionID);
|
void SignalNetClientGameInfo(int actionID);
|
||||||
|
|||||||
@@ -119,8 +119,6 @@ public:
|
|||||||
virtual void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) = 0;
|
virtual void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) = 0;
|
||||||
virtual void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") = 0;
|
virtual void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") = 0;
|
||||||
virtual void logPlayerWinGame(std::string playerName, int gameID) =0;
|
virtual void logPlayerWinGame(std::string playerName, int gameID) =0;
|
||||||
virtual void flushLogAtGame(int gameID) =0;
|
|
||||||
virtual void flushLogAtHand() =0;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#ifndef ANDROID_TEST
|
#ifndef ANDROID_TEST
|
||||||
#include "QtGui/5.2.0/QtGui/qpa/qplatformnativeinterface.h"
|
#include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ bool changeCompleteBlindsDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
|||||||
event->ignore();
|
event->ignore();
|
||||||
return false;
|
return false;
|
||||||
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
||||||
this->reject();
|
event->ignore();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// pass the event on to the parent class
|
// pass the event on to the parent class
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ bool changeContentDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
|||||||
event->ignore();
|
event->ignore();
|
||||||
return false;
|
return false;
|
||||||
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
||||||
this->reject();
|
event->ignore();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// pass the event on to the parent class
|
// pass the event on to the parent class
|
||||||
|
|||||||
@@ -284,8 +284,7 @@ bool createInternetGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
|||||||
|
|
||||||
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
this->reject();
|
return true;
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
// pass the event on to the parent class
|
// pass the event on to the parent class
|
||||||
return QDialog::eventFilter(obj, event);
|
return QDialog::eventFilter(obj, event);
|
||||||
|
|||||||
@@ -160,8 +160,7 @@ bool createNetworkGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
|||||||
return false;
|
return false;
|
||||||
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
this->reject();
|
return true;
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
// pass the event on to the parent class
|
// pass the event on to the parent class
|
||||||
return QDialog::eventFilter(obj, event);
|
return QDialog::eventFilter(obj, event);
|
||||||
|
|||||||
@@ -1412,8 +1412,7 @@ bool gameLobbyDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
|||||||
return QDialog::eventFilter(obj, event);
|
return QDialog::eventFilter(obj, event);
|
||||||
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
this->reject();
|
return true;
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
// pass the event on to the parent class
|
// pass the event on to the parent class
|
||||||
return QDialog::eventFilter(obj, event);
|
return QDialog::eventFilter(obj, event);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#ifndef ANDROID_TEST
|
#ifndef ANDROID_TEST
|
||||||
#include "QtGui/5.2.0/QtGui/qpa/qplatformnativeinterface.h"
|
#include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -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);
|
||||||
@@ -792,20 +792,20 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog)
|
|||||||
//refresh board cards if game is running
|
//refresh board cards if game is running
|
||||||
if(myStartWindow->getSession()->getCurrentGame()) {
|
if(myStartWindow->getSession()->getCurrentGame()) {
|
||||||
|
|
||||||
int tempBoardCardsArray[5];
|
int boardCards[5];
|
||||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||||
GameState currentState = myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->getMyBeRoID();
|
GameState currentState = myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->getMyBeRoID();
|
||||||
if(currentState >= GAME_STATE_FLOP && currentState <= GAME_STATE_POST_RIVER)
|
if(currentState >= GAME_STATE_FLOP && currentState <= GAME_STATE_POST_RIVER)
|
||||||
for(int i=0; i<3; i++) {
|
for(int i=0; i<3; i++) {
|
||||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[i], 10)+".png"));
|
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[i], 10)+".png"));
|
||||||
boardCardsArray[i]->setPixmap(card, false);
|
boardCardsArray[i]->setPixmap(card, false);
|
||||||
}
|
}
|
||||||
if(currentState >= GAME_STATE_TURN && currentState <= GAME_STATE_POST_RIVER) {
|
if(currentState >= GAME_STATE_TURN && currentState <= GAME_STATE_POST_RIVER) {
|
||||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[3], 10)+".png"));
|
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[3], 10)+".png"));
|
||||||
boardCardsArray[3]->setPixmap(card, false);
|
boardCardsArray[3]->setPixmap(card, false);
|
||||||
}
|
}
|
||||||
if(currentState == GAME_STATE_RIVER || currentState == GAME_STATE_POST_RIVER) {
|
if(currentState == GAME_STATE_RIVER || currentState == GAME_STATE_POST_RIVER) {
|
||||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[4], 10)+".png"));
|
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[4], 10)+".png"));
|
||||||
boardCardsArray[4]->setPixmap(card, false);
|
boardCardsArray[4]->setPixmap(card, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -834,7 +834,7 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog)
|
|||||||
QPixmap tempCardsPixmapArray[2];
|
QPixmap tempCardsPixmapArray[2];
|
||||||
int tempCardsIntArray[2];
|
int tempCardsIntArray[2];
|
||||||
|
|
||||||
humanPlayer->getMyCards(tempCardsIntArray);
|
humanPlayer->getMyHoleCards(tempCardsIntArray);
|
||||||
if(myConfig->readConfigInt("AntiPeekMode")) {
|
if(myConfig->readConfigInt("AntiPeekMode")) {
|
||||||
holeCardsArray[0][0]->setPixmap(flipside, true);
|
holeCardsArray[0][0]->setPixmap(flipside, true);
|
||||||
tempCardsPixmapArray[0] = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[0], 10)+".png"));
|
tempCardsPixmapArray[0] = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[0], 10)+".png"));
|
||||||
@@ -1440,10 +1440,10 @@ void gameTableImpl::dealHoleCards()
|
|||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
PlayerList seatsList = currentGame->getSeatsList();
|
PlayerList seatsList = currentGame->getSeatsList();
|
||||||
for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||||
(*it_c)->getMyCards(tempCardsIntArray);
|
(*it_c)->getMyHoleCards(tempCardsIntArray);
|
||||||
for(j=0; j<2; j++) {
|
for(j=0; j<2; j++) {
|
||||||
if((*it_c)->getMyActiveStatus()) {
|
if((*it_c)->getMyActiveStatus()) {
|
||||||
if (( (*it_c)->getMyID() == 0)/* || DEBUG_MODE*/) {
|
if (( (*it_c)->getMyID() == 0) || (currentGame->getCurrentHand()->getLog() && currentGame->getCurrentHand()->getLog()->getDebugMode()) ) {
|
||||||
tempCardsPixmapArray[j].load(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[j], 10)+".png");
|
tempCardsPixmapArray[j].load(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[j], 10)+".png");
|
||||||
if(myConfig->readConfigInt("AntiPeekMode")) {
|
if(myConfig->readConfigInt("AntiPeekMode")) {
|
||||||
holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(flipside, true);
|
holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(flipside, true);
|
||||||
@@ -1532,10 +1532,10 @@ void gameTableImpl::dealFlopCards3()
|
|||||||
void gameTableImpl::dealFlopCards4()
|
void gameTableImpl::dealFlopCards4()
|
||||||
{
|
{
|
||||||
|
|
||||||
int tempBoardCardsArray[5];
|
int boardCards[5];
|
||||||
|
|
||||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[0], 10)+".png"));
|
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[0], 10)+".png"));
|
||||||
|
|
||||||
//Config? mit oder ohne Eye-Candy?
|
//Config? mit oder ohne Eye-Candy?
|
||||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||||
@@ -1552,9 +1552,9 @@ void gameTableImpl::dealFlopCards4()
|
|||||||
void gameTableImpl::dealFlopCards5()
|
void gameTableImpl::dealFlopCards5()
|
||||||
{
|
{
|
||||||
|
|
||||||
int tempBoardCardsArray[5];
|
int boardCards[5];
|
||||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[1], 10)+".png"));
|
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[1], 10)+".png"));
|
||||||
|
|
||||||
//Config? mit oder ohne Eye-Candy?
|
//Config? mit oder ohne Eye-Candy?
|
||||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||||
@@ -1571,9 +1571,9 @@ void gameTableImpl::dealFlopCards5()
|
|||||||
void gameTableImpl::dealFlopCards6()
|
void gameTableImpl::dealFlopCards6()
|
||||||
{
|
{
|
||||||
|
|
||||||
int tempBoardCardsArray[5];
|
int boardCards[5];
|
||||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[2], 10)+".png"));
|
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[2], 10)+".png"));
|
||||||
|
|
||||||
//Config? mit oder ohne Eye-Candy?
|
//Config? mit oder ohne Eye-Candy?
|
||||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||||
@@ -1615,9 +1615,9 @@ void gameTableImpl::dealTurnCards1()
|
|||||||
void gameTableImpl::dealTurnCards2()
|
void gameTableImpl::dealTurnCards2()
|
||||||
{
|
{
|
||||||
|
|
||||||
int tempBoardCardsArray[5];
|
int boardCards[5];
|
||||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[3], 10)+".png"));
|
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[3], 10)+".png"));
|
||||||
|
|
||||||
//Config? mit oder ohne Eye-Candy?
|
//Config? mit oder ohne Eye-Candy?
|
||||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||||
@@ -1660,9 +1660,9 @@ void gameTableImpl::dealRiverCards1()
|
|||||||
void gameTableImpl::dealRiverCards2()
|
void gameTableImpl::dealRiverCards2()
|
||||||
{
|
{
|
||||||
|
|
||||||
int tempBoardCardsArray[5];
|
int boardCards[5];
|
||||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[4], 10)+".png"));
|
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[4], 10)+".png"));
|
||||||
|
|
||||||
//Config? mit oder ohne Eye-Candy?
|
//Config? mit oder ohne Eye-Candy?
|
||||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||||
@@ -2550,7 +2550,7 @@ void gameTableImpl::postRiverRunAnimation2()
|
|||||||
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
|
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
|
||||||
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||||
//set Player value (logging) for all in already shown cards
|
//set Player value (logging) for all in already shown cards
|
||||||
(*it_c)->setMyCardsFlip(1,3);
|
(*it_c)->setMyHoleCardsFlip(1,3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2805,29 +2805,23 @@ void gameTableImpl::postRiverRunAnimation6()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !DEBUG_MODE ) {
|
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) {
|
||||||
|
currentGameOver = true;
|
||||||
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) {
|
|
||||||
currentGameOver = true;
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
tabs.pushButton_break->setDisabled(false);
|
tabs.pushButton_break->setDisabled(false);
|
||||||
#else
|
#else
|
||||||
pushButton_break->setDisabled(false);
|
pushButton_break->setDisabled(false);
|
||||||
#endif
|
#endif
|
||||||
QFontMetrics tempMetrics = this->fontMetrics();
|
QFontMetrics tempMetrics = this->fontMetrics();
|
||||||
int width = tempMetrics.width(tr("Start"));
|
int width = tempMetrics.width(tr("Start"));
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
tabs.pushButton_break->setMinimumSize(width+10,20);
|
tabs.pushButton_break->setMinimumSize(width+10,20);
|
||||||
tabs.pushButton_break->setText(tr("Start"));
|
tabs.pushButton_break->setText(tr("Start"));
|
||||||
#else
|
#else
|
||||||
pushButton_break->setMinimumSize(width+10,20);
|
pushButton_break->setMinimumSize(width+10,20);
|
||||||
pushButton_break->setText(tr("Start"));
|
pushButton_break->setText(tr("Start"));
|
||||||
#endif
|
#endif
|
||||||
blinkingStartButtonAnimationTimer->start(500);
|
blinkingStartButtonAnimationTimer->start(500);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
myStartWindow->callNewGameDialog();
|
|
||||||
//Bei Cancel nichts machen!!!
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2849,7 +2843,7 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn)
|
|||||||
|
|
||||||
if((*it_c)->getMyUniqueID() == playerId) {
|
if((*it_c)->getMyUniqueID() == playerId) {
|
||||||
|
|
||||||
(*it_c)->getMyCards(tempCardsIntArray);
|
(*it_c)->getMyHoleCards(tempCardsIntArray);
|
||||||
for(j=0; j<2; j++) {
|
for(j=0; j<2; j++) {
|
||||||
|
|
||||||
if(showFlipcardAnimation) { // with Eye-Candy
|
if(showFlipcardAnimation) { // with Eye-Candy
|
||||||
@@ -2861,9 +2855,9 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn)
|
|||||||
}
|
}
|
||||||
//set Player value (logging)
|
//set Player value (logging)
|
||||||
if(currentHand->getCurrentRound() < GAME_STATE_RIVER || allIn) {
|
if(currentHand->getCurrentRound() < GAME_STATE_RIVER || allIn) {
|
||||||
(*it_c)->setMyCardsFlip(1,2); //for bero before postriver or allin just log the hole cards
|
(*it_c)->setMyHoleCardsFlip(1,2); //for bero before postriver or allin just log the hole cards
|
||||||
} else {
|
} else {
|
||||||
(*it_c)->setMyCardsFlip(1,1); //for postriver log the value
|
(*it_c)->setMyHoleCardsFlip(1,1); //for postriver log the value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3260,7 +3254,6 @@ bool gameTableImpl::eventFilter(QObject *obj, QEvent *event)
|
|||||||
myChat->nickAutoCompletition();
|
myChat->nickAutoCompletition();
|
||||||
return true;
|
return true;
|
||||||
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
||||||
event->ignore();
|
|
||||||
closeGameTable();
|
closeGameTable();
|
||||||
return true;
|
return true;
|
||||||
} else if (event->type() == QEvent::Close) {
|
} else if (event->type() == QEvent::Close) {
|
||||||
@@ -4020,7 +4013,7 @@ void gameTableImpl::refreshCardsChance(GameState bero)
|
|||||||
int boardCards[5];
|
int boardCards[5];
|
||||||
int holeCards[2];
|
int holeCards[2];
|
||||||
|
|
||||||
humanPlayer->getMyCards(holeCards);
|
humanPlayer->getMyHoleCards(holeCards);
|
||||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||||
|
|
||||||
if(humanPlayer->getMyAction() == PLAYER_ACTION_FOLD) {
|
if(humanPlayer->getMyAction() == PLAYER_ACTION_FOLD) {
|
||||||
@@ -4303,11 +4296,12 @@ void gameTableImpl::restoreGameTableGeometry()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef ANDROID
|
||||||
//resize only if style size allow this and if NOT fixed windows size
|
//resize only if style size allow this and if NOT fixed windows size
|
||||||
if(!myGameTableStyle->getIfFixedWindowSize().toInt() && myConfig->readConfigInt("GameTableHeightSave") <= myGameTableStyle->getMaximumWindowHeight().toInt() && myConfig->readConfigInt("GameTableHeightSave") >= myGameTableStyle->getMinimumWindowHeight().toInt() && myConfig->readConfigInt("GameTableWidthSave") <= myGameTableStyle->getMaximumWindowWidth().toInt() && myConfig->readConfigInt("GameTableWidthSave") >= myGameTableStyle->getMinimumWindowWidth().toInt()) {
|
if(!myGameTableStyle->getIfFixedWindowSize().toInt() && myConfig->readConfigInt("GameTableHeightSave") <= myGameTableStyle->getMaximumWindowHeight().toInt() && myConfig->readConfigInt("GameTableHeightSave") >= myGameTableStyle->getMinimumWindowHeight().toInt() && myConfig->readConfigInt("GameTableWidthSave") <= myGameTableStyle->getMaximumWindowWidth().toInt() && myConfig->readConfigInt("GameTableWidthSave") >= myGameTableStyle->getMinimumWindowWidth().toInt()) {
|
||||||
|
|
||||||
this->resize(myConfig->readConfigInt("GameTableWidthSave"), myConfig->readConfigInt("GameTableHeightSave"));
|
this->resize(myConfig->readConfigInt("GameTableWidthSave"), myConfig->readConfigInt("GameTableHeightSave"));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
if(getAndroidApiVersion() == 10) {
|
if(getAndroidApiVersion() == 10) {
|
||||||
@@ -4316,6 +4310,8 @@ void gameTableImpl::restoreGameTableGeometry()
|
|||||||
int availableHeight = dw.screenGeometry().height();
|
int availableHeight = dw.screenGeometry().height();
|
||||||
this->showNormal();
|
this->showNormal();
|
||||||
this->setGeometry(0,0,availableWidth, availableHeight);
|
this->setGeometry(0,0,availableWidth, availableHeight);
|
||||||
|
} else {
|
||||||
|
this->showFullScreen();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ using namespace std;
|
|||||||
|
|
||||||
guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), myHtmlLogFile(0), myHtmlLogFile_old(0), myTxtLogFile(0), tb(0)
|
guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), myHtmlLogFile(0), myHtmlLogFile_old(0), myTxtLogFile(0), tb(0)
|
||||||
{
|
{
|
||||||
|
newVersion = true;
|
||||||
|
|
||||||
myW->setGuiLog(this);
|
myW->setGuiLog(this);
|
||||||
myStyle = myW->getMyGameTableStyle();
|
myStyle = myW->getMyGameTableStyle();
|
||||||
@@ -61,9 +62,6 @@ guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(
|
|||||||
connect(this, SIGNAL(signalLogSpectatorLeftMsg(QString, int)), this, SLOT(logSpectatorLeftMsg(QString, int)));
|
connect(this, SIGNAL(signalLogSpectatorLeftMsg(QString, int)), this, SLOT(logSpectatorLeftMsg(QString, int)));
|
||||||
connect(this, SIGNAL(signalLogSpectatorJoinedMsg(QString)), this, SLOT(logSpectatorJoinedMsg(QString)));
|
connect(this, SIGNAL(signalLogSpectatorJoinedMsg(QString)), this, SLOT(logSpectatorJoinedMsg(QString)));
|
||||||
connect(this, SIGNAL(signalLogPlayerWinGame(QString, int)), this, SLOT(logPlayerWinGame(QString, int)));
|
connect(this, SIGNAL(signalLogPlayerWinGame(QString, int)), this, SLOT(logPlayerWinGame(QString, int)));
|
||||||
connect(this, SIGNAL(signalFlushLogAtGame(int)), this, SLOT(flushLogAtGame(int)));
|
|
||||||
connect(this, SIGNAL(signalFlushLogAtHand()), this, SLOT(flushLogAtHand()));
|
|
||||||
|
|
||||||
|
|
||||||
logFileStreamString = "";
|
logFileStreamString = "";
|
||||||
lastGameID = 0;
|
lastGameID = 0;
|
||||||
@@ -79,40 +77,7 @@ guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(
|
|||||||
|
|
||||||
myLogDir = new QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
myLogDir = new QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
||||||
|
|
||||||
if(HTML_LOG) {
|
// delete old log files - TODO: move to Log
|
||||||
|
|
||||||
QDateTime currentTime = QDateTime::currentDateTime();
|
|
||||||
if(SQLITE_LOG) {
|
|
||||||
myHtmlLogFile_old = new QFile(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+"_old.html");
|
|
||||||
} else {
|
|
||||||
myHtmlLogFile_old = new QFile(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".html");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Logo-Pixmap extrahieren
|
|
||||||
QPixmap logoChipPixmapFile(":/gfx/logoChip3D.png");
|
|
||||||
logoChipPixmapFile.save(myLogDir->absolutePath()+"/logo.png");
|
|
||||||
|
|
||||||
// myW->textBrowser_Log->append(myHtmlLogFile_old->fileName());
|
|
||||||
|
|
||||||
// erstelle html-Datei
|
|
||||||
myHtmlLogFile_old->open( QIODevice::WriteOnly );
|
|
||||||
QTextStream stream_old( myHtmlLogFile_old );
|
|
||||||
stream_old << "<html>\n";
|
|
||||||
stream_old << "<head>\n";
|
|
||||||
stream_old << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf8\">";
|
|
||||||
stream_old << "</head>\n";
|
|
||||||
#ifdef GUI_800x480
|
|
||||||
stream_old << "<body style=\"font-size:14px\">\n";
|
|
||||||
#else
|
|
||||||
stream_old << "<body>\n";
|
|
||||||
#endif
|
|
||||||
stream_old << "<img src='logo.png'>\n";
|
|
||||||
stream_old << QString("<h3><b>Log-File for PokerTH %1 Session started on ").arg(POKERTH_BETA_RELEASE_STRING)+QDate::currentDate().toString("yyyy-MM-dd")+" at "+QTime::currentTime().toString("hh:mm:ss")+"</b></h3>\n";
|
|
||||||
myHtmlLogFile_old->close();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete old log files
|
|
||||||
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
||||||
|
|
||||||
QStringList filters("pokerth-log*");
|
QStringList filters("pokerth-log*");
|
||||||
@@ -191,62 +156,19 @@ void guiLog::logPlayerActionMsg(QString msg, int action, int setValue)
|
|||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+msg+"</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+msg+"</span>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
logFileStreamString += msg+"</br>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logNewGameHandMsg(int gameID, int handID)
|
void guiLog::logNewGameHandMsg(int gameID, int handID)
|
||||||
{
|
{
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
|
||||||
boost::shared_ptr<HandInterface> currentHand = myW->getSession()->getCurrentGame()->getCurrentHand();
|
|
||||||
|
|
||||||
PlayerList activePlayerList = currentHand->getActivePlayerList();
|
|
||||||
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
|
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
logFileStreamString += "<table><tr><td width=\"600\" align=\"center\"><hr noshade size=\"3\"><b>Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+"</b></td><td></td></tr></table>";
|
|
||||||
logFileStreamString += "BLIND LEVEL: $"+QString::number(currentHand->getSmallBlind())+" / $"+QString::number(currentHand->getSmallBlind()*2)+"</br>";
|
|
||||||
|
|
||||||
//print cash only for active players
|
|
||||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
|
|
||||||
|
|
||||||
logFileStreamString += "Seat " + QString::number((*it_c)->getMyID()+1,10) + ": <b>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + "</b> ($" + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10)+")</br>";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName)
|
void guiLog::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName)
|
||||||
{
|
{
|
||||||
|
|
||||||
// log blinds
|
// log blinds
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>");
|
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>");
|
||||||
@@ -255,45 +177,6 @@ void guiLog::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString b
|
|||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>");
|
||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+bbName+" posts big blind ($"+QString::number(bbSet,10)+")</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+bbName+" posts big blind ($"+QString::number(bbSet,10)+")</span>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
logFileStreamString += "BLINDS: ";
|
|
||||||
|
|
||||||
logFileStreamString += sbName+" ($"+QString::number(sbSet,10)+"), ";
|
|
||||||
logFileStreamString += bbName+" ($"+QString::number(bbSet,10)+")";
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
|
||||||
boost::shared_ptr<Game> currentGame = myW->getSession()->getCurrentGame();
|
|
||||||
PlayerList activePlayerList = currentGame->getActivePlayerList();
|
|
||||||
|
|
||||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
|
|
||||||
|
|
||||||
if(activePlayerList->size() > 2) {
|
|
||||||
if((*it_c)->getMyButton() == BUTTON_DEALER) {
|
|
||||||
|
|
||||||
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND) {
|
|
||||||
|
|
||||||
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
logFileStreamString += "</br></br><b>PREFLOP</b>";
|
|
||||||
logFileStreamString += "</br>\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logPlayerWinsMsg(QString playerName, int pot, bool main)
|
void guiLog::logPlayerWinsMsg(QString playerName, int pot, bool main)
|
||||||
@@ -312,116 +195,43 @@ void guiLog::logPlayerWinsMsg(QString playerName, int pot, bool main)
|
|||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogWinnerSidePotColor()+";\">"+playerName+" wins $"+QString::number(pot,10)+" (side pot)</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogWinnerSidePotColor()+";\">"+playerName+" wins $"+QString::number(pot,10)+" (side pot)</span>");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
logFileStreamString += "</br><i>"+playerName+" wins $"+QString::number(pot,10);
|
|
||||||
if(!main) {
|
|
||||||
logFileStreamString += " (side pot)";
|
|
||||||
}
|
|
||||||
logFileStreamString += "</i>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logPlayerSitsOut(QString playerName)
|
void guiLog::logPlayerSitsOut(QString playerName)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
myW->tabs.textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
myW->textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
|
|
||||||
logFileStreamString += "</br><i><span style=\"font-size:smaller;\">"+playerName+" sits out</span></i>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5)
|
void guiLog::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5)
|
||||||
{
|
{
|
||||||
|
|
||||||
QString round;
|
|
||||||
|
|
||||||
switch (roundID) {
|
switch (roundID) {
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
round = "Flop";
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>");
|
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Flop --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Flop --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
round = "Turn";
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>");
|
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Turn --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Turn --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
round = "River";
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>");
|
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- River --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- River --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
round = "ERROR";
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
switch (roundID) {
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
round = "Flop";
|
|
||||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+"]"+"</br>\n";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
round = "Turn";
|
|
||||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+"]"+"</br>\n";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
round = "River";
|
|
||||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+",<b>"+translateCardCode(card5).at(0)+"</b>"+translateCardCode(card5).at(1)+"]"+"</br>\n";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
round = "ERROR";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,40 +257,10 @@ void guiLog::logFlipHoleCardsMsg(QString playerName, int card1, int card2, int c
|
|||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+playerName+" "+showHas+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"]</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+playerName+" "+showHas+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"]</span>");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
if (cardsValueInt != -1) {
|
|
||||||
|
|
||||||
tempHandName.fromStdString(CardsValue::determineHandName(cardsValueInt,myW->getSession()->getCurrentGame()->getActivePlayerList()));
|
|
||||||
|
|
||||||
logFileStreamString += playerName+" "+showHas+" [ <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+"] - "+tempHandName+"</br>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
logFileStreamString += playerName+" "+showHas+" [<b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+"]"+"</br>\n";
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logPlayerLeftMsg(QString playerName, int wasKicked)
|
void guiLog::logPlayerLeftMsg(QString playerName, int wasKicked)
|
||||||
{
|
{
|
||||||
|
|
||||||
QString action;
|
QString action;
|
||||||
if(wasKicked) action = "was kicked from";
|
if(wasKicked) action = "was kicked from";
|
||||||
else action = "has left";
|
else action = "has left";
|
||||||
@@ -490,44 +270,15 @@ void guiLog::logPlayerLeftMsg(QString playerName, int wasKicked)
|
|||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append( "<span style=\"color:#"+myStyle->getChatLogTextColor()+";\"><i>"+playerName+" "+action+" the game!</i></span>");
|
myW->textBrowser_Log->append( "<span style=\"color:#"+myStyle->getChatLogTextColor()+";\"><i>"+playerName+" "+action+" the game!</i></span>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
|
|
||||||
logFileStreamString += "<i>"+playerName+" "+action+" the game!</i><br>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logNewGameAdminMsg(QString playerName)
|
void guiLog::logNewGameAdminMsg(QString playerName)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
myW->tabs.textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
myW->textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
|
|
||||||
logFileStreamString += "<i>"+playerName+" is game admin now!</i><br>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logPlayerJoinedMsg(QString playerName)
|
void guiLog::logPlayerJoinedMsg(QString playerName)
|
||||||
@@ -551,27 +302,11 @@ void guiLog::logSpectatorJoinedMsg(QString playerName)
|
|||||||
|
|
||||||
void guiLog::logPlayerWinGame(QString playerName, int gameID)
|
void guiLog::logPlayerWinGame(QString playerName, int gameID)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
myW->tabs.textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
myW->textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
|
|
||||||
logFileStreamString += "</br></br><i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b></br>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList guiLog::translateCardCode(int cardCode)
|
QStringList guiLog::translateCardCode(int cardCode)
|
||||||
@@ -693,39 +428,6 @@ void guiLog::writeLog(string log_string, int modus)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::flushLogAtHand()
|
|
||||||
{
|
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
if(myConfig->readConfigInt("LogInterval") < 2) {
|
|
||||||
// write for log after every action and after every hand
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void guiLog::flushLogAtGame(int gameID)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
// write for log after every game
|
|
||||||
if(gameID > lastGameID) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
lastGameID = gameID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void guiLog::exportLogPdbToHtml(QString fileStringPdb, QString exportFileString)
|
void guiLog::exportLogPdbToHtml(QString fileStringPdb, QString exportFileString)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -769,8 +471,6 @@ void guiLog::showLog(QString fileStringPdb, QTextBrowser *tb_tmp, int uniqueGame
|
|||||||
|
|
||||||
int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||||
{
|
{
|
||||||
bool neu = false;
|
|
||||||
|
|
||||||
result_struct results;
|
result_struct results;
|
||||||
results.result_Session = 0;
|
results.result_Session = 0;
|
||||||
results.result_Game = 0;
|
results.result_Game = 0;
|
||||||
@@ -866,7 +566,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
log_string = "<h3><b>" + log_string + "</b></h3>\n";
|
log_string = "<h3><b>" + log_string + "</b></h3>\n";
|
||||||
// if(!neu) log_string = "<img src='logo.png'>\n" + log_string;
|
// if(!newVersion) log_string = "<img src='logo.png'>\n" + log_string;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
log_string += "";
|
log_string += "";
|
||||||
@@ -957,7 +657,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
log_string = "<table><tr><td width=\"600\" align=\"center\"><hr noshade size=\"3\"><b>" + log_string;
|
log_string = "<table><tr><td width=\"600\" align=\"center\"><hr noshade size=\"3\"><b>" + log_string;
|
||||||
if(!neu) log_string += "</b></td><td></td></tr></table>";
|
if(!newVersion) log_string += "</b></td><td></td></tr></table>";
|
||||||
else log_string += "</b></td></tr></table>";
|
else log_string += "</b></td></tr></table>";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@@ -1019,7 +719,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
|
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) log_string += "</br>";
|
if(!newVersion) log_string += "</br>";
|
||||||
else log_string += "<br />";
|
else log_string += "<br />";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@@ -1057,7 +757,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
log_string += ")";
|
log_string += ")";
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) log_string += "</br>";
|
if(!newVersion) log_string += "</br>";
|
||||||
else log_string += "<br />";
|
else log_string += "<br />";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@@ -1080,7 +780,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(neu) {
|
if(newVersion) {
|
||||||
|
|
||||||
if(modus == 1) log_string += "<br />";
|
if(modus == 1) log_string += "<br />";
|
||||||
|
|
||||||
@@ -1202,7 +902,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
if(nRow_Action == 1) {
|
if(nRow_Action == 1) {
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) log_string += "</br>";
|
if(!newVersion) log_string += "</br>";
|
||||||
else log_string += "<br />";
|
else log_string += "<br />";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@@ -1220,7 +920,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!neu && modus==1) log_string += "</br>";
|
if(!newVersion && modus==1) log_string += "</br>";
|
||||||
|
|
||||||
writeLog(log_string,modus);
|
writeLog(log_string,modus);
|
||||||
log_string = "";
|
log_string = "";
|
||||||
@@ -1248,10 +948,10 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
}
|
}
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) round_string = "</br><b>" + round_string + "</b>";
|
if(!newVersion) round_string = "</br><b>" + round_string + "</b>";
|
||||||
else round_string = "<br /><b>" + round_string + "</b>";
|
else round_string = "<br /><b>" + round_string + "</b>";
|
||||||
if(round_ctr >= GAME_STATE_FLOP) {
|
if(round_ctr >= GAME_STATE_FLOP) {
|
||||||
if(!neu) round_string = "</br>\n" + round_string;
|
if(!newVersion) round_string = "</br>\n" + round_string;
|
||||||
else round_string = "<br />\n" + round_string;
|
else round_string = "<br />\n" + round_string;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1318,7 +1018,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
for(action_ctr=1; action_ctr<=nRow_Action; action_ctr++) {
|
for(action_ctr=1; action_ctr<=nRow_Action; action_ctr++) {
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) {
|
if(!newVersion) {
|
||||||
if(action_ctr>1 && (boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "wins" || boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "sits out" || boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "wins (side pot)"))
|
if(action_ctr>1 && (boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "wins" || boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "sits out" || boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "wins (side pot)"))
|
||||||
log_string += "\n";
|
log_string += "\n";
|
||||||
else
|
else
|
||||||
@@ -1336,7 +1036,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
if(!neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins (side pot)") {
|
if(!newVersion && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins (side pot)") {
|
||||||
action_string += player[boost::lexical_cast<int>(results.result_Action[3*action_ctr])-1];
|
action_string += player[boost::lexical_cast<int>(results.result_Action[3*action_ctr])-1];
|
||||||
action_string += " wins $";
|
action_string += " wins $";
|
||||||
action_string += boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+2]);
|
action_string += boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+2]);
|
||||||
@@ -1356,7 +1056,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins game") {
|
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins game") {
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) action_string = "</br></br><i><b>" + action_string + " " + boost::lexical_cast<std::string>(gameID) + "!</i></b></br>";
|
if(!newVersion) action_string = "</br></br><i><b>" + action_string + " " + boost::lexical_cast<std::string>(gameID) + "!</i></b></br>";
|
||||||
else action_string = "</br><i><b>" + action_string + " " + boost::lexical_cast<std::string>(gameID) + "!</b></i>";
|
else action_string = "</br><i><b>" + action_string + " " + boost::lexical_cast<std::string>(gameID) + "!</b></i>";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@@ -1374,7 +1074,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins (side pot)") {
|
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins (side pot)") {
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) action_string = "</br><i>" + action_string + "</i>";
|
if(!newVersion) action_string = "</br><i>" + action_string + "</i>";
|
||||||
else action_string = "<i>" + action_string + "</i>";
|
else action_string = "<i>" + action_string + "</i>";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@@ -1389,7 +1089,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has left the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "was kicked from the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "is game admin now" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has joined the game") {
|
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has left the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "was kicked from the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "is game admin now" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has joined the game") {
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) action_string = "<i>" + action_string + "!</i>";
|
if(!newVersion) action_string = "<i>" + action_string + "!</i>";
|
||||||
else action_string = "<i>" + action_string + "</i>";
|
else action_string = "<i>" + action_string + "</i>";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@@ -1404,7 +1104,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "sits out") {
|
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "sits out") {
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) action_string = "</br><i><span style=\"font-size:smaller;\">" + action_string + "</span></i>";
|
if(!newVersion) action_string = "</br><i><span style=\"font-size:smaller;\">" + action_string + "</span></i>";
|
||||||
else action_string = "<i><span style=\"font-size:smaller;\">" + action_string + "</span></i>";
|
else action_string = "<i><span style=\"font-size:smaller;\">" + action_string + "</span></i>";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@@ -1421,7 +1121,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
// show cards
|
// show cards
|
||||||
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "shows" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has") {
|
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "shows" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has") {
|
||||||
// log cards
|
// log cards
|
||||||
if(!neu && round_ctr == GAME_STATE_POST_RIVER) log_string += " [ ";
|
if(!newVersion && round_ctr == GAME_STATE_POST_RIVER) log_string += " [ ";
|
||||||
else log_string += " [";
|
else log_string += " [";
|
||||||
if(modus == 1 || modus == 3) log_string += "<b>";
|
if(modus == 1 || modus == 3) log_string += "<b>";
|
||||||
|
|
||||||
@@ -1492,10 +1192,10 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "shows" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "sits out" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins (side pot)" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has joined the game") {
|
if(!newVersion && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "shows" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "sits out" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins (side pot)" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has joined the game") {
|
||||||
log_string += ".";
|
log_string += ".";
|
||||||
}
|
}
|
||||||
if(neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has joined the game")
|
if(newVersion && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has joined the game")
|
||||||
log_string += ".";
|
log_string += ".";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,8 +81,6 @@ public slots:
|
|||||||
void logSpectatorLeftMsg(QString playerName, int wasKicked);
|
void logSpectatorLeftMsg(QString playerName, int wasKicked);
|
||||||
void logSpectatorJoinedMsg(QString playerName);
|
void logSpectatorJoinedMsg(QString playerName);
|
||||||
void logPlayerWinGame(QString playerName, int gameID);
|
void logPlayerWinGame(QString playerName, int gameID);
|
||||||
void flushLogAtGame(int gameID);
|
|
||||||
void flushLogAtHand();
|
|
||||||
void exportLogPdbToHtml(QString fileStringPdb, QString exportFileString);
|
void exportLogPdbToHtml(QString fileStringPdb, QString exportFileString);
|
||||||
void exportLogPdbToTxt(QString fileStringPdb, QString exportFileString);
|
void exportLogPdbToTxt(QString fileStringPdb, QString exportFileString);
|
||||||
void showLog(QString fileStringPdb, QTextBrowser *tb, int uniqueGameID = 0);
|
void showLog(QString fileStringPdb, QTextBrowser *tb, int uniqueGameID = 0);
|
||||||
@@ -115,8 +113,6 @@ signals:
|
|||||||
void signalLogSpectatorJoinedMsg(QString playerName);
|
void signalLogSpectatorJoinedMsg(QString playerName);
|
||||||
void signalLogNewGameAdminMsg(QString playerName);
|
void signalLogNewGameAdminMsg(QString playerName);
|
||||||
void signalLogPlayerWinGame(QString playerName, int gameID);
|
void signalLogPlayerWinGame(QString playerName, int gameID);
|
||||||
void signalFlushLogAtGame(int gameID);
|
|
||||||
void signalFlushLogAtHand();
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -141,6 +137,7 @@ private:
|
|||||||
QTextBrowser* tb;
|
QTextBrowser* tb;
|
||||||
GameTableStyleReader *myStyle;
|
GameTableStyleReader *myStyle;
|
||||||
std::string mySqliteLogFileName;
|
std::string mySqliteLogFileName;
|
||||||
|
bool newVersion;
|
||||||
|
|
||||||
friend class GuiWrapper;
|
friend class GuiWrapper;
|
||||||
|
|
||||||
|
|||||||
@@ -287,14 +287,6 @@ void GuiWrapper::logPlayerWinGame(std::string playerName, int gameID)
|
|||||||
{
|
{
|
||||||
myGuiLog->signalLogPlayerWinGame(QString::fromUtf8(playerName.c_str()), gameID);
|
myGuiLog->signalLogPlayerWinGame(QString::fromUtf8(playerName.c_str()), gameID);
|
||||||
}
|
}
|
||||||
void GuiWrapper::flushLogAtGame(int gameID)
|
|
||||||
{
|
|
||||||
myGuiLog->signalFlushLogAtGame(gameID);
|
|
||||||
}
|
|
||||||
void GuiWrapper::flushLogAtHand()
|
|
||||||
{
|
|
||||||
myGuiLog->signalFlushLogAtHand();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GuiWrapper::SignalNetClientConnect(int actionID)
|
void GuiWrapper::SignalNetClientConnect(int actionID)
|
||||||
|
|||||||
@@ -124,8 +124,6 @@ public:
|
|||||||
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
|
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
|
||||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
|
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
|
||||||
void logPlayerWinGame(std::string playerName, int gameID);
|
void logPlayerWinGame(std::string playerName, int gameID);
|
||||||
void flushLogAtGame(int gameID);
|
|
||||||
void flushLogAtHand();
|
|
||||||
|
|
||||||
void SignalNetClientConnect(int actionID);
|
void SignalNetClientConnect(int actionID);
|
||||||
void SignalNetClientServerListAdd(unsigned serverId);
|
void SignalNetClientServerListAdd(unsigned serverId);
|
||||||
|
|||||||
@@ -155,10 +155,18 @@ void LogFileDialog::exportLogToHtml()
|
|||||||
|
|
||||||
if(selectedItem) {
|
if(selectedItem) {
|
||||||
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
|
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to HTML"),
|
QFileDialog dlg(this, tr("Export PokerTH log file to HTML"),
|
||||||
QDir::homePath()+"/"+fi.baseName()+".html",
|
QDir::homePath()+"/"+fi.baseName()+".html",
|
||||||
tr("PokerTH HTML log (*.html)"));
|
tr("PokerTH HTML log (*.html)"));
|
||||||
|
dlg.setFileMode(QFileDialog::AnyFile);
|
||||||
|
dlg.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
|
#ifdef ANDROID
|
||||||
|
dlg.setWindowState(Qt::WindowFullScreen);
|
||||||
|
#endif
|
||||||
|
QString fileName;
|
||||||
|
if(dlg.exec()) {
|
||||||
|
fileName = dlg.selectedFiles().first();
|
||||||
|
}
|
||||||
if(!fileName.isEmpty()) {
|
if(!fileName.isEmpty()) {
|
||||||
myGuiLog->exportLogPdbToHtml(selectedItem->data(0, Qt::UserRole).toString(),fileName);
|
myGuiLog->exportLogPdbToHtml(selectedItem->data(0, Qt::UserRole).toString(),fileName);
|
||||||
}
|
}
|
||||||
@@ -171,10 +179,18 @@ void LogFileDialog::exportLogToTxt()
|
|||||||
|
|
||||||
if(selectedItem) {
|
if(selectedItem) {
|
||||||
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
|
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to plain text"),
|
QFileDialog dlg(this, tr("Export PokerTH log file to plain text"),
|
||||||
QDir::homePath()+"/"+fi.baseName()+".txt",
|
QDir::homePath()+"/"+fi.baseName()+".txt",
|
||||||
tr("PokerTH plain text log (*.txt)"));
|
tr("PokerTH plain text log (*.txt)"));
|
||||||
|
dlg.setFileMode(QFileDialog::AnyFile);
|
||||||
|
dlg.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
|
#ifdef ANDROID
|
||||||
|
dlg.setWindowState(Qt::WindowFullScreen);
|
||||||
|
#endif
|
||||||
|
QString fileName;
|
||||||
|
if(dlg.exec()) {
|
||||||
|
fileName = dlg.selectedFiles().first();
|
||||||
|
}
|
||||||
if(!fileName.isEmpty()) {
|
if(!fileName.isEmpty()) {
|
||||||
myGuiLog->exportLogPdbToTxt(selectedItem->data(0, Qt::UserRole).toString(),fileName);
|
myGuiLog->exportLogPdbToTxt(selectedItem->data(0, Qt::UserRole).toString(),fileName);
|
||||||
}
|
}
|
||||||
@@ -187,10 +203,18 @@ void LogFileDialog::saveLogFileAs()
|
|||||||
|
|
||||||
if(selectedItem) {
|
if(selectedItem) {
|
||||||
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
|
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save PokerTH log file"),
|
QFileDialog dlg(this, tr("Save PokerTH log file"),
|
||||||
QDir::homePath()+"/"+fi.baseName()+".pdb",
|
QDir::homePath()+"/"+fi.baseName()+".pdb",
|
||||||
tr("PokerTH SQL log (*.pdb)"));
|
tr("PokerTH SQL log (*.pdb)"));
|
||||||
|
dlg.setFileMode(QFileDialog::AnyFile);
|
||||||
|
dlg.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
|
#ifdef ANDROID
|
||||||
|
dlg.setWindowState(Qt::WindowFullScreen);
|
||||||
|
#endif
|
||||||
|
QString fileName;
|
||||||
|
if(dlg.exec()) {
|
||||||
|
fileName = dlg.selectedFiles().first();
|
||||||
|
}
|
||||||
if(!fileName.isEmpty()) {
|
if(!fileName.isEmpty()) {
|
||||||
QFile::copy(selectedItem->data(0, Qt::UserRole).toString(), fileName);
|
QFile::copy(selectedItem->data(0, Qt::UserRole).toString(), fileName);
|
||||||
}
|
}
|
||||||
@@ -227,6 +251,8 @@ void LogFileDialog::keyPressEvent ( QKeyEvent * event )
|
|||||||
if(ui->treeWidget_logFiles->hasFocus()) {
|
if(ui->treeWidget_logFiles->hasFocus()) {
|
||||||
ui->pushButton_deleteLog->click();
|
ui->pushButton_deleteLog->click();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
QDialog::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ void startNetworkGameDialogImpl::keyPressEvent ( QKeyEvent * event )
|
|||||||
} else {
|
} else {
|
||||||
keyUpDownChatCounter = 0;
|
keyUpDownChatCounter = 0;
|
||||||
}
|
}
|
||||||
|
QDialog::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool startNetworkGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
bool startNetworkGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#ifndef ANDROID_TEST
|
#ifndef ANDROID_TEST
|
||||||
#include "QtGui/5.2.0/QtGui/qpa/qplatformnativeinterface.h"
|
#include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -114,7 +114,7 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
|
|||||||
//if custom bg file could not be found load the big origin file
|
//if custom bg file could not be found load the big origin file
|
||||||
centralwidget->setStyleSheet(".QWidget { background-image: url(:/android/android-data/gfx/gui/misc/startwindowbg10_mobile.png); background-position: top center; background-origin: content; background-repeat: no-repeat;}");
|
centralwidget->setStyleSheet(".QWidget { background-image: url(:/android/android-data/gfx/gui/misc/startwindowbg10_mobile.png); background-position: top center; background-origin: content; background-repeat: no-repeat;}");
|
||||||
}
|
}
|
||||||
this->showFullScreen();
|
this->setWindowState(Qt::WindowFullScreen);
|
||||||
|
|
||||||
//TODO HACK Missing QSystemScreenSaver::setScreenSaverInhibited(true)
|
//TODO HACK Missing QSystemScreenSaver::setScreenSaverInhibited(true)
|
||||||
// #ifndef ANDROID_TEST
|
// #ifndef ANDROID_TEST
|
||||||
@@ -256,6 +256,10 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
|
|||||||
connect(this, SIGNAL(signalPlayerGameInvitation(unsigned, unsigned, unsigned)), myGameLobbyDialog, SLOT(chatInfoPlayerInvitation(unsigned, unsigned, unsigned)));
|
connect(this, SIGNAL(signalPlayerGameInvitation(unsigned, unsigned, unsigned)), myGameLobbyDialog, SLOT(chatInfoPlayerInvitation(unsigned, unsigned, unsigned)));
|
||||||
connect(this, SIGNAL(signalRejectedGameInvitation(unsigned, unsigned, DenyGameInvitationReason)), myGameLobbyDialog, SLOT(chatInfoPlayerRejectedInvitation(unsigned, unsigned, DenyGameInvitationReason)));
|
connect(this, SIGNAL(signalRejectedGameInvitation(unsigned, unsigned, DenyGameInvitationReason)), myGameLobbyDialog, SLOT(chatInfoPlayerRejectedInvitation(unsigned, unsigned, DenyGameInvitationReason)));
|
||||||
|
|
||||||
|
QAction *actionStart_Local_Game_new = new QAction("Start (new) local game ...",this);
|
||||||
|
menuPokerTH->addAction(actionStart_Local_Game_new);
|
||||||
|
connect( actionStart_Local_Game_new, SIGNAL( triggered() ), this, SLOT( callNewGameDialogNew() ) );
|
||||||
|
|
||||||
this->show();
|
this->show();
|
||||||
|
|
||||||
//update HACKS
|
//update HACKS
|
||||||
@@ -289,6 +293,26 @@ void startWindowImpl::callNewGameDialog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void startWindowImpl::callNewGameDialogNew()
|
||||||
|
{
|
||||||
|
|
||||||
|
//wenn Dialogfenster gezeigt werden soll
|
||||||
|
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")) {
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
myGuiInterface->getMyW()->hide();
|
||||||
|
#endif
|
||||||
|
myNewGameDialog->exec();
|
||||||
|
if (myNewGameDialog->result() == QDialog::Accepted ) {
|
||||||
|
startNewLocalGameNew(myNewGameDialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// sonst mit gespeicherten Werten starten
|
||||||
|
else {
|
||||||
|
startNewLocalGameNew();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void startWindowImpl::startNewLocalGame(newGameDialogImpl *v)
|
void startWindowImpl::startNewLocalGame(newGameDialogImpl *v)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -383,9 +407,6 @@ void startWindowImpl::startNewLocalGame(newGameDialogImpl *v)
|
|||||||
int tmpDealerPos = 0;
|
int tmpDealerPos = 0;
|
||||||
startData.numberOfPlayers = gameData.maxNumberOfPlayers;
|
startData.numberOfPlayers = gameData.maxNumberOfPlayers;
|
||||||
Tools::GetRand(0, startData.numberOfPlayers-1, 1, &tmpDealerPos);
|
Tools::GetRand(0, startData.numberOfPlayers-1, 1, &tmpDealerPos);
|
||||||
//if(DEBUG_MODE) {
|
|
||||||
// tmpDealerPos = 4;
|
|
||||||
//}
|
|
||||||
startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos);
|
startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos);
|
||||||
|
|
||||||
//some gui modifications
|
//some gui modifications
|
||||||
@@ -395,6 +416,117 @@ void startWindowImpl::startNewLocalGame(newGameDialogImpl *v)
|
|||||||
mySession->startLocalGame(gameData, startData);
|
mySession->startLocalGame(gameData, startData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void startWindowImpl::startNewLocalGameNew(newGameDialogImpl *v)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Stop local game.
|
||||||
|
myGuiInterface->getMyW()->stopTimer();
|
||||||
|
|
||||||
|
if (!myServerGuiInterface) {
|
||||||
|
// Create pseudo Gui Wrapper for the server.
|
||||||
|
myServerGuiInterface.reset(new ServerGuiWrapper(myConfig, mySession->getGui(), mySession->getGui(), mySession->getGui()));
|
||||||
|
{
|
||||||
|
boost::shared_ptr<Session> session(new Session(myServerGuiInterface.get(), myConfig, 0));
|
||||||
|
session->init(mySession->getAvatarManager());
|
||||||
|
myServerGuiInterface->setSession(session);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Terminate existing network games.
|
||||||
|
mySession->terminateNetworkClient();
|
||||||
|
myServerGuiInterface->getSession()->terminateNetworkServer();
|
||||||
|
|
||||||
|
|
||||||
|
GameData gameData;
|
||||||
|
if(v) {
|
||||||
|
gameData.maxNumberOfPlayers = v->spinBox_quantityPlayers->value();
|
||||||
|
gameData.startMoney = v->spinBox_startCash->value();
|
||||||
|
gameData.firstSmallBlind = v->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();
|
||||||
|
if(v->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) {
|
||||||
|
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
|
||||||
|
gameData.raiseSmallBlindEveryHandsValue = v->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value();
|
||||||
|
} else {
|
||||||
|
gameData.raiseIntervalMode = RAISE_ON_MINUTES;
|
||||||
|
gameData.raiseSmallBlindEveryMinutesValue = v->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryMinutes->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(v->getChangeCompleteBlindsDialog()->radioButton_alwaysDoubleBlinds->isChecked()) {
|
||||||
|
gameData.raiseMode = DOUBLE_BLINDS;
|
||||||
|
} else {
|
||||||
|
gameData.raiseMode = MANUAL_BLINDS_ORDER;
|
||||||
|
list<int> tempBlindList;
|
||||||
|
int i;
|
||||||
|
bool ok = true;
|
||||||
|
for(i=0; i<v->getChangeCompleteBlindsDialog()->listWidget_blinds->count(); i++) {
|
||||||
|
tempBlindList.push_back(v->getChangeCompleteBlindsDialog()->listWidget_blinds->item(i)->text().toInt(&ok,10));
|
||||||
|
}
|
||||||
|
gameData.manualBlindsList = tempBlindList;
|
||||||
|
|
||||||
|
if(v->getChangeCompleteBlindsDialog()->radioButton_afterThisAlwaysDoubleBlinds->isChecked()) {
|
||||||
|
gameData.afterManualBlindsMode = AFTERMB_DOUBLE_BLINDS;
|
||||||
|
} else {
|
||||||
|
if(v->getChangeCompleteBlindsDialog()->radioButton_afterThisAlwaysRaiseAbout->isChecked()) {
|
||||||
|
gameData.afterManualBlindsMode = AFTERMB_RAISE_ABOUT;
|
||||||
|
gameData.afterMBAlwaysRaiseValue = v->getChangeCompleteBlindsDialog()->spinBox_afterThisAlwaysRaiseValue->value();
|
||||||
|
} else {
|
||||||
|
gameData.afterManualBlindsMode = AFTERMB_STAY_AT_LAST_BLIND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gameData.guiSpeed = v->spinBox_gameSpeed->value();
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
gameData.maxNumberOfPlayers = myConfig->readConfigInt("NumberOfPlayers");
|
||||||
|
gameData.startMoney = myConfig->readConfigInt("StartCash");
|
||||||
|
gameData.firstSmallBlind = myConfig->readConfigInt("FirstSmallBlind");
|
||||||
|
|
||||||
|
if(myConfig->readConfigInt("RaiseBlindsAtHands")) {
|
||||||
|
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
|
||||||
|
gameData.raiseSmallBlindEveryHandsValue = myConfig->readConfigInt("RaiseSmallBlindEveryHands");
|
||||||
|
} else {
|
||||||
|
gameData.raiseIntervalMode = RAISE_ON_MINUTES;
|
||||||
|
gameData.raiseSmallBlindEveryMinutesValue = myConfig->readConfigInt("RaiseSmallBlindEveryMinutes");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(myConfig->readConfigInt("AlwaysDoubleBlinds")) {
|
||||||
|
gameData.raiseMode = DOUBLE_BLINDS;
|
||||||
|
} else {
|
||||||
|
gameData.raiseMode = MANUAL_BLINDS_ORDER;
|
||||||
|
gameData.manualBlindsList = myConfig->readConfigIntList("ManualBlindsList");
|
||||||
|
|
||||||
|
if(myConfig->readConfigInt("AfterMBAlwaysDoubleBlinds")) {
|
||||||
|
gameData.afterManualBlindsMode = AFTERMB_DOUBLE_BLINDS;
|
||||||
|
} else {
|
||||||
|
if(myConfig->readConfigInt("AfterMBAlwaysRaiseAbout")) {
|
||||||
|
gameData.afterManualBlindsMode = AFTERMB_RAISE_ABOUT;
|
||||||
|
gameData.afterMBAlwaysRaiseValue = myConfig->readConfigInt("AfterMBAlwaysRaiseValue");
|
||||||
|
} else {
|
||||||
|
gameData.afterManualBlindsMode = AFTERMB_STAY_AT_LAST_BLIND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gameData.guiSpeed = myConfig->readConfigInt("GameSpeed");
|
||||||
|
|
||||||
|
}
|
||||||
|
gameData.delayBetweenHandsSec = 7;
|
||||||
|
gameData.playerActionTimeoutSec = 20;
|
||||||
|
|
||||||
|
myGameLobbyDialog->setSession(getSession());
|
||||||
|
myStartNetworkGameDialog->setSession(getSession());
|
||||||
|
|
||||||
|
myServerGuiInterface->getSession()->startNetworkServer(false,true);
|
||||||
|
mySession->startNetworkClientForLocalServer(gameData);
|
||||||
|
|
||||||
|
myGuiInterface->getMyW()->show();
|
||||||
|
myGuiInterface->getMyW()->networkGameModification();
|
||||||
|
|
||||||
|
assert(getSession());
|
||||||
|
getSession()->sendStartEvent(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void startWindowImpl::callGameLobbyDialog()
|
void startWindowImpl::callGameLobbyDialog()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -774,12 +906,24 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
|
|||||||
QMessageBox::Close);
|
QMessageBox::Close);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ERR_SOCK_CONNECT_IPV6_FAILED: {
|
||||||
|
MyMessageBox::warning(this, tr("Network Error"),
|
||||||
|
tr("Could not connect to the server.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
|
||||||
|
QMessageBox::Close);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ERR_SOCK_CONNECT_TIMEOUT: {
|
case ERR_SOCK_CONNECT_TIMEOUT: {
|
||||||
MyMessageBox::warning(this, tr("Network Error"),
|
MyMessageBox::warning(this, tr("Network Error"),
|
||||||
tr("Connection timed out.\nPlease check the server address.\n\nIf the server is behind a NAT-Router, make sure port forwarding has been set up on server side."),
|
tr("Connection timed out.\nPlease check the server address.\n\nIf the server is behind a NAT-Router, make sure port forwarding has been set up on server side."),
|
||||||
QMessageBox::Close);
|
QMessageBox::Close);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ERR_SOCK_CONNECT_IPV6_TIMEOUT: {
|
||||||
|
MyMessageBox::warning(this, tr("Network Error"),
|
||||||
|
tr("Connection timed out.\nPlease check the server address.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
|
||||||
|
QMessageBox::Close);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ERR_SOCK_SELECT_FAILED: {
|
case ERR_SOCK_SELECT_FAILED: {
|
||||||
MyMessageBox::warning(this, tr("Network Error"),
|
MyMessageBox::warning(this, tr("Network Error"),
|
||||||
tr("Internal network error: \"select\" failed."),
|
tr("Internal network error: \"select\" failed."),
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ public slots:
|
|||||||
void callSettingsDialog(bool);
|
void callSettingsDialog(bool);
|
||||||
void callSettingsDialogFromStartwindow();
|
void callSettingsDialogFromStartwindow();
|
||||||
void callNewGameDialog();
|
void callNewGameDialog();
|
||||||
|
void callNewGameDialogNew();
|
||||||
void callGameLobbyDialog();
|
void callGameLobbyDialog();
|
||||||
void callCreateNetworkGameDialog();
|
void callCreateNetworkGameDialog();
|
||||||
void callJoinNetworkGameDialog();
|
void callJoinNetworkGameDialog();
|
||||||
@@ -161,6 +162,7 @@ public slots:
|
|||||||
void callLogFileDialog();
|
void callLogFileDialog();
|
||||||
|
|
||||||
void startNewLocalGame(newGameDialogImpl* =0);
|
void startNewLocalGame(newGameDialogImpl* =0);
|
||||||
|
void startNewLocalGameNew(newGameDialogImpl* =0);
|
||||||
|
|
||||||
void showTimeoutDialog(int msgID, unsigned duration);
|
void showTimeoutDialog(int msgID, unsigned duration);
|
||||||
void hideTimeoutDialog();
|
void hideTimeoutDialog();
|
||||||
|
|||||||
@@ -1332,7 +1332,7 @@ void GameTableStyleReader::showOutdatedErrorMessage()
|
|||||||
|
|
||||||
void GameTableStyleReader::setTableBackground(gameTableImpl *gt)
|
void GameTableStyleReader::setTableBackground(gameTableImpl *gt)
|
||||||
{
|
{
|
||||||
gt->setStyleSheet("QMainWindow { background-image: url(\""+Table+"\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
|
gt->centralWidget()->setStyleSheet(".QWidget { background-image: url(\""+Table+"\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameTableStyleReader::setChatLogStyle(QTextBrowser *tb)
|
void GameTableStyleReader::setChatLogStyle(QTextBrowser *tb)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -218,7 +219,7 @@ protected:
|
|||||||
|
|
||||||
ClientState &GetState();
|
ClientState &GetState();
|
||||||
void SetState(ClientState &newState);
|
void SetState(ClientState &newState);
|
||||||
boost::asio::deadline_timer &GetStateTimer();
|
boost::asio::steady_timer &GetStateTimer();
|
||||||
|
|
||||||
SenderHelper &GetSender();
|
SenderHelper &GetSender();
|
||||||
|
|
||||||
@@ -341,8 +342,8 @@ private:
|
|||||||
mutable boost::mutex m_pingDataMutex;
|
mutable boost::mutex m_pingDataMutex;
|
||||||
PingData m_pingData;
|
PingData m_pingData;
|
||||||
|
|
||||||
boost::asio::deadline_timer m_stateTimer;
|
boost::asio::steady_timer m_stateTimer;
|
||||||
boost::asio::deadline_timer m_avatarTimer;
|
boost::asio::steady_timer m_avatarTimer;
|
||||||
|
|
||||||
friend class AbstractClientStateReceiving;
|
friend class AbstractClientStateReceiving;
|
||||||
friend class ClientStateInit;
|
friend class ClientStateInit;
|
||||||
|
|||||||
@@ -60,6 +60,12 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace boost::filesystem;
|
using namespace boost::filesystem;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CLIENT_WAIT_TIMEOUT_MSEC 50
|
#define CLIENT_WAIT_TIMEOUT_MSEC 50
|
||||||
#define CLIENT_CONNECT_TIMEOUT_SEC 10
|
#define CLIENT_CONNECT_TIMEOUT_SEC 10
|
||||||
|
|
||||||
@@ -238,7 +244,7 @@ void
|
|||||||
ClientStateDownloadingServerList::Enter(boost::shared_ptr<ClientThread> client)
|
ClientStateDownloadingServerList::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
{
|
{
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateDownloadingServerList::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateDownloadingServerList::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -265,7 +271,7 @@ ClientStateDownloadingServerList::TimerLoop(const boost::system::error_code& ec,
|
|||||||
client->SetState(ClientStateReadingServerList::Instance());
|
client->SetState(ClientStateReadingServerList::Instance());
|
||||||
} else {
|
} else {
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateDownloadingServerList::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateDownloadingServerList::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -409,7 +415,7 @@ void
|
|||||||
ClientStateWaitChooseServer::Enter(boost::shared_ptr<ClientThread> client)
|
ClientStateWaitChooseServer::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
{
|
{
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateWaitChooseServer::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateWaitChooseServer::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -432,7 +438,7 @@ ClientStateWaitChooseServer::TimerLoop(const boost::system::error_code& ec, boos
|
|||||||
client->SetState(ClientStateStartResolve::Instance());
|
client->SetState(ClientStateStartResolve::Instance());
|
||||||
} else {
|
} else {
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateWaitChooseServer::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateWaitChooseServer::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -461,7 +467,7 @@ void
|
|||||||
ClientStateStartConnect::Enter(boost::shared_ptr<ClientThread> client)
|
ClientStateStartConnect::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
{
|
{
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::seconds(CLIENT_CONNECT_TIMEOUT_SEC));
|
seconds(CLIENT_CONNECT_TIMEOUT_SEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateStartConnect::TimerTimeout, this, boost::asio::placeholders::error, client));
|
&ClientStateStartConnect::TimerTimeout, this, boost::asio::placeholders::error, client));
|
||||||
@@ -511,7 +517,11 @@ ClientStateStartConnect::HandleConnect(const boost::system::error_code& ec, boos
|
|||||||
client));
|
client));
|
||||||
} else {
|
} else {
|
||||||
if (ec != boost::asio::error::operation_aborted) {
|
if (ec != boost::asio::error::operation_aborted) {
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_FAILED, ec.value());
|
if (client->GetContext().GetAddrFamily() == AF_INET6) {
|
||||||
|
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_IPV6_FAILED, ec.value());
|
||||||
|
} else {
|
||||||
|
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_FAILED, ec.value());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -523,7 +533,11 @@ ClientStateStartConnect::TimerTimeout(const boost::system::error_code& ec, boost
|
|||||||
if (!ec && &client->GetState() == this) {
|
if (!ec && &client->GetState() == this) {
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
client->GetContext().GetSessionData()->GetAsioSocket()->close(ec);
|
client->GetContext().GetSessionData()->GetAsioSocket()->close(ec);
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_TIMEOUT, 0);
|
if (client->GetContext().GetAddrFamily() == AF_INET6) {
|
||||||
|
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_IPV6_TIMEOUT, 0);
|
||||||
|
} else {
|
||||||
|
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_TIMEOUT, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -986,7 +1000,7 @@ void
|
|||||||
ClientStateWaitEnterLogin::Enter(boost::shared_ptr<ClientThread> client)
|
ClientStateWaitEnterLogin::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
{
|
{
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -1065,7 +1079,7 @@ ClientStateWaitEnterLogin::TimerLoop(const boost::system::error_code& ec, boost:
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -1399,7 +1413,7 @@ void
|
|||||||
ClientStateSynchronizeStart::Enter(boost::shared_ptr<ClientThread> client)
|
ClientStateSynchronizeStart::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
{
|
{
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateSynchronizeStart::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateSynchronizeStart::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -1429,7 +1443,7 @@ ClientStateSynchronizeStart::TimerLoop(const boost::system::error_code& ec, boos
|
|||||||
client->SetState(ClientStateWaitStart::Instance());
|
client->SetState(ClientStateWaitStart::Instance());
|
||||||
} else {
|
} else {
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateSynchronizeStart::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateSynchronizeStart::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -1637,7 +1651,7 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
|||||||
// Basic synchronisation before a new hand is started.
|
// Basic synchronisation before a new hand is started.
|
||||||
client->GetGui().waitForGuiUpdateDone();
|
client->GetGui().waitForGuiUpdateDone();
|
||||||
// Start new hand.
|
// Start new hand.
|
||||||
client->GetGame()->getSeatsList()->front()->setMyCards(myCards);
|
client->GetGame()->getSeatsList()->front()->setMyHoleCards(myCards);
|
||||||
client->GetGame()->initHand();
|
client->GetGame()->initHand();
|
||||||
client->GetGame()->getCurrentHand()->setSmallBlind(netHandStart.smallblind());
|
client->GetGame()->getCurrentHand()->setSmallBlind(netHandStart.smallblind());
|
||||||
client->GetGame()->getCurrentHand()->getCurrentBeRo()->setMinimumRaise(2 * netHandStart.smallblind());
|
client->GetGame()->getCurrentHand()->getCurrentBeRo()->setMinimumRaise(2 * netHandStart.smallblind());
|
||||||
@@ -1677,7 +1691,7 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
|||||||
int bestHandPos[5];
|
int bestHandPos[5];
|
||||||
tmpCards[0] = static_cast<int>(r.resultcard1());
|
tmpCards[0] = static_cast<int>(r.resultcard1());
|
||||||
tmpCards[1] = static_cast<int>(r.resultcard2());
|
tmpCards[1] = static_cast<int>(r.resultcard2());
|
||||||
tmpPlayer->setMyCards(tmpCards);
|
tmpPlayer->setMyHoleCards(tmpCards);
|
||||||
for (int num = 0; num < 5; num++) {
|
for (int num = 0; num < 5; num++) {
|
||||||
bestHandPos[num] = r.besthandposition(num);
|
bestHandPos[num] = r.besthandposition(num);
|
||||||
}
|
}
|
||||||
@@ -1794,7 +1808,6 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMySet(),
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMySet(),
|
||||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyName(),
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyName(),
|
||||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyName());
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyName());
|
||||||
client->GetGui().flushLogAtHand();
|
|
||||||
client->GetClientLog()->logNewHandMsg(
|
client->GetClientLog()->logNewHandMsg(
|
||||||
curGame->getCurrentHandID(),
|
curGame->getCurrentHandID(),
|
||||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getDealerPosition())->getMyID()+1,
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getDealerPosition())->getMyID()+1,
|
||||||
@@ -1926,7 +1939,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
int tmpCards[2];
|
int tmpCards[2];
|
||||||
tmpCards[0] = static_cast<int>(p.allincard1());
|
tmpCards[0] = static_cast<int>(p.allincard1());
|
||||||
tmpCards[1] = static_cast<int>(p.allincard2());
|
tmpCards[1] = static_cast<int>(p.allincard2());
|
||||||
tmpPlayer->setMyCards(tmpCards);
|
tmpPlayer->setMyHoleCards(tmpCards);
|
||||||
}
|
}
|
||||||
client->GetGui().flipHolecardsAllIn();
|
client->GetGui().flipHolecardsAllIn();
|
||||||
if(curGame->getCurrentHand()->getCurrentRound()<GAME_STATE_RIVER) {
|
if(curGame->getCurrentHand()->getCurrentRound()<GAME_STATE_RIVER) {
|
||||||
@@ -1998,7 +2011,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
int bestHandPos[5];
|
int bestHandPos[5];
|
||||||
tmpCards[0] = static_cast<int>(r.resultcard1());
|
tmpCards[0] = static_cast<int>(r.resultcard1());
|
||||||
tmpCards[1] = static_cast<int>(r.resultcard2());
|
tmpCards[1] = static_cast<int>(r.resultcard2());
|
||||||
tmpPlayer->setMyCards(tmpCards);
|
tmpPlayer->setMyHoleCards(tmpCards);
|
||||||
for (int num = 0; num < 5; num++) {
|
for (int num = 0; num < 5; num++) {
|
||||||
bestHandPos[num] = r.besthandposition(num);
|
bestHandPos[num] = r.besthandposition(num);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,12 @@ using namespace std;
|
|||||||
using namespace boost::filesystem;
|
using namespace boost::filesystem;
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
ClientThread::ClientThread(GuiInterface &gui, AvatarManager &avatarManager, Log *myLog)
|
ClientThread::ClientThread(GuiInterface &gui, AvatarManager &avatarManager, Log *myLog)
|
||||||
: m_ioService(new boost::asio::io_service), m_clientLog(myLog), m_curState(NULL), m_gui(gui),
|
: m_ioService(new boost::asio::io_service), m_clientLog(myLog), m_curState(NULL), m_gui(gui),
|
||||||
m_avatarManager(avatarManager), m_isServerSelected(false),
|
m_avatarManager(avatarManager), m_isServerSelected(false),
|
||||||
@@ -586,7 +592,7 @@ void
|
|||||||
ClientThread::RegisterTimers()
|
ClientThread::RegisterTimers()
|
||||||
{
|
{
|
||||||
m_avatarTimer.expires_from_now(
|
m_avatarTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
||||||
m_avatarTimer.async_wait(
|
m_avatarTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientThread::TimerCheckAvatarDownloads, shared_from_this(), boost::asio::placeholders::error));
|
&ClientThread::TimerCheckAvatarDownloads, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -910,7 +916,7 @@ ClientThread::TimerCheckAvatarDownloads(const boost::system::error_code& ec)
|
|||||||
PassAvatarFileToManager(playerId, tmpAvatar);
|
PassAvatarFileToManager(playerId, tmpAvatar);
|
||||||
}
|
}
|
||||||
m_avatarTimer.expires_from_now(
|
m_avatarTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
||||||
m_avatarTimer.async_wait(
|
m_avatarTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientThread::TimerCheckAvatarDownloads, shared_from_this(), boost::asio::placeholders::error));
|
&ClientThread::TimerCheckAvatarDownloads, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -1022,7 +1028,7 @@ ClientThread::SetState(ClientState &newState)
|
|||||||
m_curState->Enter(shared_from_this());
|
m_curState->Enter(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::deadline_timer &
|
boost::asio::steady_timer &
|
||||||
ClientThread::GetStateTimer()
|
ClientThread::GetStateTimer()
|
||||||
{
|
{
|
||||||
return m_stateTimer;
|
return m_stateTimer;
|
||||||
|
|||||||
@@ -49,6 +49,12 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace boost::filesystem;
|
using namespace boost::filesystem;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
ServerAdminBot::ServerAdminBot(boost::shared_ptr<boost::asio::io_service> ioService)
|
ServerAdminBot::ServerAdminBot(boost::shared_ptr<boost::asio::io_service> ioService)
|
||||||
: m_notifyTimeoutMinutes(0), m_notifyIntervalMinutes(0), m_notifyCounter(0),
|
: m_notifyTimeoutMinutes(0), m_notifyIntervalMinutes(0), m_notifyCounter(0),
|
||||||
m_notifyTimer(boost::posix_time::time_duration(0, 0, 0), boost::timers::portable::second_timer::manual_start),
|
m_notifyTimer(boost::posix_time::time_duration(0, 0, 0), boost::timers::portable::second_timer::manual_start),
|
||||||
@@ -272,17 +278,17 @@ ServerAdminBot::Run()
|
|||||||
if (m_ircAdminThread) {
|
if (m_ircAdminThread) {
|
||||||
// Initialise the timers.
|
// Initialise the timers.
|
||||||
m_reconnectTimer.expires_from_now(
|
m_reconnectTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
||||||
m_reconnectTimer.async_wait(
|
m_reconnectTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::ReconnectHandler, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::ReconnectHandler, shared_from_this(), boost::asio::placeholders::error));
|
||||||
m_notifyLoopTimer.expires_from_now(
|
m_notifyLoopTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_NOTIFY_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_NOTIFY_IRC_BOT_INTERVAL_SEC));
|
||||||
m_notifyLoopTimer.async_wait(
|
m_notifyLoopTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::NotifyLoop, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::NotifyLoop, shared_from_this(), boost::asio::placeholders::error));
|
||||||
m_checkFileTimer.expires_from_now(
|
m_checkFileTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_CHECK_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_CHECK_IRC_BOT_INTERVAL_SEC));
|
||||||
m_checkFileTimer.async_wait(
|
m_checkFileTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::CheckFileHandler, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::CheckFileHandler, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -298,7 +304,7 @@ ServerAdminBot::ReconnectHandler(const boost::system::error_code& ec)
|
|||||||
Reconnect();
|
Reconnect();
|
||||||
|
|
||||||
m_reconnectTimer.expires_from_now(
|
m_reconnectTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
||||||
m_reconnectTimer.async_wait(
|
m_reconnectTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::ReconnectHandler, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::ReconnectHandler, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -330,7 +336,7 @@ ServerAdminBot::CheckFileHandler(const boost::system::error_code& ec)
|
|||||||
Reconnect();
|
Reconnect();
|
||||||
}
|
}
|
||||||
m_checkFileTimer.expires_from_now(
|
m_checkFileTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_CHECK_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_CHECK_IRC_BOT_INTERVAL_SEC));
|
||||||
m_checkFileTimer.async_wait(
|
m_checkFileTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::CheckFileHandler, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::CheckFileHandler, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -386,7 +392,7 @@ ServerAdminBot::NotifyLoop(const boost::system::error_code& ec)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_notifyLoopTimer.expires_from_now(
|
m_notifyLoopTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_NOTIFY_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_NOTIFY_IRC_BOT_INTERVAL_SEC));
|
||||||
m_notifyLoopTimer.async_wait(
|
m_notifyLoopTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::NotifyLoop, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::NotifyLoop, shared_from_this(), boost::asio::placeholders::error));
|
||||||
|
|||||||
@@ -34,6 +34,11 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
ServerBanManager::ServerBanManager(boost::shared_ptr<boost::asio::io_service> ioService)
|
ServerBanManager::ServerBanManager(boost::shared_ptr<boost::asio::io_service> ioService)
|
||||||
: m_ioService(ioService), m_curBanId(0)
|
: m_ioService(ioService), m_curBanId(0)
|
||||||
@@ -126,7 +131,7 @@ ServerBanManager::GetBanList(list<string> &list) const
|
|||||||
banText << (*i_nick).first << ": (nickStr) - " << (*i_nick).second.nameStr;
|
banText << (*i_nick).first << ": (nickStr) - " << (*i_nick).second.nameStr;
|
||||||
|
|
||||||
if ((*i_nick).second.timer)
|
if ((*i_nick).second.timer)
|
||||||
banText << " duration: " << (*i_nick).second.timer->expires_from_now().hours() << "h";
|
banText << " duration: " << duration_cast<hours>((*i_nick).second.timer->expires_from_now()).count() << "h";
|
||||||
list.push_back(banText.str());
|
list.push_back(banText.str());
|
||||||
++i_nick;
|
++i_nick;
|
||||||
}
|
}
|
||||||
@@ -136,7 +141,7 @@ ServerBanManager::GetBanList(list<string> &list) const
|
|||||||
ostringstream banText;
|
ostringstream banText;
|
||||||
banText << (*i_ip).first << ": (IP) - " << (*i_ip).second.ipAddress;
|
banText << (*i_ip).first << ": (IP) - " << (*i_ip).second.ipAddress;
|
||||||
if ((*i_ip).second.timer)
|
if ((*i_ip).second.timer)
|
||||||
banText << " duration: " << (*i_ip).second.timer->expires_from_now().hours() << "h";
|
banText << " duration: " << duration_cast<hours>((*i_ip).second.timer->expires_from_now()).count() << "h";
|
||||||
list.push_back(banText.str());
|
list.push_back(banText.str());
|
||||||
++i_ip;
|
++i_ip;
|
||||||
}
|
}
|
||||||
@@ -235,14 +240,14 @@ ServerBanManager::IsBadGameName(const std::string &name) const
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<boost::asio::deadline_timer>
|
boost::shared_ptr<boost::asio::steady_timer>
|
||||||
ServerBanManager::InternalRegisterTimedBan(unsigned timerId, unsigned durationHours)
|
ServerBanManager::InternalRegisterTimedBan(unsigned timerId, unsigned durationHours)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<boost::asio::deadline_timer> tmpTimer;
|
boost::shared_ptr<boost::asio::steady_timer> tmpTimer;
|
||||||
if (durationHours) {
|
if (durationHours) {
|
||||||
tmpTimer.reset(new boost::asio::deadline_timer(*m_ioService));
|
tmpTimer.reset(new boost::asio::steady_timer(*m_ioService));
|
||||||
tmpTimer->expires_from_now(
|
tmpTimer->expires_from_now(
|
||||||
boost::posix_time::hours(durationHours));
|
hours(durationHours));
|
||||||
tmpTimer->async_wait(
|
tmpTimer->async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerBanManager::TimerRemoveBan, shared_from_this(), boost::asio::placeholders::error, timerId, tmpTimer));
|
&ServerBanManager::TimerRemoveBan, shared_from_this(), boost::asio::placeholders::error, timerId, tmpTimer));
|
||||||
@@ -251,7 +256,7 @@ ServerBanManager::InternalRegisterTimedBan(unsigned timerId, unsigned durationHo
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerBanManager::TimerRemoveBan(const boost::system::error_code &ec, unsigned banId, boost::shared_ptr<boost::asio::deadline_timer> timer)
|
ServerBanManager::TimerRemoveBan(const boost::system::error_code &ec, unsigned banId, boost::shared_ptr<boost::asio::steady_timer> timer)
|
||||||
{
|
{
|
||||||
if (!ec && timer)
|
if (!ec && timer)
|
||||||
UnBan(banId);
|
UnBan(banId);
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
#include "serverdelaytime.h"
|
||||||
|
|
||||||
|
//#define POKERTH_SERVER_TEST
|
||||||
|
|
||||||
|
#ifdef POKERTH_SERVER_TEST
|
||||||
|
#define SERVER_DELAY_NEXT_GAME_SEC 0
|
||||||
|
#define SERVER_DEAL_FLOP_CARDS_DELAY_SEC 0
|
||||||
|
#define SERVER_DEAL_TURN_CARD_DELAY_SEC 0
|
||||||
|
#define SERVER_DEAL_RIVER_CARD_DELAY_SEC 0
|
||||||
|
#define SERVER_DEAL_ADD_ALL_IN_DELAY_SEC 0
|
||||||
|
#define SERVER_SHOW_CARDS_DELAY_SEC 0
|
||||||
|
#define SERVER_COMPUTER_ACTION_DELAY_SEC 0
|
||||||
|
#define SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC 1
|
||||||
|
#else
|
||||||
|
#define SERVER_DELAY_NEXT_GAME_SEC 10
|
||||||
|
#define SERVER_DEAL_FLOP_CARDS_DELAY_SEC 5
|
||||||
|
#define SERVER_DEAL_TURN_CARD_DELAY_SEC 2
|
||||||
|
#define SERVER_DEAL_RIVER_CARD_DELAY_SEC 2
|
||||||
|
#define SERVER_DEAL_ADD_ALL_IN_DELAY_SEC 2
|
||||||
|
#define SERVER_SHOW_CARDS_DELAY_SEC 2
|
||||||
|
#define SERVER_COMPUTER_ACTION_DELAY_SEC 2
|
||||||
|
#define SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ServerDelayTime::ServerDelayTime(const ServerMode mode)
|
||||||
|
{
|
||||||
|
if(mode == SERVER_MODE_LAN_LOCAL) {
|
||||||
|
nextGameDelay = 0;
|
||||||
|
dealFlopCardsDelay = 0;
|
||||||
|
dealTurnCardsDelay = 0;
|
||||||
|
dealRiverCardsDelay = 0;
|
||||||
|
dealAddAllInDelay = 0;
|
||||||
|
showCardsDelay = 0;
|
||||||
|
computerActionDelay = 0;
|
||||||
|
playerTimeoutAddDelay = 0;
|
||||||
|
} else {
|
||||||
|
nextGameDelay = SERVER_DELAY_NEXT_GAME_SEC;
|
||||||
|
dealFlopCardsDelay = SERVER_DEAL_FLOP_CARDS_DELAY_SEC;
|
||||||
|
dealTurnCardsDelay = SERVER_DEAL_TURN_CARD_DELAY_SEC;
|
||||||
|
dealRiverCardsDelay = SERVER_DEAL_RIVER_CARD_DELAY_SEC;
|
||||||
|
dealAddAllInDelay = SERVER_DEAL_ADD_ALL_IN_DELAY_SEC;
|
||||||
|
showCardsDelay = SERVER_SHOW_CARDS_DELAY_SEC;
|
||||||
|
computerActionDelay = SERVER_COMPUTER_ACTION_DELAY_SEC;
|
||||||
|
playerTimeoutAddDelay = SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int ServerDelayTime::getNextGameDelay() const
|
||||||
|
{
|
||||||
|
return nextGameDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ServerDelayTime::getDealFlopCardsDelay() const
|
||||||
|
{
|
||||||
|
return dealFlopCardsDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ServerDelayTime::getDealTurnCardsDelay() const
|
||||||
|
{
|
||||||
|
return dealTurnCardsDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ServerDelayTime::getDealRiverCardsDelay() const
|
||||||
|
{
|
||||||
|
return dealRiverCardsDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ServerDelayTime::getDealAddAllInDelay() const
|
||||||
|
{
|
||||||
|
return dealAddAllInDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ServerDelayTime::getShowCardsDelay() const
|
||||||
|
{
|
||||||
|
return showCardsDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ServerDelayTime::getComputerActionDelay() const
|
||||||
|
{
|
||||||
|
return computerActionDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ServerDelayTime::getPlayerTimeoutAddDelay() const
|
||||||
|
{
|
||||||
|
return playerTimeoutAddDelay;
|
||||||
|
}
|
||||||
@@ -53,6 +53,12 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool LessThanPlayerHandStartMoney(const boost::shared_ptr<PlayerInterface> p1, const boost::shared_ptr<PlayerInterface> p2)
|
static bool LessThanPlayerHandStartMoney(const boost::shared_ptr<PlayerInterface> p1, const boost::shared_ptr<PlayerInterface> p2)
|
||||||
{
|
{
|
||||||
return p1->getMyRoundStartCash() < p2->getMyRoundStartCash();
|
return p1->getMyRoundStartCash() < p2->getMyRoundStartCash();
|
||||||
@@ -60,13 +66,13 @@ static bool LessThanPlayerHandStartMoney(const boost::shared_ptr<PlayerInterface
|
|||||||
|
|
||||||
|
|
||||||
ServerGame::ServerGame(boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32_t id, const string &name, const string &pwd, const GameData &gameData,
|
ServerGame::ServerGame(boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32_t id, const string &name, const string &pwd, const GameData &gameData,
|
||||||
unsigned adminPlayerId, unsigned creatorPlayerDBId, GuiInterface &gui, ConfigFile &playerConfig)
|
unsigned adminPlayerId, unsigned creatorPlayerDBId, GuiInterface &gui, ConfigFile &playerConfig, const ServerMode mode)
|
||||||
: m_adminPlayerId(adminPlayerId), m_lobbyThread(lobbyThread), m_gui(gui),
|
: m_adminPlayerId(adminPlayerId), m_lobbyThread(lobbyThread), m_gui(gui),
|
||||||
m_gameData(gameData), m_curState(NULL), m_id(id), m_name(name),
|
m_gameData(gameData), m_curState(NULL), m_id(id), m_name(name),
|
||||||
m_password(pwd), m_creatorPlayerDBId(creatorPlayerDBId), m_playerConfig(playerConfig),
|
m_password(pwd), m_creatorPlayerDBId(creatorPlayerDBId), m_playerConfig(playerConfig),
|
||||||
m_gameNum(1), m_curPetitionId(1), m_voteKickTimer(lobbyThread->GetIOService()),
|
m_gameNum(1), m_curPetitionId(1), m_voteKickTimer(lobbyThread->GetIOService()),
|
||||||
m_stateTimer1(lobbyThread->GetIOService()), m_stateTimer2(lobbyThread->GetIOService()),
|
m_stateTimer1(lobbyThread->GetIOService()), m_stateTimer2(lobbyThread->GetIOService()),
|
||||||
m_isNameReported(false)
|
m_isNameReported(false), m_serverDelayTime(mode)
|
||||||
{
|
{
|
||||||
LOG_VERBOSE("Game object " << GetId() << " created.");
|
LOG_VERBOSE("Game object " << GetId() << " created.");
|
||||||
}
|
}
|
||||||
@@ -276,7 +282,7 @@ ServerGame::TimerVoteKick(const boost::system::error_code &ec)
|
|||||||
m_voteKickData.reset();
|
m_voteKickData.reset();
|
||||||
}
|
}
|
||||||
m_voteKickTimer.expires_from_now(
|
m_voteKickTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_CHECK_VOTE_KICK_INTERVAL_MSEC));
|
milliseconds(SERVER_CHECK_VOTE_KICK_INTERVAL_MSEC));
|
||||||
m_voteKickTimer.async_wait(
|
m_voteKickTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGame::TimerVoteKick, shared_from_this(), boost::asio::placeholders::error));
|
&ServerGame::TimerVoteKick, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -514,7 +520,7 @@ ServerGame::InternalAskVoteKick(boost::shared_ptr<SessionData> byWhom, unsigned
|
|||||||
SendToAllPlayers(packet, SessionData::Game);
|
SendToAllPlayers(packet, SessionData::Game);
|
||||||
|
|
||||||
m_voteKickTimer.expires_from_now(
|
m_voteKickTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_CHECK_VOTE_KICK_INTERVAL_MSEC));
|
milliseconds(SERVER_CHECK_VOTE_KICK_INTERVAL_MSEC));
|
||||||
m_voteKickTimer.async_wait(
|
m_voteKickTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGame::TimerVoteKick, shared_from_this(), boost::asio::placeholders::error));
|
&ServerGame::TimerVoteKick, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -1036,6 +1042,12 @@ ServerGame::GetSessionManager() const
|
|||||||
return m_sessionManager;
|
return m_sessionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ServerDelayTime
|
||||||
|
ServerGame::GetServerDelayTime() const
|
||||||
|
{
|
||||||
|
return m_serverDelayTime;
|
||||||
|
}
|
||||||
|
|
||||||
ServerDBInterface &
|
ServerDBInterface &
|
||||||
ServerGame::GetDatabase()
|
ServerGame::GetDatabase()
|
||||||
{
|
{
|
||||||
@@ -1072,13 +1084,13 @@ ServerGame::SetState(ServerGameState &newState)
|
|||||||
m_curState->Enter(shared_from_this());
|
m_curState->Enter(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::deadline_timer &
|
boost::asio::steady_timer &
|
||||||
ServerGame::GetStateTimer1()
|
ServerGame::GetStateTimer1()
|
||||||
{
|
{
|
||||||
return m_stateTimer1;
|
return m_stateTimer1;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::deadline_timer &
|
boost::asio::steady_timer &
|
||||||
ServerGame::GetStateTimer2()
|
ServerGame::GetStateTimer2()
|
||||||
{
|
{
|
||||||
return m_stateTimer2;
|
return m_stateTimer2;
|
||||||
@@ -1132,7 +1144,7 @@ bool
|
|||||||
ServerGame::CheckSettings(const GameData &data, const string &password, ServerMode mode)
|
ServerGame::CheckSettings(const GameData &data, const string &password, ServerMode mode)
|
||||||
{
|
{
|
||||||
bool retVal = true;
|
bool retVal = true;
|
||||||
if (mode != SERVER_MODE_LAN) {
|
if (mode != SERVER_MODE_LAN && mode != SERVER_MODE_LAN_LOCAL) {
|
||||||
if (data.playerActionTimeoutSec < 5) {
|
if (data.playerActionTimeoutSec < 5) {
|
||||||
retVal = false;
|
retVal = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,26 +52,10 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
//#define POKERTH_SERVER_TEST
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
#ifdef POKERTH_SERVER_TEST
|
|
||||||
#define SERVER_DELAY_NEXT_GAME_SEC 0
|
|
||||||
#define SERVER_DEAL_FLOP_CARDS_DELAY_SEC 0
|
|
||||||
#define SERVER_DEAL_TURN_CARD_DELAY_SEC 0
|
|
||||||
#define SERVER_DEAL_RIVER_CARD_DELAY_SEC 0
|
|
||||||
#define SERVER_DEAL_ADD_ALL_IN_DELAY_SEC 0
|
|
||||||
#define SERVER_SHOW_CARDS_DELAY_SEC 0
|
|
||||||
#define SERVER_COMPUTER_ACTION_DELAY_SEC 0
|
|
||||||
#define SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC 1
|
|
||||||
#else
|
#else
|
||||||
#define SERVER_DELAY_NEXT_GAME_SEC 10
|
using namespace boost::chrono;
|
||||||
#define SERVER_DEAL_FLOP_CARDS_DELAY_SEC 5
|
|
||||||
#define SERVER_DEAL_TURN_CARD_DELAY_SEC 2
|
|
||||||
#define SERVER_DEAL_RIVER_CARD_DELAY_SEC 2
|
|
||||||
#define SERVER_DEAL_ADD_ALL_IN_DELAY_SEC 2
|
|
||||||
#define SERVER_SHOW_CARDS_DELAY_SEC 2
|
|
||||||
#define SERVER_COMPUTER_ACTION_DELAY_SEC 2
|
|
||||||
#define SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC 2
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SERVER_START_GAME_TIMEOUT_SEC 10
|
#define SERVER_START_GAME_TIMEOUT_SEC 10
|
||||||
@@ -204,7 +188,7 @@ SetPlayerResult(PlayerResult &playerResult, boost::shared_ptr<PlayerInterface> t
|
|||||||
playerResult.set_playerid(tmpPlayer->getMyUniqueID());
|
playerResult.set_playerid(tmpPlayer->getMyUniqueID());
|
||||||
int tmpCards[2];
|
int tmpCards[2];
|
||||||
int bestHandPos[5];
|
int bestHandPos[5];
|
||||||
tmpPlayer->getMyCards(tmpCards);
|
tmpPlayer->getMyHoleCards(tmpCards);
|
||||||
playerResult.set_resultcard1(tmpCards[0]);
|
playerResult.set_resultcard1(tmpCards[0]);
|
||||||
playerResult.set_resultcard2(tmpCards[1]);
|
playerResult.set_resultcard2(tmpCards[1]);
|
||||||
tmpPlayer->getMyBestHandPosition(bestHandPos);
|
tmpPlayer->getMyBestHandPosition(bestHandPos);
|
||||||
@@ -568,9 +552,9 @@ void
|
|||||||
ServerGameStateInit::RegisterAdminTimer(boost::shared_ptr<ServerGame> server)
|
ServerGameStateInit::RegisterAdminTimer(boost::shared_ptr<ServerGame> server)
|
||||||
{
|
{
|
||||||
// No admin timeout in LAN or ranking games.
|
// No admin timeout in LAN or ranking games.
|
||||||
if (server->GetLobbyThread().GetServerMode() != SERVER_MODE_LAN && server->GetGameData().gameType != GAME_TYPE_RANKING) {
|
if (server->GetLobbyThread().GetServerMode() != SERVER_MODE_LAN && server->GetLobbyThread().GetServerMode() != SERVER_MODE_LAN_LOCAL && server->GetGameData().gameType != GAME_TYPE_RANKING) {
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_GAME_ADMIN_TIMEOUT_SEC - SERVER_GAME_ADMIN_WARNING_REMAINING_SEC));
|
seconds(SERVER_GAME_ADMIN_TIMEOUT_SEC - SERVER_GAME_ADMIN_WARNING_REMAINING_SEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateInit::TimerAdminWarning, this, boost::asio::placeholders::error, server));
|
&ServerGameStateInit::TimerAdminWarning, this, boost::asio::placeholders::error, server));
|
||||||
@@ -587,9 +571,9 @@ void
|
|||||||
ServerGameStateInit::RegisterAutoStartTimer(boost::shared_ptr<ServerGame> server)
|
ServerGameStateInit::RegisterAutoStartTimer(boost::shared_ptr<ServerGame> server)
|
||||||
{
|
{
|
||||||
// No autostart in LAN games.
|
// No autostart in LAN games.
|
||||||
if (server->GetLobbyThread().GetServerMode() != SERVER_MODE_LAN) {
|
if (server->GetLobbyThread().GetServerMode() != SERVER_MODE_LAN && server->GetLobbyThread().GetServerMode() != SERVER_MODE_LAN_LOCAL) {
|
||||||
server->GetStateTimer2().expires_from_now(
|
server->GetStateTimer2().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_AUTOSTART_GAME_DELAY_SEC));
|
seconds(SERVER_AUTOSTART_GAME_DELAY_SEC));
|
||||||
server->GetStateTimer2().async_wait(
|
server->GetStateTimer2().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateInit::TimerAutoStart, this, boost::asio::placeholders::error, server));
|
&ServerGameStateInit::TimerAutoStart, this, boost::asio::placeholders::error, server));
|
||||||
@@ -627,7 +611,7 @@ ServerGameStateInit::TimerAdminWarning(const boost::system::error_code &ec, boos
|
|||||||
}
|
}
|
||||||
// Start timeout timer.
|
// Start timeout timer.
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_GAME_ADMIN_WARNING_REMAINING_SEC));
|
seconds(SERVER_GAME_ADMIN_WARNING_REMAINING_SEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateInit::TimerAdminTimeout, this, boost::asio::placeholders::error, server));
|
&ServerGameStateInit::TimerAdminTimeout, this, boost::asio::placeholders::error, server));
|
||||||
@@ -762,7 +746,7 @@ void
|
|||||||
ServerGameStateStartGame::Enter(boost::shared_ptr<ServerGame> server)
|
ServerGameStateStartGame::Enter(boost::shared_ptr<ServerGame> server)
|
||||||
{
|
{
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_START_GAME_TIMEOUT_SEC));
|
seconds(SERVER_START_GAME_TIMEOUT_SEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateStartGame::TimerTimeout, this, boost::asio::placeholders::error, server));
|
&ServerGameStateStartGame::TimerTimeout, this, boost::asio::placeholders::error, server));
|
||||||
@@ -925,7 +909,7 @@ void
|
|||||||
ServerGameStateHand::Enter(boost::shared_ptr<ServerGame> server)
|
ServerGameStateHand::Enter(boost::shared_ptr<ServerGame> server)
|
||||||
{
|
{
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_LOOP_DELAY_MSEC));
|
milliseconds(SERVER_LOOP_DELAY_MSEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
||||||
@@ -993,7 +977,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
AllInShowCardsMessage::PlayerAllIn *playerAllIn = netAllInShow->add_playersallin();
|
AllInShowCardsMessage::PlayerAllIn *playerAllIn = netAllInShow->add_playersallin();
|
||||||
playerAllIn->set_playerid((*i)->getMyUniqueID());
|
playerAllIn->set_playerid((*i)->getMyUniqueID());
|
||||||
int tmpCards[2];
|
int tmpCards[2];
|
||||||
(*i)->getMyCards(tmpCards);
|
(*i)->getMyHoleCards(tmpCards);
|
||||||
playerAllIn->set_allincard1(tmpCards[0]);
|
playerAllIn->set_allincard1(tmpCards[0]);
|
||||||
playerAllIn->set_allincard2(tmpCards[1]);
|
playerAllIn->set_allincard2(tmpCards[1]);
|
||||||
++i;
|
++i;
|
||||||
@@ -1002,7 +986,8 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
curGame.getCurrentHand()->setCardsShown(true);
|
curGame.getCurrentHand()->setCardsShown(true);
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_SHOW_CARDS_DELAY_SEC));
|
seconds(server->GetServerDelayTime().getShowCardsDelay()));
|
||||||
|
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerShowCards, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerShowCards, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1010,7 +995,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
SendNewRoundCards(*server, curGame, newRound);
|
SendNewRoundCards(*server, curGame, newRound);
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(GetDealCardsDelaySec(*server)));
|
seconds(GetDealCardsDelaySec(*server)));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1038,7 +1023,8 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
// If the player is computer controlled, let the engine act.
|
// If the player is computer controlled, let the engine act.
|
||||||
if (curPlayer->getMyType() == PLAYER_TYPE_COMPUTER) {
|
if (curPlayer->getMyType() == PLAYER_TYPE_COMPUTER) {
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_COMPUTER_ACTION_DELAY_SEC));
|
seconds(server->GetServerDelayTime().getComputerActionDelay()));
|
||||||
|
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerComputerAction, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerComputerAction, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1049,7 +1035,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
PerformPlayerAction(*server, curPlayer, PLAYER_ACTION_FOLD, 0);
|
PerformPlayerAction(*server, curPlayer, PLAYER_ACTION_FOLD, 0);
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_LOOP_DELAY_MSEC));
|
milliseconds(SERVER_LOOP_DELAY_MSEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1117,7 +1103,8 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
|
|
||||||
// View a dialog for a new game - delayed.
|
// View a dialog for a new game - delayed.
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_DELAY_NEXT_GAME_SEC));
|
seconds(server->GetServerDelayTime().getNextGameDelay()));
|
||||||
|
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerNextGame, this, boost::asio::placeholders::error, server, winnerPlayer->getMyUniqueID()));
|
&ServerGameStateHand::TimerNextGame, this, boost::asio::placeholders::error, server, winnerPlayer->getMyUniqueID()));
|
||||||
@@ -1136,7 +1123,7 @@ ServerGameStateHand::TimerShowCards(const boost::system::error_code &ec, boost::
|
|||||||
SendNewRoundCards(*server, curGame, curGame.getCurrentHand()->getCurrentRound());
|
SendNewRoundCards(*server, curGame, curGame.getCurrentHand()->getCurrentRound());
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(GetDealCardsDelaySec(*server)));
|
seconds(GetDealCardsDelaySec(*server)));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1194,18 +1181,18 @@ int
|
|||||||
ServerGameStateHand::GetDealCardsDelaySec(ServerGame &server)
|
ServerGameStateHand::GetDealCardsDelaySec(ServerGame &server)
|
||||||
{
|
{
|
||||||
Game &curGame = server.GetGame();
|
Game &curGame = server.GetGame();
|
||||||
int allInDelay = curGame.getCurrentHand()->getAllInCondition() ? SERVER_DEAL_ADD_ALL_IN_DELAY_SEC : 0;
|
int allInDelay = curGame.getCurrentHand()->getAllInCondition() ? server.GetServerDelayTime().getDealAddAllInDelay() : 0;
|
||||||
int delay = 0;
|
int delay = 0;
|
||||||
|
|
||||||
switch(curGame.getCurrentHand()->getCurrentRound()) {
|
switch(curGame.getCurrentHand()->getCurrentRound()) {
|
||||||
case GAME_STATE_FLOP:
|
case GAME_STATE_FLOP:
|
||||||
delay = SERVER_DEAL_FLOP_CARDS_DELAY_SEC;
|
delay = server.GetServerDelayTime().getDealFlopCardsDelay();
|
||||||
break;
|
break;
|
||||||
case GAME_STATE_TURN:
|
case GAME_STATE_TURN:
|
||||||
delay = SERVER_DEAL_TURN_CARD_DELAY_SEC + allInDelay;
|
delay = server.GetServerDelayTime().getDealTurnCardsDelay() + allInDelay;
|
||||||
break;
|
break;
|
||||||
case GAME_STATE_RIVER:
|
case GAME_STATE_RIVER:
|
||||||
delay = SERVER_DEAL_RIVER_CARD_DELAY_SEC;
|
delay = server.GetServerDelayTime().getDealRiverCardsDelay();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -1251,7 +1238,7 @@ ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server)
|
|||||||
if (tmpSession) {
|
if (tmpSession) {
|
||||||
int cards[2];
|
int cards[2];
|
||||||
bool errorFlag = false;
|
bool errorFlag = false;
|
||||||
tmpPlayer->getMyCards(cards);
|
tmpPlayer->getMyHoleCards(cards);
|
||||||
|
|
||||||
boost::shared_ptr<NetPacket> notifyCards = CreateNetPacketHandStart(*server);
|
boost::shared_ptr<NetPacket> notifyCards = CreateNetPacketHandStart(*server);
|
||||||
HandStartMessage *netHandStart = notifyCards->GetMsg()->mutable_handstartmessage();
|
HandStartMessage *netHandStart = notifyCards->GetMsg()->mutable_handstartmessage();
|
||||||
@@ -1502,12 +1489,12 @@ ServerGameStateWaitPlayerAction::Enter(boost::shared_ptr<ServerGame> server)
|
|||||||
{
|
{
|
||||||
if (server->GetGameData().playerActionTimeoutSec > 0) { // zero means unlimited thinking time
|
if (server->GetGameData().playerActionTimeoutSec > 0) { // zero means unlimited thinking time
|
||||||
#ifdef POKERTH_SERVER_TEST
|
#ifdef POKERTH_SERVER_TEST
|
||||||
int timeoutSec = SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC;
|
int timeoutSec = server->GetServerDelayTime().getPlayerTimeoutAddDelay();
|
||||||
#else
|
#else
|
||||||
int timeoutSec = server->GetGameData().playerActionTimeoutSec + SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC;
|
int timeoutSec = server->GetServerDelayTime().getPlayerTimeoutAddDelay() + server->GetGameData().playerActionTimeoutSec;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(boost::posix_time::seconds(timeoutSec));
|
server->GetStateTimer1().expires_from_now(seconds(timeoutSec));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateWaitPlayerAction::TimerTimeout, this, boost::asio::placeholders::error, server));
|
&ServerGameStateWaitPlayerAction::TimerTimeout, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1641,7 +1628,7 @@ ServerGameStateWaitNextHand::Enter(boost::shared_ptr<ServerGame> server)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(timeoutSec));
|
seconds(timeoutSec));
|
||||||
|
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
|
|||||||
@@ -45,6 +45,12 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
ServerLobbyBot::ServerLobbyBot(boost::shared_ptr<boost::asio::io_service> ioService)
|
ServerLobbyBot::ServerLobbyBot(boost::shared_ptr<boost::asio::io_service> ioService)
|
||||||
: m_reconnectTimer(*ioService)
|
: m_reconnectTimer(*ioService)
|
||||||
{
|
{
|
||||||
@@ -110,7 +116,7 @@ ServerLobbyBot::Run()
|
|||||||
if (m_ircLobbyThread) {
|
if (m_ircLobbyThread) {
|
||||||
// Initialise the reconnect timer.
|
// Initialise the reconnect timer.
|
||||||
m_reconnectTimer.expires_from_now(
|
m_reconnectTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
||||||
m_reconnectTimer.async_wait(
|
m_reconnectTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyBot::Reconnect, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyBot::Reconnect, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -132,7 +138,7 @@ ServerLobbyBot::Reconnect(const boost::system::error_code& ec)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_reconnectTimer.expires_from_now(
|
m_reconnectTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
||||||
m_reconnectTimer.async_wait(
|
m_reconnectTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyBot::Reconnect, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyBot::Reconnect, shared_from_this(), boost::asio::placeholders::error));
|
||||||
|
|||||||
@@ -95,6 +95,11 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
class InternalServerCallback : public SessionDataCallback, public ChatCleanerCallback, public ServerDBCallback
|
class InternalServerCallback : public SessionDataCallback, public ChatCleanerCallback, public ServerDBCallback
|
||||||
{
|
{
|
||||||
@@ -296,6 +301,7 @@ ServerLobbyThread::AddConnection(boost::shared_ptr<SessionData> sessionData)
|
|||||||
netAnnounce->set_latestbetarevision(POKERTH_BETA_REVISION);
|
netAnnounce->set_latestbetarevision(POKERTH_BETA_REVISION);
|
||||||
switch (GetServerMode()) {
|
switch (GetServerMode()) {
|
||||||
case SERVER_MODE_LAN:
|
case SERVER_MODE_LAN:
|
||||||
|
case SERVER_MODE_LAN_LOCAL:
|
||||||
netAnnounce->set_servertype(AnnounceMessage::serverTypeLAN);
|
netAnnounce->set_servertype(AnnounceMessage::serverTypeLAN);
|
||||||
break;
|
break;
|
||||||
case SERVER_MODE_INTERNET_NOAUTH:
|
case SERVER_MODE_INTERNET_NOAUTH:
|
||||||
@@ -859,19 +865,19 @@ ServerLobbyThread::RegisterTimers()
|
|||||||
{
|
{
|
||||||
// Remove closed games.
|
// Remove closed games.
|
||||||
m_removeGameTimer.expires_from_now(
|
m_removeGameTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
||||||
m_removeGameTimer.async_wait(
|
m_removeGameTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerRemoveGame, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerRemoveGame, shared_from_this(), boost::asio::placeholders::error));
|
||||||
// Update the statistics file.
|
// Update the statistics file.
|
||||||
m_saveStatisticsTimer.expires_from_now(
|
m_saveStatisticsTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
||||||
m_saveStatisticsTimer.async_wait(
|
m_saveStatisticsTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerSaveStatisticsFile, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerSaveStatisticsFile, shared_from_this(), boost::asio::placeholders::error));
|
||||||
// Update the avatar upload locks.
|
// Update the avatar upload locks.
|
||||||
m_loginLockTimer.expires_from_now(
|
m_loginLockTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_UPDATE_LOGIN_LOCK_INTERVAL_MSEC));
|
milliseconds(SERVER_UPDATE_LOGIN_LOCK_INTERVAL_MSEC));
|
||||||
m_loginLockTimer.async_wait(
|
m_loginLockTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerUpdateClientLoginLock, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerUpdateClientLoginLock, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -1347,7 +1353,9 @@ ServerLobbyThread::HandleNetPacketCreateGame(boost::shared_ptr<SessionData> sess
|
|||||||
session->GetPlayerData()->GetUniqueId(),
|
session->GetPlayerData()->GetUniqueId(),
|
||||||
session->GetPlayerData()->GetDBId(),
|
session->GetPlayerData()->GetDBId(),
|
||||||
GetGui(),
|
GetGui(),
|
||||||
m_serverConfig));
|
m_serverConfig,
|
||||||
|
m_mode));
|
||||||
|
|
||||||
game->Init();
|
game->Init();
|
||||||
|
|
||||||
// Add game to list of games.
|
// Add game to list of games.
|
||||||
@@ -1689,8 +1697,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);
|
||||||
}
|
}
|
||||||
@@ -1860,7 +1867,7 @@ ServerLobbyThread::TimerRemoveGame(const boost::system::error_code &ec)
|
|||||||
}
|
}
|
||||||
// Restart timer
|
// Restart timer
|
||||||
m_removeGameTimer.expires_from_now(
|
m_removeGameTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
||||||
m_removeGameTimer.async_wait(
|
m_removeGameTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerRemoveGame, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerRemoveGame, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -1885,7 +1892,7 @@ ServerLobbyThread::TimerUpdateClientLoginLock(const boost::system::error_code &e
|
|||||||
}
|
}
|
||||||
// Restart timer
|
// Restart timer
|
||||||
m_loginLockTimer.expires_from_now(
|
m_loginLockTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_UPDATE_LOGIN_LOCK_INTERVAL_MSEC));
|
milliseconds(SERVER_UPDATE_LOGIN_LOCK_INTERVAL_MSEC));
|
||||||
m_loginLockTimer.async_wait(
|
m_loginLockTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerUpdateClientLoginLock, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerUpdateClientLoginLock, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -2232,7 +2239,7 @@ ServerLobbyThread::TimerSaveStatisticsFile(const boost::system::error_code &ec)
|
|||||||
}
|
}
|
||||||
// Restart timer
|
// Restart timer
|
||||||
m_saveStatisticsTimer.expires_from_now(
|
m_saveStatisticsTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
||||||
m_saveStatisticsTimer.async_wait(
|
m_saveStatisticsTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerSaveStatisticsFile, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerSaveStatisticsFile, shared_from_this(), boost::asio::placeholders::error));
|
||||||
|
|||||||
@@ -41,6 +41,12 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
SessionData::SessionData(boost::shared_ptr<boost::asio::ip::tcp::socket> sock, SessionId id, SessionDataCallback &cb, boost::asio::io_service &ioService)
|
SessionData::SessionData(boost::shared_ptr<boost::asio::ip::tcp::socket> sock, SessionId id, SessionDataCallback &cb, boost::asio::io_service &ioService)
|
||||||
: m_socket(sock), m_id(id), m_state(SessionData::Init), m_readyFlag(false), m_wantsLobbyMsg(true),
|
: m_socket(sock), m_id(id), m_state(SessionData::Init), m_readyFlag(false), m_wantsLobbyMsg(true),
|
||||||
m_activityTimeoutSec(0), m_activityWarningRemainingSec(0), m_initTimeoutTimer(ioService), m_globalTimeoutTimer(ioService),
|
m_activityTimeoutSec(0), m_activityWarningRemainingSec(0), m_initTimeoutTimer(ioService), m_globalTimeoutTimer(ioService),
|
||||||
@@ -236,7 +242,7 @@ SessionData::TimerActivityWarning(const boost::system::error_code &ec)
|
|||||||
m_callback.SessionTimeoutWarning(shared_from_this(), m_activityWarningRemainingSec);
|
m_callback.SessionTimeoutWarning(shared_from_this(), m_activityWarningRemainingSec);
|
||||||
|
|
||||||
m_activityTimeoutTimer.expires_from_now(
|
m_activityTimeoutTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(m_activityWarningRemainingSec));
|
seconds(m_activityWarningRemainingSec));
|
||||||
m_activityTimeoutTimer.async_wait(
|
m_activityTimeoutTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&SessionData::TimerSessionTimeout, shared_from_this(), boost::asio::placeholders::error));
|
&SessionData::TimerSessionTimeout, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -322,7 +328,7 @@ SessionData::ResetActivityTimer()
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||||
m_activityTimeoutTimer.expires_from_now(
|
m_activityTimeoutTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(m_activityTimeoutSec - m_activityWarningRemainingSec));
|
seconds(m_activityTimeoutSec - m_activityWarningRemainingSec));
|
||||||
m_activityTimeoutTimer.async_wait(
|
m_activityTimeoutTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&SessionData::TimerActivityWarning, shared_from_this(), boost::asio::placeholders::error));
|
&SessionData::TimerActivityWarning, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -333,7 +339,7 @@ SessionData::StartTimerInitTimeout(unsigned timeoutSec)
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||||
m_initTimeoutTimer.expires_from_now(
|
m_initTimeoutTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(timeoutSec));
|
seconds(timeoutSec));
|
||||||
m_initTimeoutTimer.async_wait(
|
m_initTimeoutTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&SessionData::TimerInitTimeout, shared_from_this(), boost::asio::placeholders::error));
|
&SessionData::TimerInitTimeout, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -344,7 +350,7 @@ SessionData::StartTimerGlobalTimeout(unsigned timeoutSec)
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||||
m_globalTimeoutTimer.expires_from_now(
|
m_globalTimeoutTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(timeoutSec));
|
seconds(timeoutSec));
|
||||||
m_globalTimeoutTimer.async_wait(
|
m_globalTimeoutTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&SessionData::TimerSessionTimeout, shared_from_this(), boost::asio::placeholders::error));
|
&SessionData::TimerSessionTimeout, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -358,7 +364,7 @@ SessionData::StartTimerActivityTimeout(unsigned timeoutSec, unsigned warningRema
|
|||||||
m_activityWarningRemainingSec = warningRemainingSec;
|
m_activityWarningRemainingSec = warningRemainingSec;
|
||||||
|
|
||||||
m_activityTimeoutTimer.expires_from_now(
|
m_activityTimeoutTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(timeoutSec - warningRemainingSec));
|
seconds(timeoutSec - warningRemainingSec));
|
||||||
m_activityTimeoutTimer.async_wait(
|
m_activityTimeoutTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&SessionData::TimerActivityWarning, shared_from_this(), boost::asio::placeholders::error));
|
&SessionData::TimerActivityWarning, shared_from_this(), boost::asio::placeholders::error));
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#define _SERVERADMINBOT_H_
|
#define _SERVERADMINBOT_H_
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <third_party/boost/timers.hpp>
|
#include <third_party/boost/timers.hpp>
|
||||||
@@ -96,9 +97,9 @@ private:
|
|||||||
boost::shared_ptr<IrcThread> m_ircAdminThread;
|
boost::shared_ptr<IrcThread> m_ircAdminThread;
|
||||||
boost::timers::portable::second_timer m_notifyTimer;
|
boost::timers::portable::second_timer m_notifyTimer;
|
||||||
|
|
||||||
boost::asio::deadline_timer m_reconnectTimer;
|
boost::asio::steady_timer m_reconnectTimer;
|
||||||
boost::asio::deadline_timer m_notifyLoopTimer;
|
boost::asio::steady_timer m_notifyLoopTimer;
|
||||||
boost::asio::deadline_timer m_checkFileTimer;
|
boost::asio::steady_timer m_checkFileTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <db/dbdefs.h>
|
#include <db/dbdefs.h>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
@@ -67,12 +68,12 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
struct TimedPlayerBan {
|
struct TimedPlayerBan {
|
||||||
boost::shared_ptr<boost::asio::deadline_timer> timer;
|
boost::shared_ptr<boost::asio::steady_timer> timer;
|
||||||
std::string nameStr;
|
std::string nameStr;
|
||||||
boost::regex nameRegex;
|
boost::regex nameRegex;
|
||||||
};
|
};
|
||||||
struct TimedIPBan {
|
struct TimedIPBan {
|
||||||
boost::shared_ptr<boost::asio::deadline_timer> timer;
|
boost::shared_ptr<boost::asio::steady_timer> timer;
|
||||||
std::string ipAddress;
|
std::string ipAddress;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,8 +82,8 @@ protected:
|
|||||||
typedef std::list<boost::regex> RegexList;
|
typedef std::list<boost::regex> RegexList;
|
||||||
typedef std::vector<DB_id> DBPlayerIdList;
|
typedef std::vector<DB_id> DBPlayerIdList;
|
||||||
|
|
||||||
boost::shared_ptr<boost::asio::deadline_timer> InternalRegisterTimedBan(unsigned timerId, unsigned durationHours);
|
boost::shared_ptr<boost::asio::steady_timer> InternalRegisterTimedBan(unsigned timerId, unsigned durationHours);
|
||||||
void TimerRemoveBan(const boost::system::error_code &ec, unsigned banId, boost::shared_ptr<boost::asio::deadline_timer> timer);
|
void TimerRemoveBan(const boost::system::error_code &ec, unsigned banId, boost::shared_ptr<boost::asio::steady_timer> timer);
|
||||||
|
|
||||||
boost::shared_ptr<boost::asio::io_service> m_ioService;
|
boost::shared_ptr<boost::asio::io_service> m_ioService;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef SERVERDELAYTIME_H
|
||||||
|
#define SERVERDELAYTIME_H
|
||||||
|
|
||||||
|
#include <game_defs.h>
|
||||||
|
|
||||||
|
class ServerDelayTime
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ServerDelayTime(const ServerMode mode);
|
||||||
|
|
||||||
|
int getNextGameDelay() const;
|
||||||
|
int getDealFlopCardsDelay() const;
|
||||||
|
int getDealTurnCardsDelay() const;
|
||||||
|
int getDealRiverCardsDelay() const;
|
||||||
|
int getDealAddAllInDelay() const;
|
||||||
|
int getShowCardsDelay() const;
|
||||||
|
int getComputerActionDelay() const;
|
||||||
|
int getPlayerTimeoutAddDelay() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
int nextGameDelay;
|
||||||
|
int dealFlopCardsDelay;
|
||||||
|
int dealTurnCardsDelay;
|
||||||
|
int dealRiverCardsDelay;
|
||||||
|
int dealAddAllInDelay;
|
||||||
|
int showCardsDelay;
|
||||||
|
int computerActionDelay;
|
||||||
|
int playerTimeoutAddDelay;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SERVERDELAYTIME_H
|
||||||
+12
-6
@@ -34,10 +34,12 @@
|
|||||||
#define _SERVERGAME_H_
|
#define _SERVERGAME_H_
|
||||||
|
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <third_party/boost/timers.hpp>
|
#include <third_party/boost/timers.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include <net/sessionmanager.h>
|
#include <net/sessionmanager.h>
|
||||||
|
#include <net/serverdelaytime.h>
|
||||||
#include <db/serverdbcallback.h>
|
#include <db/serverdbcallback.h>
|
||||||
#include <gui/guiinterface.h>
|
#include <gui/guiinterface.h>
|
||||||
#include <gamedata.h>
|
#include <gamedata.h>
|
||||||
@@ -56,7 +58,7 @@ class ServerGame : public boost::enable_shared_from_this<ServerGame>
|
|||||||
public:
|
public:
|
||||||
ServerGame(
|
ServerGame(
|
||||||
boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32_t id, const std::string &name, const std::string &pwd, const GameData &gameData,
|
boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32_t id, const std::string &name, const std::string &pwd, const GameData &gameData,
|
||||||
unsigned adminPlayerId, unsigned creatorPlayerDBId, GuiInterface &gui, ConfigFile &playerConfig);
|
unsigned adminPlayerId, unsigned creatorPlayerDBId, GuiInterface &gui, ConfigFile &playerConfig, const ServerMode mode);
|
||||||
virtual ~ServerGame();
|
virtual ~ServerGame();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
@@ -177,8 +179,8 @@ protected:
|
|||||||
ServerGameState &GetState();
|
ServerGameState &GetState();
|
||||||
void SetState(ServerGameState &newState);
|
void SetState(ServerGameState &newState);
|
||||||
|
|
||||||
boost::asio::deadline_timer &GetStateTimer1();
|
boost::asio::steady_timer &GetStateTimer1();
|
||||||
boost::asio::deadline_timer &GetStateTimer2();
|
boost::asio::steady_timer &GetStateTimer2();
|
||||||
|
|
||||||
const StartData &GetStartData() const;
|
const StartData &GetStartData() const;
|
||||||
void SetStartData(const StartData &startData);
|
void SetStartData(const StartData &startData);
|
||||||
@@ -190,6 +192,7 @@ protected:
|
|||||||
const SessionManager &GetSessionManager() const;
|
const SessionManager &GetSessionManager() const;
|
||||||
SessionManager &GetSessionManager();
|
SessionManager &GetSessionManager();
|
||||||
ServerDBInterface &GetDatabase();
|
ServerDBInterface &GetDatabase();
|
||||||
|
const ServerDelayTime GetServerDelayTime() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ServerGame(const ServerGame &other);
|
ServerGame(const ServerGame &other);
|
||||||
@@ -225,6 +228,8 @@ private:
|
|||||||
boost::shared_ptr<ServerDBInterface> m_database;
|
boost::shared_ptr<ServerDBInterface> m_database;
|
||||||
GuiInterface &m_gui;
|
GuiInterface &m_gui;
|
||||||
|
|
||||||
|
ServerDelayTime m_serverDelayTime;
|
||||||
|
|
||||||
const GameData m_gameData;
|
const GameData m_gameData;
|
||||||
StartData m_startData;
|
StartData m_startData;
|
||||||
boost::shared_ptr<Game> m_game;
|
boost::shared_ptr<Game> m_game;
|
||||||
@@ -237,9 +242,9 @@ private:
|
|||||||
ConfigFile &m_playerConfig;
|
ConfigFile &m_playerConfig;
|
||||||
unsigned m_gameNum;
|
unsigned m_gameNum;
|
||||||
unsigned m_curPetitionId;
|
unsigned m_curPetitionId;
|
||||||
boost::asio::deadline_timer m_voteKickTimer;
|
boost::asio::steady_timer m_voteKickTimer;
|
||||||
boost::asio::deadline_timer m_stateTimer1;
|
boost::asio::steady_timer m_stateTimer1;
|
||||||
boost::asio::deadline_timer m_stateTimer2;
|
boost::asio::steady_timer m_stateTimer2;
|
||||||
bool m_isNameReported;
|
bool m_isNameReported;
|
||||||
|
|
||||||
friend class ServerLobbyThread;
|
friend class ServerLobbyThread;
|
||||||
@@ -251,6 +256,7 @@ private:
|
|||||||
friend class ServerGameStateHand;
|
friend class ServerGameStateHand;
|
||||||
friend class ServerGameStateWaitPlayerAction;
|
friend class ServerGameStateWaitPlayerAction;
|
||||||
friend class ServerGameStateWaitNextHand;
|
friend class ServerGameStateWaitNextHand;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
#define _SERVERLOBBYBOT_H_
|
#define _SERVERLOBBYBOT_H_
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
@@ -86,7 +87,7 @@ private:
|
|||||||
boost::shared_ptr<ServerLobbyThread> m_lobbyThread;
|
boost::shared_ptr<ServerLobbyThread> m_lobbyThread;
|
||||||
boost::shared_ptr<IrcThread> m_ircLobbyThread;
|
boost::shared_ptr<IrcThread> m_ircLobbyThread;
|
||||||
|
|
||||||
boost::asio::deadline_timer m_reconnectTimer;
|
boost::asio::steady_timer m_reconnectTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
#define _SERVERLOBBYTHREAD_H_
|
#define _SERVERLOBBYTHREAD_H_
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <boost/uuid/uuid_generators.hpp>
|
#include <boost/uuid/uuid_generators.hpp>
|
||||||
|
|
||||||
@@ -268,9 +269,9 @@ private:
|
|||||||
boost::shared_ptr<ChatCleanerManager> m_chatCleanerManager;
|
boost::shared_ptr<ChatCleanerManager> m_chatCleanerManager;
|
||||||
boost::shared_ptr<ServerDBInterface> m_database;
|
boost::shared_ptr<ServerDBInterface> m_database;
|
||||||
|
|
||||||
boost::asio::deadline_timer m_removeGameTimer;
|
boost::asio::steady_timer m_removeGameTimer;
|
||||||
boost::asio::deadline_timer m_saveStatisticsTimer;
|
boost::asio::steady_timer m_saveStatisticsTimer;
|
||||||
boost::asio::deadline_timer m_loginLockTimer;
|
boost::asio::steady_timer m_loginLockTimer;
|
||||||
|
|
||||||
boost::uuids::random_generator m_sessionIdGenerator;
|
boost::uuids::random_generator m_sessionIdGenerator;
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
typedef unsigned SessionId;
|
typedef unsigned SessionId;
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -144,9 +145,9 @@ private:
|
|||||||
bool m_wantsLobbyMsg;
|
bool m_wantsLobbyMsg;
|
||||||
unsigned m_activityTimeoutSec;
|
unsigned m_activityTimeoutSec;
|
||||||
unsigned m_activityWarningRemainingSec;
|
unsigned m_activityWarningRemainingSec;
|
||||||
boost::asio::deadline_timer m_initTimeoutTimer;
|
boost::asio::steady_timer m_initTimeoutTimer;
|
||||||
boost::asio::deadline_timer m_globalTimeoutTimer;
|
boost::asio::steady_timer m_globalTimeoutTimer;
|
||||||
boost::asio::deadline_timer m_activityTimeoutTimer;
|
boost::asio::steady_timer m_activityTimeoutTimer;
|
||||||
SessionDataCallback &m_callback;
|
SessionDataCallback &m_callback;
|
||||||
Gsasl_session *m_authSession;
|
Gsasl_session *m_authSession;
|
||||||
int m_curAuthStep;
|
int m_curAuthStep;
|
||||||
|
|||||||
@@ -61,6 +61,8 @@
|
|||||||
#define ERR_SOCK_TRANSFER_INVALID_URL 26
|
#define ERR_SOCK_TRANSFER_INVALID_URL 26
|
||||||
#define ERR_SOCK_TRANSFER_SELECT_FAILED 27
|
#define ERR_SOCK_TRANSFER_SELECT_FAILED 27
|
||||||
#define ERR_SOCK_TRANSFER_FAILED 28
|
#define ERR_SOCK_TRANSFER_FAILED 28
|
||||||
|
#define ERR_SOCK_CONNECT_IPV6_FAILED 29
|
||||||
|
#define ERR_SOCK_CONNECT_IPV6_TIMEOUT 30
|
||||||
// The following errors are game errors.
|
// The following errors are game errors.
|
||||||
#define ERR_NET_VERSION_NOT_SUPPORTED 101
|
#define ERR_NET_VERSION_NOT_SUPPORTED 101
|
||||||
#define ERR_NET_SERVER_MAINTENANCE 102
|
#define ERR_NET_SERVER_MAINTENANCE 102
|
||||||
|
|||||||
@@ -75,6 +75,13 @@
|
|||||||
#define ENABLE_LEAK_CHECK()
|
#define ENABLE_LEAK_CHECK()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// #ifdef ANDROID
|
||||||
|
// #ifndef ANDROID_TEST
|
||||||
|
// // #include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||||
|
// // #include <jni.h>
|
||||||
|
// #endif
|
||||||
|
// #endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class startWindowImpl;
|
class startWindowImpl;
|
||||||
@@ -246,6 +253,29 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
startWindowImpl mainWin(myConfig,myLog);
|
startWindowImpl mainWin(myConfig,myLog);
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
// //Do not start if API is smaller than x
|
||||||
|
// int api = -2;
|
||||||
|
// #ifndef ANDROID_TEST
|
||||||
|
// JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForIntegration("JavaVM");
|
||||||
|
// JNIEnv* env;
|
||||||
|
// if (currVM->AttachCurrentThread(&env, NULL)<0) {
|
||||||
|
// qCritical()<<"AttachCurrentThread failed";
|
||||||
|
// } else {
|
||||||
|
// jclass jclassApplicationClass = env->FindClass("android/os/Build$VERSION");
|
||||||
|
// if (jclassApplicationClass) {
|
||||||
|
// api = env->GetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"SDK_INT", "I"));
|
||||||
|
// }
|
||||||
|
// currVM->DetachCurrentThread();
|
||||||
|
// }
|
||||||
|
// #endif
|
||||||
|
// Test api and maybe do not start for further android releases
|
||||||
|
// if(api < 14) {
|
||||||
|
// QMessageBox box(QMessageBox::Critical, "PokerTH Error", "Sorry, PokerTH needs Android version 4.0 or above to start", QMessageBox::Ok);
|
||||||
|
// box.show();
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// mainWin.show();
|
||||||
|
// }
|
||||||
mainWin.show();
|
mainWin.show();
|
||||||
#else
|
#else
|
||||||
a.setActivationWindow(&mainWin, true);
|
a.setActivationWindow(&mainWin, true);
|
||||||
|
|||||||
+3
-2
@@ -310,7 +310,7 @@ void Session::clientRejoinGame(unsigned gameId)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::startNetworkServer(bool dedicated)
|
void Session::startNetworkServer(bool dedicated, bool lan_local)
|
||||||
{
|
{
|
||||||
if (myNetServer) {
|
if (myNetServer) {
|
||||||
assert(false);
|
assert(false);
|
||||||
@@ -325,7 +325,8 @@ void Session::startNetworkServer(bool dedicated)
|
|||||||
mode = SERVER_MODE_INTERNET_NOAUTH;
|
mode = SERVER_MODE_INTERNET_NOAUTH;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
mode = SERVER_MODE_LAN;
|
if(lan_local) mode = SERVER_MODE_LAN_LOCAL;
|
||||||
|
else mode = SERVER_MODE_LAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
myNetServer = ServerManagerFactory::CreateServerManager(*myConfig, *myGui, mode, *myAvatarManager);
|
myNetServer = ServerManagerFactory::CreateServerManager(*myConfig, *myGui, mode, *myAvatarManager);
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ public:
|
|||||||
void clientJoinGame(unsigned gameId, const std::string &password);
|
void clientJoinGame(unsigned gameId, const std::string &password);
|
||||||
void clientRejoinGame(unsigned gameId);
|
void clientRejoinGame(unsigned gameId);
|
||||||
|
|
||||||
void startNetworkServer(bool dedicated);
|
void startNetworkServer(bool dedicated, bool lan_local = false);
|
||||||
void sendLeaveCurrentGame();
|
void sendLeaveCurrentGame();
|
||||||
void sendStartEvent(bool fillUpWithCpuPlayers);
|
void sendStartEvent(bool fillUpWithCpuPlayers);
|
||||||
void terminateNetworkServer();
|
void terminateNetworkServer();
|
||||||
|
|||||||
Reference in new issue
Block a user