Compare commits
29
Commits
v1.1.2
...
new_local_game
| 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/
|
||||
- libboost_thread, libboost_filesystem, libboost_datetime, libboost_program_options,
|
||||
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/
|
||||
- libSQLite3 --> http://sqlite.org/
|
||||
- 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_REGEX = boost_regex \
|
||||
boost_regex-mt
|
||||
BOOST_CHRONO = boost_chrono \
|
||||
boost_chrono-mt
|
||||
BOOST_SYS = boost_system \
|
||||
boost_system-mt
|
||||
BOOST_RANDOM = boost_random \
|
||||
@@ -463,6 +465,14 @@ unix:!mac {
|
||||
message("Found $$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{
|
||||
for(lib, BOOST_RANDOM):exists($${dir}/lib$${lib}.so*) {
|
||||
message("Found $$lib")
|
||||
@@ -487,9 +497,10 @@ unix:!mac {
|
||||
$$BOOST_FS \
|
||||
$$BOOST_IOSTREAMS \
|
||||
$$BOOST_REGEX \
|
||||
$$BOOST_CHRONO \
|
||||
$$BOOST_RANDOM \
|
||||
$$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!")
|
||||
UNAME = $$system(uname -s)
|
||||
BSD = $$find(UNAME, "BSD")
|
||||
@@ -509,6 +520,7 @@ unix:!mac {
|
||||
$$BOOST_FS \
|
||||
$$BOOST_IOSTREAMS \
|
||||
$$BOOST_REGEX \
|
||||
$$BOOST_CHRONO \
|
||||
$$BOOST_SYS
|
||||
!count(BOOST_LIBS, 5):error("Unable to find boost libraries in PREFIX=$${PREFIX}/armv5")
|
||||
LIBS += -ltinyxml
|
||||
@@ -575,6 +587,7 @@ mac {
|
||||
LIBS += /usr/local/lib/libboost_thread.a
|
||||
LIBS += /usr/local/lib/libboost_filesystem.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_system.a
|
||||
LIBS += /usr/local/lib/libboost_iostreams.a
|
||||
|
||||
@@ -192,6 +192,7 @@ SOURCES += \
|
||||
src/net/common/servergame.cpp \
|
||||
src/net/common/servergamestate.cpp \
|
||||
src/net/common/serverlobbythread.cpp \
|
||||
src/net/common/serverdelaytime.cpp \
|
||||
src/net/common/serverbanmanager.cpp \
|
||||
src/net/common/servercallback.cpp \
|
||||
src/net/common/serveradminbot.cpp \
|
||||
|
||||
+13
-2
@@ -70,6 +70,7 @@ HEADERS += \
|
||||
src/net/senderhelper.h \
|
||||
src/net/serveraccepthelper.h \
|
||||
src/net/serverlobbythread.h \
|
||||
src/net/serverdelaytime.h \
|
||||
src/net/socket_helper.h \
|
||||
src/net/socket_msg.h \
|
||||
src/net/socket_startup.h \
|
||||
@@ -180,6 +181,7 @@ unix : !mac {
|
||||
BOOST_THREAD = boost_thread boost_thread-mt
|
||||
BOOST_PROGRAM_OPTIONS = boost_program_options boost_program_options-mt
|
||||
BOOST_IOSTREAMS = boost_iostreams boost_iostreams-mt
|
||||
BOOST_CHRONO = boost_chrono boost_chrono-mt
|
||||
BOOST_SYS = boost_system boost_system-mt
|
||||
BOOST_REGEX = boost_regex boost_regex-mt
|
||||
BOOST_RANDOM = boost_random boost_random-mt
|
||||
@@ -231,6 +233,14 @@ unix : !mac {
|
||||
message("Found $$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*) {
|
||||
message("Found $$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
|
||||
!count(BOOST_LIBS, 7){
|
||||
BOOST_LIBS = $$BOOST_THREAD $$BOOST_FS $$BOOST_PROGRAM_OPTIONS $$BOOST_IOSTREAMS $$BOOST_REGEX $$BOOST_CHRONO $$BOOST_RANDOM $$BOOST_SYS
|
||||
!count(BOOST_LIBS, 8){
|
||||
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_filesystem.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_system.a
|
||||
LIBS += /usr/local/lib/libboost_iostreams.a
|
||||
|
||||
+7
-5
@@ -56,10 +56,10 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
|
||||
dealerPosition = startData.startDealerPlayerId;
|
||||
|
||||
if(DEBUG_MODE) {
|
||||
startSmallBlind = 10;
|
||||
currentSmallBlind = startSmallBlind;
|
||||
dealerPosition = 4;
|
||||
// debug mode
|
||||
if(myLog) {
|
||||
myLog->debugMode_getStartSmallBlind(&startSmallBlind,¤tSmallBlind);
|
||||
myLog->debugMode_getStartDealerPosition(&dealerPosition);
|
||||
}
|
||||
|
||||
int i;
|
||||
@@ -109,6 +109,9 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
++player_i;
|
||||
}
|
||||
|
||||
// debug mode
|
||||
if(myLog) myLog->debugMode_getPlayerStartCash(&myStartCash, i);
|
||||
|
||||
// create player objects
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(i, uniqueId, type, myName, myAvatarFile, myStartCash, startQuantityPlayers > i, myStayOnTableStatus, 0);
|
||||
tmpPlayer->setIsSessionActive(true);
|
||||
@@ -212,7 +215,6 @@ void Game::startHand()
|
||||
|
||||
// log new hand
|
||||
myGui->logNewGameHandMsg(myGameID, currentHandID);
|
||||
myGui->flushLogAtGame(myGameID);
|
||||
|
||||
currentHand->start();
|
||||
}
|
||||
|
||||
@@ -1054,17 +1054,9 @@ vector< vector<int> > ArrayData::getHandChancePreflop(int handCode)
|
||||
|
||||
int check = -1;
|
||||
|
||||
int i;
|
||||
|
||||
vector< vector<int> > chance(2);
|
||||
|
||||
chance[0].resize(10);
|
||||
chance[1].resize(10);
|
||||
|
||||
for(i=0; i<10; i++) {
|
||||
chance[0][i] = 0;
|
||||
chance[1][i] = 0;
|
||||
}
|
||||
chance[0].assign(10,0);
|
||||
chance[1].assign(10,0);
|
||||
|
||||
for (unsigned val = 0; val < NUM_HAND_CHANCE_PREFLOP; val++) {
|
||||
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
|
||||
if(cards[0]%13 == cards[1]%13) {
|
||||
return ((cards[0]%13)*1000 + (cards[0]%13)*10);
|
||||
if(holeCards[0]%13 == holeCards[1]%13) {
|
||||
return ((holeCards[0]%13)*1000 + (holeCards[0]%13)*10);
|
||||
} else {
|
||||
if(cards[0]%13 < cards[1]%13) {
|
||||
if(cards[0]/13 == cards[1]/13) {
|
||||
return ((cards[0]%13)*1000 + (cards[1]%13)*10 + 1);
|
||||
if(holeCards[0]%13 < holeCards[1]%13) {
|
||||
if(holeCards[0]/13 == holeCards[1]/13) {
|
||||
return ((holeCards[0]%13)*1000 + (holeCards[1]%13)*10 + 1);
|
||||
} else {
|
||||
return ((cards[0]%13)*1000 + (cards[1]%13)*10);
|
||||
return ((holeCards[0]%13)*1000 + (holeCards[1]%13)*10);
|
||||
}
|
||||
} else {
|
||||
if(cards[0]/13 == cards[1]/13) {
|
||||
return ((cards[1]%13)*1000 + (cards[0]%13)*10 + 1);
|
||||
if(holeCards[0]/13 == holeCards[1]/13) {
|
||||
return ((holeCards[1]%13)*1000 + (holeCards[0]%13)*10 + 1);
|
||||
} 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
|
||||
int* CardsValue::intCodeToHoleCards(int code)
|
||||
static const int straight[10] = { 7936, 3968, 1984, 992, 496, 248, 124, 62, 31, 4111 };
|
||||
|
||||
int CardsValue::cardsValueShort(int cards[4])
|
||||
{
|
||||
|
||||
// one possibility !!!
|
||||
int color_idx;
|
||||
int card_idx;
|
||||
|
||||
int* cards = new int[2];
|
||||
|
||||
cards[0] = code/1000;
|
||||
cards[1] = (code-cards[0]*1000)/10;
|
||||
|
||||
if(cards[0]==cards[1]) {
|
||||
cards[1] +=13;
|
||||
} else {
|
||||
if(code%10 == 0) cards[1] +=13;
|
||||
// Royal Flush, Straight Flush, Flush
|
||||
for(color_idx=0; color_idx<4; color_idx++) { // check all colors
|
||||
if(bitcount(cards[color_idx])>=5) { // check if at least 5 cards of one color
|
||||
if((cards[color_idx] & straight[0]) == straight[0]) // check for Royal Flush
|
||||
return 9;
|
||||
else { // check for Straight Flush
|
||||
for(card_idx=1; card_idx<10; card_idx++) {
|
||||
if((cards[color_idx] & straight[card_idx]) == straight[card_idx]) {
|
||||
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];
|
||||
}
|
||||
return 5; // Flush
|
||||
}
|
||||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
int AND = cards[0] & cards[1] & cards[2] & cards[3];
|
||||
|
||||
// Four of a Kind
|
||||
if(AND) {
|
||||
return 7;
|
||||
}
|
||||
|
||||
// Karten auf Bl�ter testen. Klasseneinteilung absteigend: 9 - Royal Flush, 8 - Straight Flush, ... 2 - Zwei Paare, 1 - Ein Paar, 0 - Nischt
|
||||
int OR = cards[0] | cards[1] | cards[2] | cards[3];
|
||||
|
||||
// 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];
|
||||
for(card_idx=0; card_idx<10; card_idx++) {
|
||||
if((OR & straight[card_idx]) == straight[card_idx]) {
|
||||
return 4;
|
||||
}
|
||||
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];
|
||||
|
||||
int color_1_idx, color_2_idx, color_3_idx, color_4_idx, color_5_idx;
|
||||
int temp;
|
||||
|
||||
// Full House, Three of a Kind
|
||||
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++) {
|
||||
temp = cards[color_1_idx] & cards[color_2_idx] & cards[color_3_idx];
|
||||
if(bitcount(temp) == 2) { // two times Three of a Kind
|
||||
return 6; // Full House
|
||||
} else {
|
||||
drei = array[j4][1];
|
||||
zwei = array[j1][1];
|
||||
if(temp) {
|
||||
for(color_4_idx=0; color_4_idx<3; color_4_idx++) {
|
||||
for(color_5_idx=color_4_idx+1; color_5_idx<4; color_5_idx++) {
|
||||
if(~temp & cards[color_4_idx] & cards[color_5_idx]) { // search for additional pair
|
||||
return 6; // Full House
|
||||
}
|
||||
return 600000000+drei*1000000+zwei*10000;
|
||||
}
|
||||
}
|
||||
return 3; // Three of a Kind
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Straight-Spezialfall ( 5 4 3 2 A ) 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++) {
|
||||
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) {
|
||||
// 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[j2][1]*1000000;
|
||||
// Two Pairs, Two of a Kind
|
||||
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++) {
|
||||
temp = cards[color_1_idx] & cards[color_2_idx];
|
||||
if(bitcount(temp) >= 2) { // at least two times Two of a Kind
|
||||
return 2; // Two Pairs
|
||||
} else {
|
||||
if(temp) { // search for second pair
|
||||
for(color_3_idx=0; color_3_idx<3; color_3_idx++) {
|
||||
for(color_4_idx=color_3_idx+1; color_4_idx<4; color_4_idx++) {
|
||||
if(~temp & cards[color_3_idx] & cards[color_4_idx]) {
|
||||
return 2; // Two Pairs
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1; // Two of a Kind
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Drilling (Klasse 3) testen
|
||||
for(j1=0; j1<5; j1++) {
|
||||
if(array[j1][1] == array[j1+1][1] && array[j1][1] == array[j1+2][1]) {
|
||||
// Kicker ermitteln
|
||||
if(j1==0) {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<5; j2++) {
|
||||
position[j2] = array[j2][2];
|
||||
}
|
||||
}
|
||||
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 {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<3; j2++) {
|
||||
position[j2] = array[j1+j2][2];
|
||||
}
|
||||
position[3] = array[0][2];
|
||||
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
|
||||
for(j1=0; j1<4; j1++) {
|
||||
for(j2=j1+2; j2<6; j2++) {
|
||||
if(array[j1][1] == array[j1+1][1] && array[j2][1] == array[j2+1][1]) {
|
||||
// Kicker ermitteln
|
||||
if(j1==0) {
|
||||
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 {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<2; j2++) {
|
||||
position[j2] = array[j1+j2][2];
|
||||
}
|
||||
position[2] = array[0][2];
|
||||
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
|
||||
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];
|
||||
return 0; // High Card
|
||||
}
|
||||
|
||||
|
||||
std::vector< std::vector<int> > CardsValue::calcCardsChance(GameState beRoID, int* playerCards, int* boardCards)
|
||||
int CardsValue::cardsValue(int cards[4], int bestHand[4])
|
||||
{
|
||||
int i,j;
|
||||
int color_1_idx;
|
||||
int card_idx;
|
||||
KickerValue kickerValue1;
|
||||
|
||||
std::vector< std::vector<int> > chance(2);
|
||||
|
||||
chance[0].resize(10);
|
||||
chance[1].resize(10);
|
||||
|
||||
for(i=0; i<10; i++) {
|
||||
chance[0][i] = 0;
|
||||
chance[1][i] = 0;
|
||||
// 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 cards[7];
|
||||
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);
|
||||
chance[0].assign(10,0);
|
||||
chance[1].assign(10,0);
|
||||
|
||||
int cards[4] = { 0,0,0,0 };
|
||||
int sum = 0;
|
||||
|
||||
cards[0] = playerCards[0];
|
||||
cards[1] = playerCards[1];
|
||||
for(i=0; i<5; i++) cards[i+2] = boardCards[i];
|
||||
int card_idx_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));
|
||||
|
||||
switch(beRoID) {
|
||||
case GAME_STATE_PREFLOP: {
|
||||
@@ -675,50 +538,60 @@ std::vector< std::vector<int> > CardsValue::calcCardsChance(GameState beRoID, in
|
||||
break;
|
||||
case GAME_STATE_FLOP: {
|
||||
|
||||
for(i=0; i<51; i++) {
|
||||
if(i!=cards[0] && i!=cards[1] && i!=cards[2] && i!=cards[3] && i!=cards[4]) {
|
||||
for(j=i+1; j<52; j++) {
|
||||
if(j!=cards[0] && j!=cards[1] && j!=cards[2] && j!=cards[3] && j!=cards[4]) {
|
||||
cards[5] = i;
|
||||
cards[6] = j;
|
||||
(chance[0][cardsValue(cards,0)/100000000])++;
|
||||
for(card_idx_1=0; card_idx_1<3; card_idx_1++) cards[boardCards[card_idx_1]/13] |= (1 << (boardCards[card_idx_1]%13));
|
||||
|
||||
for(card_idx_1=0; card_idx_1<51; card_idx_1++) {
|
||||
if((cards[card_idx_1/13] & (1 << (card_idx_1%13))) == 0) {
|
||||
cards[card_idx_1/13] |= (1 << (card_idx_1%13));
|
||||
for(int card_idx_2=card_idx_1+1; card_idx_2<52; card_idx_2++) {
|
||||
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++;
|
||||
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;
|
||||
case GAME_STATE_TURN: {
|
||||
|
||||
for(i=0; i<52; i++) {
|
||||
if(i!=cards[0] && i!=cards[1] && i!=cards[2] && i!=cards[3] && i!=cards[4] && i!=cards[5]) {
|
||||
cards[6] = i;
|
||||
(chance[0][cardsValue(cards,0)/100000000])++;
|
||||
for(card_idx_1=0; card_idx_1<4; card_idx_1++) cards[boardCards[card_idx_1]/13] |= (1 << (boardCards[card_idx_1]%13));
|
||||
|
||||
for(card_idx_1=0; card_idx_1<52; card_idx_1++) {
|
||||
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++;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
//
|
||||
|
||||
@@ -38,18 +38,28 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
struct KickerValue {
|
||||
int factorValue;
|
||||
int select;
|
||||
int remain;
|
||||
};
|
||||
|
||||
class CardsValue
|
||||
{
|
||||
public:
|
||||
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::list<std::string> translateCardsValueCode(int cardsValueCode);
|
||||
|
||||
static int holeCardsToIntCode(int*);
|
||||
static int* intCodeToHoleCards(int);
|
||||
static int holeCardsToIntCode(int[2]);
|
||||
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
@@ -147,26 +147,26 @@ void LocalBeRo::run()
|
||||
//log the turned cards
|
||||
if(!logBoardCardsDone) {
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
int boardCards[5];
|
||||
|
||||
myHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
myHand->getBoard()->getMyCards(boardCards);
|
||||
|
||||
switch(myBeRoID) {
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
default: {
|
||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR - wrong myBeRoID");
|
||||
}
|
||||
}
|
||||
if(myHand->getLog()) myHand->getLog()->logBoardCards(tempBoardCardsArray);
|
||||
if(myHand->getLog()) myHand->getLog()->logBoardCards(boardCards);
|
||||
logBoardCardsDone = true;
|
||||
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ void LocalBoard::distributePot(unsigned dealerPosition)
|
||||
// determine the number of level winners
|
||||
winnerCount = potLevel.size()-2;
|
||||
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
|
||||
@@ -161,7 +161,7 @@ void LocalBoard::distributePot(unsigned dealerPosition)
|
||||
if(finalPot) break;
|
||||
}
|
||||
|
||||
if(finalPot) {
|
||||
if(finalPot && winnerCount>0) {
|
||||
// distribute the pot level sum to level winners
|
||||
mod = (potLevel[1])%winnerCount;
|
||||
// pot level sum divisible by winnerCount
|
||||
@@ -175,14 +175,14 @@ void LocalBoard::distributePot(unsigned dealerPosition)
|
||||
}
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// pot level sum not divisible by winnerCount
|
||||
@@ -196,7 +196,8 @@ void LocalBoard::distributePot(unsigned dealerPosition)
|
||||
}
|
||||
}
|
||||
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++) {
|
||||
@@ -216,6 +217,7 @@ void LocalBoard::distributePot(unsigned dealerPosition)
|
||||
|
||||
}
|
||||
|
||||
if(winnerHit) {
|
||||
if(j<mod) {
|
||||
(*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount) + 1);
|
||||
// filling winners vector
|
||||
@@ -229,6 +231,7 @@ void LocalBoard::distributePot(unsigned dealerPosition)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
potCarryOver = 0;
|
||||
|
||||
// pot refresh
|
||||
|
||||
@@ -53,12 +53,12 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
||||
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
||||
(*it)->setHand(this);
|
||||
// set myFlipCards 0
|
||||
(*it)->setMyCardsFlip(0, 0);
|
||||
(*it)->setMyHoleCardsFlip(0, 0);
|
||||
}
|
||||
|
||||
// generate cards and assign to board and player
|
||||
const int NumCards = 52;
|
||||
int cardsArray[NumCards] = {
|
||||
int cards[NumCards] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
@@ -66,39 +66,49 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
||||
50, 51
|
||||
};
|
||||
Tools::ShuffleArrayNonDeterministic(cardsArray, NumCards);
|
||||
int tempBoardArray[5];
|
||||
int tempPlayerArray[2];
|
||||
int tempPlayerAndBoardArray[7];
|
||||
int bestHandPos[5];
|
||||
Tools::ShuffleArrayNonDeterministic(cards, NumCards);
|
||||
int boardCards[5];
|
||||
int playerHoleCards[2];
|
||||
int playerCards[7];
|
||||
int sBluff;
|
||||
for(i=0; i<5; i++) {
|
||||
tempBoardArray[i] = cardsArray[i];
|
||||
tempPlayerAndBoardArray[i+2] = cardsArray[i];
|
||||
}
|
||||
|
||||
// board cards
|
||||
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;
|
||||
myBoard->setMyCards(tempBoardArray);
|
||||
myBoard->setMyCards(boardCards);
|
||||
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++) {
|
||||
tempPlayerArray[j] = cardsArray[2*k+j+5];
|
||||
tempPlayerAndBoardArray[j] = cardsArray[2*k+j+5];
|
||||
}
|
||||
// complete whole player hand
|
||||
for(j=0; j<2; j++) playerCards[j] = playerHoleCards[j];
|
||||
|
||||
(*it)->setMyCards(tempPlayerArray);
|
||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray, bestHandPos));
|
||||
// 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);
|
||||
(*it)->setMyRoundStartCash((*it)->getMyCash());
|
||||
|
||||
// error-check
|
||||
for(j=0; j<5; j++) {
|
||||
if (bestHandPos[j] == -1) {
|
||||
} else {
|
||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR getMyBestHandPosition");
|
||||
}
|
||||
}
|
||||
|
||||
// set round start cash
|
||||
(*it)->setMyRoundStartCash((*it)->getMyCash());
|
||||
|
||||
// set sBluff for all players --> TODO for ai-player in internet
|
||||
if((*it)->getMyID() != 0) {
|
||||
@@ -108,274 +118,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
||||
}
|
||||
}
|
||||
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!! DEBUGGER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
|
||||
|
||||
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
|
||||
|
||||
// determine dealer, small blind, big blind
|
||||
assignButtons();
|
||||
|
||||
setBlinds();
|
||||
|
||||
if(myLog) myLog->logNewHandMsg(myID, dealerPosition+1, smallBlind, smallBlindPosition+1, 2*smallBlind, bigBlindPosition+1, seatsList);
|
||||
@@ -401,7 +145,6 @@ void LocalHand::start()
|
||||
} else {
|
||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): Log Error: cannot find sBID or bBID");
|
||||
}
|
||||
myGui->flushLogAtHand();
|
||||
|
||||
// deal cards
|
||||
myGui->dealHoleCards();
|
||||
@@ -416,20 +159,19 @@ void LocalHand::start()
|
||||
void LocalHand::assignButtons()
|
||||
{
|
||||
|
||||
size_t i;
|
||||
PlayerListIterator it;
|
||||
PlayerListIterator seatIt;
|
||||
|
||||
// delete all buttons
|
||||
for (it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
||||
(*it)->setMyButton(BUTTON_NONE);
|
||||
for (seatIt=seatsList->begin(); seatIt!=seatsList->end(); ++seatIt) {
|
||||
(*seatIt)->setMyButton(BUTTON_NONE);
|
||||
}
|
||||
|
||||
// assign dealer button
|
||||
it = getSeatIt(dealerPosition);
|
||||
if(it == seatsList->end()) {
|
||||
seatIt = getSeatIt(dealerPosition);
|
||||
if(seatIt == seatsList->end()) {
|
||||
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
|
||||
@@ -440,40 +182,40 @@ void LocalHand::assignButtons()
|
||||
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;
|
||||
if(dealerPositionIt == seatsList->end()) dealerPositionIt = seatsList->begin();
|
||||
|
||||
it = getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() );
|
||||
if(it != activePlayerList->end() ) {
|
||||
PlayerListIterator activePlayerIt = getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() );
|
||||
if(activePlayerIt != activePlayerList->end() ) {
|
||||
nextActivePlayerFound = true;
|
||||
if(activePlayerList->size() > 2) {
|
||||
//small blind normal
|
||||
(*it)->setMyButton(2);
|
||||
smallBlindPosition = (*it)->getMyUniqueID();
|
||||
(*activePlayerIt)->setMyButton(2);
|
||||
smallBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||
} else {
|
||||
//big blind in heads up
|
||||
(*it)->setMyButton(3);
|
||||
bigBlindPosition = (*it)->getMyUniqueID();
|
||||
(*activePlayerIt)->setMyButton(3);
|
||||
bigBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||
// lastPlayerAction for showing cards
|
||||
}
|
||||
|
||||
// first player after dealer have to show his cards first (in showdown)
|
||||
lastActionPlayerID = (*it)->getMyUniqueID();
|
||||
lastActionPlayerID = (*activePlayerIt)->getMyUniqueID();
|
||||
myBoard->setLastActionPlayerID(lastActionPlayerID);
|
||||
|
||||
++it;
|
||||
if(it == activePlayerList->end()) it = activePlayerList->begin();
|
||||
++activePlayerIt;
|
||||
if(activePlayerIt == activePlayerList->end()) activePlayerIt = activePlayerList->begin();
|
||||
|
||||
if(activePlayerList->size() > 2) {
|
||||
//big blind normal
|
||||
(*it)->setMyButton(3);
|
||||
bigBlindPosition = (*it)->getMyUniqueID();
|
||||
(*activePlayerIt)->setMyButton(3);
|
||||
bigBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||
} else {
|
||||
//small blind in heads up
|
||||
(*it)->setMyButton(2);
|
||||
smallBlindPosition = (*it)->getMyUniqueID();
|
||||
(*activePlayerIt)->setMyButton(2);
|
||||
smallBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -653,11 +395,11 @@ void LocalHand::switchRounds()
|
||||
|
||||
//log board cards for allin
|
||||
if(currentRound >= GAME_STATE_FLOP) {
|
||||
int tempBoardCardsArray[5];
|
||||
int boardCards[5];
|
||||
|
||||
myBoard->getMyCards(tempBoardCardsArray);
|
||||
myGui->logDealBoardCardsMsg(currentRound, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
|
||||
if(myLog) myLog->logBoardCards(tempBoardCardsArray);
|
||||
myBoard->getMyCards(boardCards);
|
||||
myGui->logDealBoardCardsMsg(currentRound, boardCards[0], boardCards[1], boardCards[2], boardCards[3], boardCards[4]);
|
||||
if(myLog) myLog->logBoardCards(boardCards);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+737
-1938
File diff suppressed because it is too large.
Load diff
@@ -48,8 +48,9 @@ public:
|
||||
|
||||
~LocalPlayer();
|
||||
|
||||
void setHand(HandInterface *);
|
||||
|
||||
void setHand(HandInterface *theValue) {
|
||||
currentHand = theValue;
|
||||
}
|
||||
int getMyID() const {
|
||||
return myID;
|
||||
}
|
||||
@@ -156,13 +157,13 @@ public:
|
||||
return myStayOnTableStatus;
|
||||
}
|
||||
|
||||
void setMyCards(int* theValue) {
|
||||
void setMyHoleCards(int* theValue) {
|
||||
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;
|
||||
for(i=0; i<2; i++) theValue[i] = myCards[i];
|
||||
for(i=0; i<2; i++) theValue[i] = myHoleCards[i];
|
||||
}
|
||||
|
||||
void setMyTurn(bool theValue) {
|
||||
@@ -172,27 +173,27 @@ public:
|
||||
return myTurn;
|
||||
}
|
||||
|
||||
void setMyCardsFlip(bool theValue, int state) {
|
||||
myCardsFlip = theValue;
|
||||
void setMyHoleCardsFlip(bool theValue, int state) {
|
||||
myHoleCardsFlip = theValue;
|
||||
// log flipping cards
|
||||
if(myCardsFlip) {
|
||||
if(myHoleCardsFlip) {
|
||||
switch(state) {
|
||||
case 1:
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt);
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt);
|
||||
break;
|
||||
case 2:
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1]);
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1]);
|
||||
break;
|
||||
case 3:
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt, "has");
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt, "has");
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool getMyCardsFlip() const {
|
||||
return myCardsFlip;
|
||||
bool getMyHoleCardsFlip() const {
|
||||
return myHoleCardsFlip;
|
||||
}
|
||||
|
||||
void setMyCardsValueInt(int theValue) {
|
||||
@@ -281,10 +282,10 @@ public:
|
||||
void turnEngine();
|
||||
void riverEngine();
|
||||
|
||||
void preflopEngine3();
|
||||
void flopEngine3();
|
||||
void turnEngine3();
|
||||
void riverEngine3();
|
||||
// void preflopEngine3();
|
||||
// void flopEngine3();
|
||||
// void turnEngine3();
|
||||
// void riverEngine3();
|
||||
|
||||
int flopCardsValue(int*);
|
||||
int turnCardsValue(int*);
|
||||
@@ -328,7 +329,7 @@ private:
|
||||
int myNiveau[3];
|
||||
bool logHoleCardsDone;
|
||||
|
||||
int myCards[2];
|
||||
int myHoleCards[2];
|
||||
int myCash;
|
||||
int mySet;
|
||||
int myLastRelativeSet;
|
||||
@@ -337,7 +338,7 @@ private:
|
||||
bool myActiveStatus; // 0 = inactive, 1 = active
|
||||
bool myStayOnTableStatus; // 0 = left, 1 = stay
|
||||
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 lastMoneyWon;
|
||||
|
||||
|
||||
@@ -82,4 +82,3 @@ void Tools::GetRand(int minValue, int maxValue, unsigned count, int *out)
|
||||
*startPtr++ = gen();
|
||||
}
|
||||
}
|
||||
|
||||
+144
-26
@@ -39,25 +39,93 @@
|
||||
#include <dirent.h>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
Log::Log(ConfigFile *c) : mySqliteLogDb(0), mySqliteLogFileName(""), myConfig(c), uniqueGameID(0), currentHandID(0), currentRound(GAME_STATE_PREFLOP), sql("")
|
||||
unsigned debug_mode_startSmallBlind = 10;
|
||||
unsigned debug_mode_dealerPosition = 4;
|
||||
unsigned debug_mode_startCash[MAX_NUMBER_OF_PLAYERS] = { 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000};
|
||||
unsigned debug_mode_boardCards[][5] = {
|
||||
{ 4, 19, 20, 43, 49 },
|
||||
{ 4, 19, 20, 43, 49 }
|
||||
};
|
||||
int debug_mode_playerCards[][MAX_NUMBER_OF_PLAYERS][2] = {
|
||||
{ {18,17}, {-1,-1}, {26,27}, {31,30}, {50,51}, {25,24}, {38,37}, {32,33}, {19,20}, {18,17} },
|
||||
{ {18,17}, {31, 8}, {26,27}, {31,30}, {50,51}, {25,24}, {38,37}, {32,33}, {19,20}, {18,17} }
|
||||
};
|
||||
const unsigned debug_mode_cntBeRo = 4;
|
||||
const unsigned debug_mode_cntActions = 4;
|
||||
const unsigned debug_mode_cntValues = 3;
|
||||
int playerActionMatrix[][debug_mode_cntBeRo][MAX_NUMBER_OF_PLAYERS][debug_mode_cntActions][debug_mode_cntValues] = {
|
||||
{ /* handID==0 */
|
||||
{ /* preflop */
|
||||
{ {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player0 */
|
||||
{ {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player1 */
|
||||
{ {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player2 */
|
||||
{ {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player3 */
|
||||
{ {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player4 */
|
||||
{ {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player5 */
|
||||
{ {-1,PLAYER_ACTION_RAISE,100},{50,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player6 */
|
||||
{ {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player7 */
|
||||
{ {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player8 */
|
||||
{ {-1,PLAYER_ACTION_CALL ,-1},{10,PLAYER_ACTION_RAISE ,100},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} } /* player9 */
|
||||
},
|
||||
{ /* flop */
|
||||
{ {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }
|
||||
},
|
||||
{ /* turn */
|
||||
{ {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }
|
||||
},
|
||||
{ /* river */
|
||||
{ {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} },
|
||||
{ {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Log::Log(ConfigFile *c) : mySqliteLogDb(0), mySqliteLogFileName(""), myConfig(c), uniqueGameID(0), currentHandID(0), currentRound(GAME_STATE_PREFLOP), sql(""), debug_mode(false)
|
||||
{
|
||||
// check for debug_mode
|
||||
ifstream debug_mode_test_file("enable_debug_mode");
|
||||
if(debug_mode_test_file) debug_mode = true;
|
||||
}
|
||||
|
||||
Log::~Log()
|
||||
{
|
||||
if(SQLITE_LOG) {
|
||||
sqlite3_close(mySqliteLogDb);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Log::init()
|
||||
{
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
// logging activated
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
|
||||
@@ -160,7 +228,6 @@ Log::init()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -168,8 +235,6 @@ Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned deal
|
||||
{
|
||||
uniqueGameID++;
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
@@ -212,7 +277,6 @@ Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned deal
|
||||
exec_transaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -226,8 +290,6 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
|
||||
(*it_c)->setLogHoleCardsDone(false);
|
||||
}
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
@@ -303,15 +365,12 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Log::logPlayerAction(string playerName, PlayerActionLog action, int amount)
|
||||
{
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
@@ -340,15 +399,12 @@ Log::logPlayerAction(string playerName, PlayerActionLog action, int amount)
|
||||
sqlite3_free_table(result_Player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Log::logPlayerAction(int seat, PlayerActionLog action, int amount)
|
||||
{
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
@@ -451,7 +507,6 @@ Log::logPlayerAction(int seat, PlayerActionLog action, int amount)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlayerActionLog
|
||||
@@ -482,7 +537,6 @@ Log::transformPlayerActionLog(PlayerAction action)
|
||||
void
|
||||
Log::logBoardCards(int boardCards[5])
|
||||
{
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
@@ -520,7 +574,6 @@ Log::logBoardCards(int boardCards[5])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -542,15 +595,13 @@ void
|
||||
Log::logHoleCardsHandName(PlayerList activePlayerList, boost::shared_ptr<PlayerInterface> player, bool forceExecLog)
|
||||
{
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
if( mySqliteLogDb != 0) {
|
||||
|
||||
int myCards[2];
|
||||
player->getMyCards(myCards);
|
||||
player->getMyHoleCards(myCards);
|
||||
sql += "UPDATE Hand SET ";
|
||||
if(currentRound==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0) {
|
||||
sql += "Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName(player->getMyCardsValueInt(),activePlayerList) + "\"";
|
||||
@@ -581,7 +632,6 @@ Log::logHoleCardsHandName(PlayerList activePlayerList, boost::shared_ptr<PlayerI
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -682,9 +732,77 @@ Log::exec_transaction()
|
||||
//void
|
||||
//Log::closeLogDbAtExit()
|
||||
//{
|
||||
// if(SQLITE_LOG) {
|
||||
// // close sqlite-db
|
||||
// sqlite3_close(mySqliteLogDb);
|
||||
// mySqliteLogDb = NULL;
|
||||
// }
|
||||
//}
|
||||
|
||||
void
|
||||
Log::debugMode_getStartSmallBlind(int* startSmallBlind, int* currentSmallBlind)
|
||||
{
|
||||
if(debug_mode) {
|
||||
*startSmallBlind = debug_mode_startSmallBlind;
|
||||
*currentSmallBlind = *startSmallBlind;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Log::debugMode_getStartDealerPosition(unsigned* dealerPosition)
|
||||
{
|
||||
if(debug_mode) {
|
||||
*dealerPosition = debug_mode_dealerPosition;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Log::debugMode_getBoardCards(int *boardCards, int handID)
|
||||
{
|
||||
if(debug_mode) {
|
||||
if((unsigned)handID <= sizeof(debug_mode_boardCards)/sizeof(unsigned)/5) {
|
||||
for(int i=0; i<5; i++) boardCards[i] = debug_mode_boardCards[handID-1][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Log::debugMode_getPlayerCards(int *playerCards, int handID, int seatID)
|
||||
{
|
||||
if(debug_mode) {
|
||||
if((unsigned)handID <= sizeof(debug_mode_playerCards)/sizeof(int)/MAX_NUMBER_OF_PLAYERS/2) {
|
||||
for(int i=0; i<2; i++) {
|
||||
if(debug_mode_playerCards[handID-1][seatID][i]>=0) playerCards[i] = debug_mode_playerCards[handID-1][seatID][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Log::debugMode_getPlayerStartCash(int* startCash, int seatID)
|
||||
{
|
||||
if(debug_mode) {
|
||||
*startCash = debug_mode_startCash[seatID];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Log::debugMode_getPlayerAction(PlayerAction *playerAction, int *bet, int *raise, GameState gameState, int handID, int seatID, int mySet)
|
||||
{
|
||||
if(debug_mode) {
|
||||
if((unsigned)handID <= sizeof(playerActionMatrix)/sizeof(int)/debug_mode_cntBeRo/MAX_NUMBER_OF_PLAYERS/debug_mode_cntActions/debug_mode_cntValues) {
|
||||
int max_thd = 0;
|
||||
unsigned next_action_idx = 0;
|
||||
for(unsigned action_idx=0; action_idx<debug_mode_cntActions; action_idx++) {
|
||||
if(mySet > playerActionMatrix[handID-1][gameState][seatID][action_idx][0] && playerActionMatrix[handID-1][gameState][seatID][action_idx][0] > max_thd) {
|
||||
max_thd = playerActionMatrix[handID-1][gameState][seatID][action_idx][0];
|
||||
next_action_idx = action_idx;
|
||||
}
|
||||
*playerAction = (PlayerAction)playerActionMatrix[handID-1][gameState][seatID][next_action_idx][1];
|
||||
if(*playerAction == PLAYER_ACTION_BET) {
|
||||
*bet = playerActionMatrix[handID-1][gameState][seatID][next_action_idx][2];
|
||||
} else if(*playerAction == PLAYER_ACTION_RAISE || *playerAction == PLAYER_ACTION_ALLIN) {
|
||||
*raise = playerActionMatrix[handID-1][gameState][seatID][next_action_idx][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,16 @@ public:
|
||||
void logAfterGame();
|
||||
// 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) {
|
||||
currentRound = theValue;
|
||||
}
|
||||
@@ -85,6 +95,8 @@ private:
|
||||
int currentHandID;
|
||||
GameState currentRound;
|
||||
std::string sql;
|
||||
|
||||
bool debug_mode;
|
||||
};
|
||||
|
||||
#endif // LOG_H
|
||||
@@ -44,7 +44,7 @@ ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boos
|
||||
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
||||
(*it)->setHand(this);
|
||||
// myFlipCards auf 0 setzen
|
||||
(*it)->setMyCardsFlip(0, 0);
|
||||
(*it)->setMyHoleCardsFlip(0, 0);
|
||||
}
|
||||
|
||||
// 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)
|
||||
: 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),
|
||||
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)
|
||||
{
|
||||
myBestHandPosition[0] = myBestHandPosition[1] = myBestHandPosition[2] = myBestHandPosition[3] = myBestHandPosition[4] = 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;
|
||||
myAggressive[0] = myAggressive[1] = myAggressive[2] = myAggressive[3] = myAggressive[4] = myAggressive[5] = myAggressive[6] = false;
|
||||
}
|
||||
@@ -264,19 +264,19 @@ ClientPlayer::getMyStayOnTableStatus() const
|
||||
}
|
||||
|
||||
void
|
||||
ClientPlayer::setMyCards(int* theValue)
|
||||
ClientPlayer::setMyHoleCards(int* theValue)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||
for (int i = 0; i < 2; i++)
|
||||
myCards[i] = theValue[i];
|
||||
myHoleCards[i] = theValue[i];
|
||||
}
|
||||
|
||||
void
|
||||
ClientPlayer::getMyCards(int* theValue) const
|
||||
ClientPlayer::getMyHoleCards(int* theValue) const
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||
for (int i = 0; i < 2; i++)
|
||||
theValue[i] = myCards[i];
|
||||
theValue[i] = myHoleCards[i];
|
||||
}
|
||||
|
||||
void
|
||||
@@ -294,21 +294,21 @@ ClientPlayer::getMyTurn() const
|
||||
}
|
||||
|
||||
void
|
||||
ClientPlayer::setMyCardsFlip(bool theValue, int state)
|
||||
ClientPlayer::setMyHoleCardsFlip(bool theValue, int state)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||
myCardsFlip = theValue;
|
||||
myHoleCardsFlip = theValue;
|
||||
// log flipping cards
|
||||
if (myCardsFlip) {
|
||||
if (myHoleCardsFlip) {
|
||||
switch(state) {
|
||||
case 1:
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt);
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt);
|
||||
break;
|
||||
case 2:
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1]);
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1]);
|
||||
break;
|
||||
case 3:
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt, "has");
|
||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt, "has");
|
||||
break;
|
||||
default:
|
||||
;
|
||||
@@ -317,10 +317,10 @@ ClientPlayer::setMyCardsFlip(bool theValue, int state)
|
||||
}
|
||||
|
||||
bool
|
||||
ClientPlayer::getMyCardsFlip() const
|
||||
ClientPlayer::getMyHoleCardsFlip() const
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||
return myCardsFlip;
|
||||
return myHoleCardsFlip;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -89,14 +89,14 @@ public:
|
||||
void setMyStayOnTableStatus(bool theValue);
|
||||
bool getMyStayOnTableStatus() const;
|
||||
|
||||
void setMyCards(int* theValue);
|
||||
void getMyCards(int* theValue) const;
|
||||
void setMyHoleCards(int* theValue);
|
||||
void getMyHoleCards(int* theValue) const;
|
||||
|
||||
void setMyTurn(bool theValue);
|
||||
bool getMyTurn() const;
|
||||
|
||||
void setMyCardsFlip(bool theValue, int state);
|
||||
bool getMyCardsFlip() const;
|
||||
void setMyHoleCardsFlip(bool theValue, int state);
|
||||
bool getMyHoleCardsFlip() const;
|
||||
|
||||
void setMyCardsValueInt(int theValue);
|
||||
int getMyCardsValueInt() const;
|
||||
@@ -184,7 +184,7 @@ private:
|
||||
int myNiveau[3];
|
||||
bool logHoleCardsDone;
|
||||
|
||||
int myCards[2];
|
||||
int myHoleCards[2];
|
||||
int myCash;
|
||||
int mySet;
|
||||
int myLastRelativeSet;
|
||||
@@ -193,7 +193,7 @@ private:
|
||||
bool myActiveStatus; // 0 = inactive, 1 = active
|
||||
bool myStayOnTableStatus; // 0 = left, 1 = stay
|
||||
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 lastMoneyWon;
|
||||
|
||||
|
||||
@@ -87,14 +87,14 @@ public:
|
||||
virtual void setMyStayOnTableStatus(bool theValue) =0;
|
||||
virtual bool getMyStayOnTableStatus() const =0;
|
||||
|
||||
virtual void setMyCards(int* theValue) =0;
|
||||
virtual void getMyCards(int* theValue) const =0;
|
||||
virtual void setMyHoleCards(int* theValue) =0;
|
||||
virtual void getMyHoleCards(int* theValue) const =0;
|
||||
|
||||
virtual void setMyTurn(bool theValue) =0;
|
||||
virtual bool getMyTurn() const =0;
|
||||
|
||||
virtual void setMyCardsFlip(bool theValue, int state) =0;
|
||||
virtual bool getMyCardsFlip() const =0;
|
||||
virtual void setMyHoleCardsFlip(bool theValue, int state) =0;
|
||||
virtual bool getMyHoleCardsFlip() const =0;
|
||||
|
||||
virtual void setMyCardsValueInt(int theValue) =0;
|
||||
virtual int getMyCardsValueInt() const =0;
|
||||
|
||||
+2
-5
@@ -37,10 +37,6 @@
|
||||
#define MIN_GUI_SPEED 1
|
||||
#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_MINOR 11
|
||||
#define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR)
|
||||
@@ -58,7 +54,8 @@
|
||||
enum ServerMode {
|
||||
SERVER_MODE_LAN,
|
||||
SERVER_MODE_INTERNET_NOAUTH,
|
||||
SERVER_MODE_INTERNET_AUTH
|
||||
SERVER_MODE_INTERNET_AUTH,
|
||||
SERVER_MODE_LAN_LOCAL
|
||||
};
|
||||
|
||||
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::logFlipHoleCardsMsg(std::string /*playerName*/, int /*card1*/, int /*card2*/, int /*cardsValueInt*/, std::string /*showHas*/) {}
|
||||
void ServerGuiWrapper::logPlayerWinGame(std::string /*playerName*/, int /*gameID*/) {}
|
||||
void ServerGuiWrapper::flushLogAtGame(int /*gameID*/) {}
|
||||
void ServerGuiWrapper::flushLogAtHand() {}
|
||||
|
||||
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 logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
|
||||
void logPlayerWinGame(std::string playerName, int gameID);
|
||||
void flushLogAtGame(int gameID);
|
||||
void flushLogAtHand();
|
||||
|
||||
void SignalNetClientConnect(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 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 flushLogAtGame(int gameID) =0;
|
||||
virtual void flushLogAtHand() =0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifndef ANDROID_TEST
|
||||
#include "QtGui/5.2.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include <jni.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -133,7 +133,7 @@ bool changeCompleteBlindsDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
||||
event->ignore();
|
||||
return false;
|
||||
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
||||
this->reject();
|
||||
event->ignore();
|
||||
return true;
|
||||
} else {
|
||||
// pass the event on to the parent class
|
||||
|
||||
@@ -139,7 +139,7 @@ bool changeContentDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
||||
event->ignore();
|
||||
return false;
|
||||
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
||||
this->reject();
|
||||
event->ignore();
|
||||
return true;
|
||||
} else {
|
||||
// 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) {
|
||||
event->ignore();
|
||||
this->reject();
|
||||
return false;
|
||||
return true;
|
||||
} else {
|
||||
// pass the event on to the parent class
|
||||
return QDialog::eventFilter(obj, event);
|
||||
|
||||
@@ -160,8 +160,7 @@ bool createNetworkGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
||||
return false;
|
||||
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
||||
event->ignore();
|
||||
this->reject();
|
||||
return false;
|
||||
return true;
|
||||
} else {
|
||||
// pass the event on to the parent class
|
||||
return QDialog::eventFilter(obj, event);
|
||||
|
||||
@@ -1412,8 +1412,7 @@ bool gameLobbyDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
||||
return QDialog::eventFilter(obj, event);
|
||||
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
||||
event->ignore();
|
||||
this->reject();
|
||||
return false;
|
||||
return true;
|
||||
} else {
|
||||
// pass the event on to the parent class
|
||||
return QDialog::eventFilter(obj, event);
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifndef ANDROID_TEST
|
||||
#include "QtGui/5.2.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include <jni.h>
|
||||
#endif
|
||||
#endif
|
||||
@@ -113,12 +113,12 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
tabsDiag = new QDialog(this);
|
||||
tabs.setupUi(tabsDiag);
|
||||
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;}");
|
||||
this->setWindowState(Qt::WindowFullScreen);
|
||||
#else
|
||||
#else
|
||||
tabs.pushButton_settings->hide();
|
||||
#endif
|
||||
#endif
|
||||
tabs.label_chance->setMyStyle(myGameTableStyle);
|
||||
#else
|
||||
label_chance->setMyStyle(myGameTableStyle);
|
||||
@@ -792,20 +792,20 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog)
|
||||
//refresh board cards if game is running
|
||||
if(myStartWindow->getSession()->getCurrentGame()) {
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
int boardCards[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
GameState currentState = myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->getMyBeRoID();
|
||||
if(currentState >= GAME_STATE_FLOP && currentState <= GAME_STATE_POST_RIVER)
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -834,7 +834,7 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog)
|
||||
QPixmap tempCardsPixmapArray[2];
|
||||
int tempCardsIntArray[2];
|
||||
|
||||
humanPlayer->getMyCards(tempCardsIntArray);
|
||||
humanPlayer->getMyHoleCards(tempCardsIntArray);
|
||||
if(myConfig->readConfigInt("AntiPeekMode")) {
|
||||
holeCardsArray[0][0]->setPixmap(flipside, true);
|
||||
tempCardsPixmapArray[0] = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[0], 10)+".png"));
|
||||
@@ -1440,10 +1440,10 @@ void gameTableImpl::dealHoleCards()
|
||||
PlayerListConstIterator it_c;
|
||||
PlayerList seatsList = currentGame->getSeatsList();
|
||||
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++) {
|
||||
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");
|
||||
if(myConfig->readConfigInt("AntiPeekMode")) {
|
||||
holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(flipside, true);
|
||||
@@ -1532,10 +1532,10 @@ void gameTableImpl::dealFlopCards3()
|
||||
void gameTableImpl::dealFlopCards4()
|
||||
{
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
int boardCards[5];
|
||||
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[0], 10)+".png"));
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[0], 10)+".png"));
|
||||
|
||||
//Config? mit oder ohne Eye-Candy?
|
||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
@@ -1552,9 +1552,9 @@ void gameTableImpl::dealFlopCards4()
|
||||
void gameTableImpl::dealFlopCards5()
|
||||
{
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[1], 10)+".png"));
|
||||
int boardCards[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[1], 10)+".png"));
|
||||
|
||||
//Config? mit oder ohne Eye-Candy?
|
||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
@@ -1571,9 +1571,9 @@ void gameTableImpl::dealFlopCards5()
|
||||
void gameTableImpl::dealFlopCards6()
|
||||
{
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[2], 10)+".png"));
|
||||
int boardCards[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[2], 10)+".png"));
|
||||
|
||||
//Config? mit oder ohne Eye-Candy?
|
||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
@@ -1615,9 +1615,9 @@ void gameTableImpl::dealTurnCards1()
|
||||
void gameTableImpl::dealTurnCards2()
|
||||
{
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[3], 10)+".png"));
|
||||
int boardCards[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[3], 10)+".png"));
|
||||
|
||||
//Config? mit oder ohne Eye-Candy?
|
||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
@@ -1660,9 +1660,9 @@ void gameTableImpl::dealRiverCards1()
|
||||
void gameTableImpl::dealRiverCards2()
|
||||
{
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[4], 10)+".png"));
|
||||
int boardCards[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[4], 10)+".png"));
|
||||
|
||||
//Config? mit oder ohne Eye-Candy?
|
||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
@@ -2550,7 +2550,7 @@ void gameTableImpl::postRiverRunAnimation2()
|
||||
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
|
||||
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||
//set Player value (logging) for all in already shown cards
|
||||
(*it_c)->setMyCardsFlip(1,3);
|
||||
(*it_c)->setMyHoleCardsFlip(1,3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2805,8 +2805,6 @@ void gameTableImpl::postRiverRunAnimation6()
|
||||
}
|
||||
}
|
||||
|
||||
if( !DEBUG_MODE ) {
|
||||
|
||||
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) {
|
||||
currentGameOver = true;
|
||||
#ifdef GUI_800x480
|
||||
@@ -2825,10 +2823,6 @@ void gameTableImpl::postRiverRunAnimation6()
|
||||
#endif
|
||||
blinkingStartButtonAnimationTimer->start(500);
|
||||
}
|
||||
} else {
|
||||
myStartWindow->callNewGameDialog();
|
||||
//Bei Cancel nichts machen!!!
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2849,7 +2843,7 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn)
|
||||
|
||||
if((*it_c)->getMyUniqueID() == playerId) {
|
||||
|
||||
(*it_c)->getMyCards(tempCardsIntArray);
|
||||
(*it_c)->getMyHoleCards(tempCardsIntArray);
|
||||
for(j=0; j<2; j++) {
|
||||
|
||||
if(showFlipcardAnimation) { // with Eye-Candy
|
||||
@@ -2861,9 +2855,9 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn)
|
||||
}
|
||||
//set Player value (logging)
|
||||
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 {
|
||||
(*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();
|
||||
return true;
|
||||
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
|
||||
event->ignore();
|
||||
closeGameTable();
|
||||
return true;
|
||||
} else if (event->type() == QEvent::Close) {
|
||||
@@ -4020,7 +4013,7 @@ void gameTableImpl::refreshCardsChance(GameState bero)
|
||||
int boardCards[5];
|
||||
int holeCards[2];
|
||||
|
||||
humanPlayer->getMyCards(holeCards);
|
||||
humanPlayer->getMyHoleCards(holeCards);
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
|
||||
if(humanPlayer->getMyAction() == PLAYER_ACTION_FOLD) {
|
||||
@@ -4303,11 +4296,12 @@ void gameTableImpl::restoreGameTableGeometry()
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
#ifndef ANDROID
|
||||
//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()) {
|
||||
|
||||
this->resize(myConfig->readConfigInt("GameTableWidthSave"), myConfig->readConfigInt("GameTableHeightSave"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef ANDROID
|
||||
if(getAndroidApiVersion() == 10) {
|
||||
@@ -4316,6 +4310,8 @@ void gameTableImpl::restoreGameTableGeometry()
|
||||
int availableHeight = dw.screenGeometry().height();
|
||||
this->showNormal();
|
||||
this->setGeometry(0,0,availableWidth, availableHeight);
|
||||
} else {
|
||||
this->showFullScreen();
|
||||
}
|
||||
#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)
|
||||
{
|
||||
newVersion = true;
|
||||
|
||||
myW->setGuiLog(this);
|
||||
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(signalLogSpectatorJoinedMsg(QString)), this, SLOT(logSpectatorJoinedMsg(QString)));
|
||||
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 = "";
|
||||
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()));
|
||||
|
||||
if(HTML_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
|
||||
// delete old log files - TODO: move to Log
|
||||
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
||||
|
||||
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>");
|
||||
#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)
|
||||
{
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
boost::shared_ptr<HandInterface> currentHand = myW->getSession()->getCurrentGame()->getCurrentHand();
|
||||
|
||||
PlayerList activePlayerList = currentHand->getActivePlayerList();
|
||||
|
||||
#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>");
|
||||
#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>");
|
||||
#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)
|
||||
{
|
||||
|
||||
// log blinds
|
||||
#ifdef GUI_800x480
|
||||
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()+";\">"+bbName+" posts big blind ($"+QString::number(bbSet,10)+")</span>");
|
||||
#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)
|
||||
@@ -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>");
|
||||
}
|
||||
#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)
|
||||
{
|
||||
|
||||
#ifdef GUI_800x480
|
||||
myW->tabs.textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
||||
#else
|
||||
myW->textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
||||
#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)
|
||||
{
|
||||
|
||||
QString round;
|
||||
|
||||
switch (roundID) {
|
||||
|
||||
case 1:
|
||||
round = "Flop";
|
||||
#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
|
||||
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
|
||||
break;
|
||||
case 2:
|
||||
round = "Turn";
|
||||
#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
|
||||
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
|
||||
break;
|
||||
case 3:
|
||||
round = "River";
|
||||
#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
|
||||
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
|
||||
break;
|
||||
default:
|
||||
round = "ERROR";
|
||||
}
|
||||
|
||||
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>");
|
||||
#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)
|
||||
{
|
||||
|
||||
QString action;
|
||||
if(wasKicked) action = "was kicked from";
|
||||
else action = "has left";
|
||||
@@ -490,44 +270,15 @@ void guiLog::logPlayerLeftMsg(QString playerName, int wasKicked)
|
||||
#else
|
||||
myW->textBrowser_Log->append( "<span style=\"color:#"+myStyle->getChatLogTextColor()+";\"><i>"+playerName+" "+action+" the game!</i></span>");
|
||||
#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)
|
||||
{
|
||||
|
||||
#ifdef GUI_800x480
|
||||
myW->tabs.textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
||||
#else
|
||||
myW->textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
||||
#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)
|
||||
@@ -551,27 +302,11 @@ void guiLog::logSpectatorJoinedMsg(QString playerName)
|
||||
|
||||
void guiLog::logPlayerWinGame(QString playerName, int gameID)
|
||||
{
|
||||
|
||||
#ifdef GUI_800x480
|
||||
myW->tabs.textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
||||
#else
|
||||
myW->textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
||||
#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)
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -769,8 +471,6 @@ void guiLog::showLog(QString fileStringPdb, QTextBrowser *tb_tmp, int uniqueGame
|
||||
|
||||
int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
{
|
||||
bool neu = false;
|
||||
|
||||
result_struct results;
|
||||
results.result_Session = 0;
|
||||
results.result_Game = 0;
|
||||
@@ -866,7 +566,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
switch(modus) {
|
||||
case 1:
|
||||
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;
|
||||
case 2:
|
||||
log_string += "";
|
||||
@@ -957,7 +657,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
switch(modus) {
|
||||
case 1:
|
||||
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>";
|
||||
break;
|
||||
case 2:
|
||||
@@ -1019,7 +719,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) log_string += "</br>";
|
||||
if(!newVersion) log_string += "</br>";
|
||||
else log_string += "<br />";
|
||||
break;
|
||||
case 2:
|
||||
@@ -1057,7 +757,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
log_string += ")";
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) log_string += "</br>";
|
||||
if(!newVersion) log_string += "</br>";
|
||||
else log_string += "<br />";
|
||||
break;
|
||||
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 />";
|
||||
|
||||
@@ -1202,7 +902,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
if(nRow_Action == 1) {
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) log_string += "</br>";
|
||||
if(!newVersion) log_string += "</br>";
|
||||
else log_string += "<br />";
|
||||
break;
|
||||
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);
|
||||
log_string = "";
|
||||
@@ -1248,10 +948,10 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
}
|
||||
switch(modus) {
|
||||
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>";
|
||||
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;
|
||||
}
|
||||
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++) {
|
||||
switch(modus) {
|
||||
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)"))
|
||||
log_string += "\n";
|
||||
else
|
||||
@@ -1336,7 +1036,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
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 += " wins $";
|
||||
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") {
|
||||
switch(modus) {
|
||||
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>";
|
||||
break;
|
||||
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)") {
|
||||
switch(modus) {
|
||||
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>";
|
||||
break;
|
||||
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") {
|
||||
switch(modus) {
|
||||
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>";
|
||||
break;
|
||||
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") {
|
||||
switch(modus) {
|
||||
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>";
|
||||
break;
|
||||
case 3:
|
||||
@@ -1421,7 +1121,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
// 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") {
|
||||
// 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 += " [";
|
||||
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 += ".";
|
||||
}
|
||||
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 += ".";
|
||||
|
||||
}
|
||||
|
||||
@@ -81,8 +81,6 @@ public slots:
|
||||
void logSpectatorLeftMsg(QString playerName, int wasKicked);
|
||||
void logSpectatorJoinedMsg(QString playerName);
|
||||
void logPlayerWinGame(QString playerName, int gameID);
|
||||
void flushLogAtGame(int gameID);
|
||||
void flushLogAtHand();
|
||||
void exportLogPdbToHtml(QString fileStringPdb, QString exportFileString);
|
||||
void exportLogPdbToTxt(QString fileStringPdb, QString exportFileString);
|
||||
void showLog(QString fileStringPdb, QTextBrowser *tb, int uniqueGameID = 0);
|
||||
@@ -115,8 +113,6 @@ signals:
|
||||
void signalLogSpectatorJoinedMsg(QString playerName);
|
||||
void signalLogNewGameAdminMsg(QString playerName);
|
||||
void signalLogPlayerWinGame(QString playerName, int gameID);
|
||||
void signalFlushLogAtGame(int gameID);
|
||||
void signalFlushLogAtHand();
|
||||
|
||||
|
||||
private:
|
||||
@@ -141,6 +137,7 @@ private:
|
||||
QTextBrowser* tb;
|
||||
GameTableStyleReader *myStyle;
|
||||
std::string mySqliteLogFileName;
|
||||
bool newVersion;
|
||||
|
||||
friend class GuiWrapper;
|
||||
|
||||
|
||||
@@ -287,14 +287,6 @@ void GuiWrapper::logPlayerWinGame(std::string playerName, int 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)
|
||||
|
||||
@@ -124,8 +124,6 @@ public:
|
||||
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 logPlayerWinGame(std::string playerName, int gameID);
|
||||
void flushLogAtGame(int gameID);
|
||||
void flushLogAtHand();
|
||||
|
||||
void SignalNetClientConnect(int actionID);
|
||||
void SignalNetClientServerListAdd(unsigned serverId);
|
||||
|
||||
@@ -155,10 +155,18 @@ void LogFileDialog::exportLogToHtml()
|
||||
|
||||
if(selectedItem) {
|
||||
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",
|
||||
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()) {
|
||||
myGuiLog->exportLogPdbToHtml(selectedItem->data(0, Qt::UserRole).toString(),fileName);
|
||||
}
|
||||
@@ -171,10 +179,18 @@ void LogFileDialog::exportLogToTxt()
|
||||
|
||||
if(selectedItem) {
|
||||
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",
|
||||
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()) {
|
||||
myGuiLog->exportLogPdbToTxt(selectedItem->data(0, Qt::UserRole).toString(),fileName);
|
||||
}
|
||||
@@ -187,10 +203,18 @@ void LogFileDialog::saveLogFileAs()
|
||||
|
||||
if(selectedItem) {
|
||||
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",
|
||||
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()) {
|
||||
QFile::copy(selectedItem->data(0, Qt::UserRole).toString(), fileName);
|
||||
}
|
||||
@@ -227,6 +251,8 @@ void LogFileDialog::keyPressEvent ( QKeyEvent * event )
|
||||
if(ui->treeWidget_logFiles->hasFocus()) {
|
||||
ui->pushButton_deleteLog->click();
|
||||
}
|
||||
} else {
|
||||
QDialog::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -240,6 +240,7 @@ void startNetworkGameDialogImpl::keyPressEvent ( QKeyEvent * event )
|
||||
} else {
|
||||
keyUpDownChatCounter = 0;
|
||||
}
|
||||
QDialog::keyPressEvent(event);
|
||||
}
|
||||
|
||||
bool startNetworkGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifndef ANDROID_TEST
|
||||
#include "QtGui/5.2.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include <jni.h>
|
||||
#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
|
||||
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)
|
||||
// #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(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();
|
||||
|
||||
//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)
|
||||
{
|
||||
|
||||
@@ -383,9 +407,6 @@ void startWindowImpl::startNewLocalGame(newGameDialogImpl *v)
|
||||
int tmpDealerPos = 0;
|
||||
startData.numberOfPlayers = gameData.maxNumberOfPlayers;
|
||||
Tools::GetRand(0, startData.numberOfPlayers-1, 1, &tmpDealerPos);
|
||||
//if(DEBUG_MODE) {
|
||||
// tmpDealerPos = 4;
|
||||
//}
|
||||
startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos);
|
||||
|
||||
//some gui modifications
|
||||
@@ -395,6 +416,117 @@ void startWindowImpl::startNewLocalGame(newGameDialogImpl *v)
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -774,12 +906,24 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
|
||||
QMessageBox::Close);
|
||||
}
|
||||
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: {
|
||||
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."),
|
||||
QMessageBox::Close);
|
||||
}
|
||||
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: {
|
||||
MyMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Internal network error: \"select\" failed."),
|
||||
|
||||
@@ -149,6 +149,7 @@ public slots:
|
||||
void callSettingsDialog(bool);
|
||||
void callSettingsDialogFromStartwindow();
|
||||
void callNewGameDialog();
|
||||
void callNewGameDialogNew();
|
||||
void callGameLobbyDialog();
|
||||
void callCreateNetworkGameDialog();
|
||||
void callJoinNetworkGameDialog();
|
||||
@@ -161,6 +162,7 @@ public slots:
|
||||
void callLogFileDialog();
|
||||
|
||||
void startNewLocalGame(newGameDialogImpl* =0);
|
||||
void startNewLocalGameNew(newGameDialogImpl* =0);
|
||||
|
||||
void showTimeoutDialog(int msgID, unsigned duration);
|
||||
void hideTimeoutDialog();
|
||||
|
||||
@@ -1332,7 +1332,7 @@ void GameTableStyleReader::showOutdatedErrorMessage()
|
||||
|
||||
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)
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
@@ -218,7 +219,7 @@ protected:
|
||||
|
||||
ClientState &GetState();
|
||||
void SetState(ClientState &newState);
|
||||
boost::asio::deadline_timer &GetStateTimer();
|
||||
boost::asio::steady_timer &GetStateTimer();
|
||||
|
||||
SenderHelper &GetSender();
|
||||
|
||||
@@ -341,8 +342,8 @@ private:
|
||||
mutable boost::mutex m_pingDataMutex;
|
||||
PingData m_pingData;
|
||||
|
||||
boost::asio::deadline_timer m_stateTimer;
|
||||
boost::asio::deadline_timer m_avatarTimer;
|
||||
boost::asio::steady_timer m_stateTimer;
|
||||
boost::asio::steady_timer m_avatarTimer;
|
||||
|
||||
friend class AbstractClientStateReceiving;
|
||||
friend class ClientStateInit;
|
||||
|
||||
@@ -60,6 +60,12 @@
|
||||
using namespace std;
|
||||
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_CONNECT_TIMEOUT_SEC 10
|
||||
|
||||
@@ -238,7 +244,7 @@ void
|
||||
ClientStateDownloadingServerList::Enter(boost::shared_ptr<ClientThread> client)
|
||||
{
|
||||
client->GetStateTimer().expires_from_now(
|
||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
client->GetStateTimer().async_wait(
|
||||
boost::bind(
|
||||
&ClientStateDownloadingServerList::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||
@@ -265,7 +271,7 @@ ClientStateDownloadingServerList::TimerLoop(const boost::system::error_code& ec,
|
||||
client->SetState(ClientStateReadingServerList::Instance());
|
||||
} else {
|
||||
client->GetStateTimer().expires_from_now(
|
||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
client->GetStateTimer().async_wait(
|
||||
boost::bind(
|
||||
&ClientStateDownloadingServerList::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||
@@ -409,7 +415,7 @@ void
|
||||
ClientStateWaitChooseServer::Enter(boost::shared_ptr<ClientThread> client)
|
||||
{
|
||||
client->GetStateTimer().expires_from_now(
|
||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
client->GetStateTimer().async_wait(
|
||||
boost::bind(
|
||||
&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());
|
||||
} else {
|
||||
client->GetStateTimer().expires_from_now(
|
||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
client->GetStateTimer().async_wait(
|
||||
boost::bind(
|
||||
&ClientStateWaitChooseServer::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||
@@ -461,7 +467,7 @@ void
|
||||
ClientStateStartConnect::Enter(boost::shared_ptr<ClientThread> client)
|
||||
{
|
||||
client->GetStateTimer().expires_from_now(
|
||||
boost::posix_time::seconds(CLIENT_CONNECT_TIMEOUT_SEC));
|
||||
seconds(CLIENT_CONNECT_TIMEOUT_SEC));
|
||||
client->GetStateTimer().async_wait(
|
||||
boost::bind(
|
||||
&ClientStateStartConnect::TimerTimeout, this, boost::asio::placeholders::error, client));
|
||||
@@ -511,10 +517,14 @@ ClientStateStartConnect::HandleConnect(const boost::system::error_code& ec, boos
|
||||
client));
|
||||
} else {
|
||||
if (ec != boost::asio::error::operation_aborted) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -523,8 +533,12 @@ ClientStateStartConnect::TimerTimeout(const boost::system::error_code& ec, boost
|
||||
if (!ec && &client->GetState() == this) {
|
||||
boost::system::error_code ec;
|
||||
client->GetContext().GetSessionData()->GetAsioSocket()->close(ec);
|
||||
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)
|
||||
{
|
||||
client->GetStateTimer().expires_from_now(
|
||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
client->GetStateTimer().async_wait(
|
||||
boost::bind(
|
||||
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||
@@ -1065,7 +1079,7 @@ ClientStateWaitEnterLogin::TimerLoop(const boost::system::error_code& ec, boost:
|
||||
}
|
||||
} else {
|
||||
client->GetStateTimer().expires_from_now(
|
||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
client->GetStateTimer().async_wait(
|
||||
boost::bind(
|
||||
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||
@@ -1399,7 +1413,7 @@ void
|
||||
ClientStateSynchronizeStart::Enter(boost::shared_ptr<ClientThread> client)
|
||||
{
|
||||
client->GetStateTimer().expires_from_now(
|
||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
client->GetStateTimer().async_wait(
|
||||
boost::bind(
|
||||
&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());
|
||||
} else {
|
||||
client->GetStateTimer().expires_from_now(
|
||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||
client->GetStateTimer().async_wait(
|
||||
boost::bind(
|
||||
&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.
|
||||
client->GetGui().waitForGuiUpdateDone();
|
||||
// Start new hand.
|
||||
client->GetGame()->getSeatsList()->front()->setMyCards(myCards);
|
||||
client->GetGame()->getSeatsList()->front()->setMyHoleCards(myCards);
|
||||
client->GetGame()->initHand();
|
||||
client->GetGame()->getCurrentHand()->setSmallBlind(netHandStart.smallblind());
|
||||
client->GetGame()->getCurrentHand()->getCurrentBeRo()->setMinimumRaise(2 * netHandStart.smallblind());
|
||||
@@ -1677,7 +1691,7 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
||||
int bestHandPos[5];
|
||||
tmpCards[0] = static_cast<int>(r.resultcard1());
|
||||
tmpCards[1] = static_cast<int>(r.resultcard2());
|
||||
tmpPlayer->setMyCards(tmpCards);
|
||||
tmpPlayer->setMyHoleCards(tmpCards);
|
||||
for (int num = 0; num < 5; 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()->getSmallBlindPositionId())->getMyName(),
|
||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyName());
|
||||
client->GetGui().flushLogAtHand();
|
||||
client->GetClientLog()->logNewHandMsg(
|
||||
curGame->getCurrentHandID(),
|
||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getDealerPosition())->getMyID()+1,
|
||||
@@ -1926,7 +1939,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
||||
int tmpCards[2];
|
||||
tmpCards[0] = static_cast<int>(p.allincard1());
|
||||
tmpCards[1] = static_cast<int>(p.allincard2());
|
||||
tmpPlayer->setMyCards(tmpCards);
|
||||
tmpPlayer->setMyHoleCards(tmpCards);
|
||||
}
|
||||
client->GetGui().flipHolecardsAllIn();
|
||||
if(curGame->getCurrentHand()->getCurrentRound()<GAME_STATE_RIVER) {
|
||||
@@ -1998,7 +2011,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
||||
int bestHandPos[5];
|
||||
tmpCards[0] = static_cast<int>(r.resultcard1());
|
||||
tmpCards[1] = static_cast<int>(r.resultcard2());
|
||||
tmpPlayer->setMyCards(tmpCards);
|
||||
tmpPlayer->setMyHoleCards(tmpCards);
|
||||
for (int num = 0; num < 5; num++) {
|
||||
bestHandPos[num] = r.besthandposition(num);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,12 @@ using namespace std;
|
||||
using namespace boost::filesystem;
|
||||
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)
|
||||
: m_ioService(new boost::asio::io_service), m_clientLog(myLog), m_curState(NULL), m_gui(gui),
|
||||
m_avatarManager(avatarManager), m_isServerSelected(false),
|
||||
@@ -586,7 +592,7 @@ void
|
||||
ClientThread::RegisterTimers()
|
||||
{
|
||||
m_avatarTimer.expires_from_now(
|
||||
boost::posix_time::milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
||||
milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
||||
m_avatarTimer.async_wait(
|
||||
boost::bind(
|
||||
&ClientThread::TimerCheckAvatarDownloads, shared_from_this(), boost::asio::placeholders::error));
|
||||
@@ -910,7 +916,7 @@ ClientThread::TimerCheckAvatarDownloads(const boost::system::error_code& ec)
|
||||
PassAvatarFileToManager(playerId, tmpAvatar);
|
||||
}
|
||||
m_avatarTimer.expires_from_now(
|
||||
boost::posix_time::milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
||||
milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
||||
m_avatarTimer.async_wait(
|
||||
boost::bind(
|
||||
&ClientThread::TimerCheckAvatarDownloads, shared_from_this(), boost::asio::placeholders::error));
|
||||
@@ -1022,7 +1028,7 @@ ClientThread::SetState(ClientState &newState)
|
||||
m_curState->Enter(shared_from_this());
|
||||
}
|
||||
|
||||
boost::asio::deadline_timer &
|
||||
boost::asio::steady_timer &
|
||||
ClientThread::GetStateTimer()
|
||||
{
|
||||
return m_stateTimer;
|
||||
|
||||
@@ -49,6 +49,12 @@
|
||||
using namespace std;
|
||||
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)
|
||||
: 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),
|
||||
@@ -272,17 +278,17 @@ ServerAdminBot::Run()
|
||||
if (m_ircAdminThread) {
|
||||
// Initialise the timers.
|
||||
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(
|
||||
boost::bind(
|
||||
&ServerAdminBot::ReconnectHandler, shared_from_this(), boost::asio::placeholders::error));
|
||||
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(
|
||||
boost::bind(
|
||||
&ServerAdminBot::NotifyLoop, shared_from_this(), boost::asio::placeholders::error));
|
||||
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(
|
||||
boost::bind(
|
||||
&ServerAdminBot::CheckFileHandler, shared_from_this(), boost::asio::placeholders::error));
|
||||
@@ -298,7 +304,7 @@ ServerAdminBot::ReconnectHandler(const boost::system::error_code& ec)
|
||||
Reconnect();
|
||||
|
||||
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(
|
||||
boost::bind(
|
||||
&ServerAdminBot::ReconnectHandler, shared_from_this(), boost::asio::placeholders::error));
|
||||
@@ -330,7 +336,7 @@ ServerAdminBot::CheckFileHandler(const boost::system::error_code& ec)
|
||||
Reconnect();
|
||||
}
|
||||
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(
|
||||
boost::bind(
|
||||
&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(
|
||||
boost::posix_time::seconds(SERVER_NOTIFY_IRC_BOT_INTERVAL_SEC));
|
||||
seconds(SERVER_NOTIFY_IRC_BOT_INTERVAL_SEC));
|
||||
m_notifyLoopTimer.async_wait(
|
||||
boost::bind(
|
||||
&ServerAdminBot::NotifyLoop, shared_from_this(), boost::asio::placeholders::error));
|
||||
|
||||
@@ -34,6 +34,11 @@
|
||||
|
||||
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)
|
||||
: 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;
|
||||
|
||||
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());
|
||||
++i_nick;
|
||||
}
|
||||
@@ -136,7 +141,7 @@ ServerBanManager::GetBanList(list<string> &list) const
|
||||
ostringstream banText;
|
||||
banText << (*i_ip).first << ": (IP) - " << (*i_ip).second.ipAddress;
|
||||
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());
|
||||
++i_ip;
|
||||
}
|
||||
@@ -235,14 +240,14 @@ ServerBanManager::IsBadGameName(const std::string &name) const
|
||||
return retVal;
|
||||
}
|
||||
|
||||
boost::shared_ptr<boost::asio::deadline_timer>
|
||||
boost::shared_ptr<boost::asio::steady_timer>
|
||||
ServerBanManager::InternalRegisterTimedBan(unsigned timerId, unsigned durationHours)
|
||||
{
|
||||
boost::shared_ptr<boost::asio::deadline_timer> tmpTimer;
|
||||
boost::shared_ptr<boost::asio::steady_timer> tmpTimer;
|
||||
if (durationHours) {
|
||||
tmpTimer.reset(new boost::asio::deadline_timer(*m_ioService));
|
||||
tmpTimer.reset(new boost::asio::steady_timer(*m_ioService));
|
||||
tmpTimer->expires_from_now(
|
||||
boost::posix_time::hours(durationHours));
|
||||
hours(durationHours));
|
||||
tmpTimer->async_wait(
|
||||
boost::bind(
|
||||
&ServerBanManager::TimerRemoveBan, shared_from_this(), boost::asio::placeholders::error, timerId, tmpTimer));
|
||||
@@ -251,7 +256,7 @@ ServerBanManager::InternalRegisterTimedBan(unsigned timerId, unsigned durationHo
|
||||
}
|
||||
|
||||
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)
|
||||
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;
|
||||
|
||||
#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)
|
||||
{
|
||||
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,
|
||||
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_gameData(gameData), m_curState(NULL), m_id(id), m_name(name),
|
||||
m_password(pwd), m_creatorPlayerDBId(creatorPlayerDBId), m_playerConfig(playerConfig),
|
||||
m_gameNum(1), m_curPetitionId(1), m_voteKickTimer(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.");
|
||||
}
|
||||
@@ -276,7 +282,7 @@ ServerGame::TimerVoteKick(const boost::system::error_code &ec)
|
||||
m_voteKickData.reset();
|
||||
}
|
||||
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(
|
||||
boost::bind(
|
||||
&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);
|
||||
|
||||
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(
|
||||
boost::bind(
|
||||
&ServerGame::TimerVoteKick, shared_from_this(), boost::asio::placeholders::error));
|
||||
@@ -1036,6 +1042,12 @@ ServerGame::GetSessionManager() const
|
||||
return m_sessionManager;
|
||||
}
|
||||
|
||||
const ServerDelayTime
|
||||
ServerGame::GetServerDelayTime() const
|
||||
{
|
||||
return m_serverDelayTime;
|
||||
}
|
||||
|
||||
ServerDBInterface &
|
||||
ServerGame::GetDatabase()
|
||||
{
|
||||
@@ -1072,13 +1084,13 @@ ServerGame::SetState(ServerGameState &newState)
|
||||
m_curState->Enter(shared_from_this());
|
||||
}
|
||||
|
||||
boost::asio::deadline_timer &
|
||||
boost::asio::steady_timer &
|
||||
ServerGame::GetStateTimer1()
|
||||
{
|
||||
return m_stateTimer1;
|
||||
}
|
||||
|
||||
boost::asio::deadline_timer &
|
||||
boost::asio::steady_timer &
|
||||
ServerGame::GetStateTimer2()
|
||||
{
|
||||
return m_stateTimer2;
|
||||
@@ -1132,7 +1144,7 @@ bool
|
||||
ServerGame::CheckSettings(const GameData &data, const string &password, ServerMode mode)
|
||||
{
|
||||
bool retVal = true;
|
||||
if (mode != SERVER_MODE_LAN) {
|
||||
if (mode != SERVER_MODE_LAN && mode != SERVER_MODE_LAN_LOCAL) {
|
||||
if (data.playerActionTimeoutSec < 5) {
|
||||
retVal = false;
|
||||
}
|
||||
|
||||
@@ -52,26 +52,10 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
//#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
|
||||
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||
using namespace std::chrono;
|
||||
#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
|
||||
using namespace boost::chrono;
|
||||
#endif
|
||||
|
||||
#define SERVER_START_GAME_TIMEOUT_SEC 10
|
||||
@@ -204,7 +188,7 @@ SetPlayerResult(PlayerResult &playerResult, boost::shared_ptr<PlayerInterface> t
|
||||
playerResult.set_playerid(tmpPlayer->getMyUniqueID());
|
||||
int tmpCards[2];
|
||||
int bestHandPos[5];
|
||||
tmpPlayer->getMyCards(tmpCards);
|
||||
tmpPlayer->getMyHoleCards(tmpCards);
|
||||
playerResult.set_resultcard1(tmpCards[0]);
|
||||
playerResult.set_resultcard2(tmpCards[1]);
|
||||
tmpPlayer->getMyBestHandPosition(bestHandPos);
|
||||
@@ -568,9 +552,9 @@ void
|
||||
ServerGameStateInit::RegisterAdminTimer(boost::shared_ptr<ServerGame> server)
|
||||
{
|
||||
// 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(
|
||||
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(
|
||||
boost::bind(
|
||||
&ServerGameStateInit::TimerAdminWarning, this, boost::asio::placeholders::error, server));
|
||||
@@ -587,9 +571,9 @@ void
|
||||
ServerGameStateInit::RegisterAutoStartTimer(boost::shared_ptr<ServerGame> server)
|
||||
{
|
||||
// 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(
|
||||
boost::posix_time::seconds(SERVER_AUTOSTART_GAME_DELAY_SEC));
|
||||
seconds(SERVER_AUTOSTART_GAME_DELAY_SEC));
|
||||
server->GetStateTimer2().async_wait(
|
||||
boost::bind(
|
||||
&ServerGameStateInit::TimerAutoStart, this, boost::asio::placeholders::error, server));
|
||||
@@ -627,7 +611,7 @@ ServerGameStateInit::TimerAdminWarning(const boost::system::error_code &ec, boos
|
||||
}
|
||||
// Start timeout timer.
|
||||
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(
|
||||
boost::bind(
|
||||
&ServerGameStateInit::TimerAdminTimeout, this, boost::asio::placeholders::error, server));
|
||||
@@ -762,7 +746,7 @@ void
|
||||
ServerGameStateStartGame::Enter(boost::shared_ptr<ServerGame> server)
|
||||
{
|
||||
server->GetStateTimer1().expires_from_now(
|
||||
boost::posix_time::seconds(SERVER_START_GAME_TIMEOUT_SEC));
|
||||
seconds(SERVER_START_GAME_TIMEOUT_SEC));
|
||||
server->GetStateTimer1().async_wait(
|
||||
boost::bind(
|
||||
&ServerGameStateStartGame::TimerTimeout, this, boost::asio::placeholders::error, server));
|
||||
@@ -925,7 +909,7 @@ void
|
||||
ServerGameStateHand::Enter(boost::shared_ptr<ServerGame> server)
|
||||
{
|
||||
server->GetStateTimer1().expires_from_now(
|
||||
boost::posix_time::milliseconds(SERVER_LOOP_DELAY_MSEC));
|
||||
milliseconds(SERVER_LOOP_DELAY_MSEC));
|
||||
server->GetStateTimer1().async_wait(
|
||||
boost::bind(
|
||||
&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();
|
||||
playerAllIn->set_playerid((*i)->getMyUniqueID());
|
||||
int tmpCards[2];
|
||||
(*i)->getMyCards(tmpCards);
|
||||
(*i)->getMyHoleCards(tmpCards);
|
||||
playerAllIn->set_allincard1(tmpCards[0]);
|
||||
playerAllIn->set_allincard2(tmpCards[1]);
|
||||
++i;
|
||||
@@ -1002,7 +986,8 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
||||
curGame.getCurrentHand()->setCardsShown(true);
|
||||
|
||||
server->GetStateTimer1().expires_from_now(
|
||||
boost::posix_time::seconds(SERVER_SHOW_CARDS_DELAY_SEC));
|
||||
seconds(server->GetServerDelayTime().getShowCardsDelay()));
|
||||
|
||||
server->GetStateTimer1().async_wait(
|
||||
boost::bind(
|
||||
&ServerGameStateHand::TimerShowCards, this, boost::asio::placeholders::error, server));
|
||||
@@ -1010,7 +995,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
||||
SendNewRoundCards(*server, curGame, newRound);
|
||||
|
||||
server->GetStateTimer1().expires_from_now(
|
||||
boost::posix_time::seconds(GetDealCardsDelaySec(*server)));
|
||||
seconds(GetDealCardsDelaySec(*server)));
|
||||
server->GetStateTimer1().async_wait(
|
||||
boost::bind(
|
||||
&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 (curPlayer->getMyType() == PLAYER_TYPE_COMPUTER) {
|
||||
server->GetStateTimer1().expires_from_now(
|
||||
boost::posix_time::seconds(SERVER_COMPUTER_ACTION_DELAY_SEC));
|
||||
seconds(server->GetServerDelayTime().getComputerActionDelay()));
|
||||
|
||||
server->GetStateTimer1().async_wait(
|
||||
boost::bind(
|
||||
&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);
|
||||
|
||||
server->GetStateTimer1().expires_from_now(
|
||||
boost::posix_time::milliseconds(SERVER_LOOP_DELAY_MSEC));
|
||||
milliseconds(SERVER_LOOP_DELAY_MSEC));
|
||||
server->GetStateTimer1().async_wait(
|
||||
boost::bind(
|
||||
&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.
|
||||
server->GetStateTimer1().expires_from_now(
|
||||
boost::posix_time::seconds(SERVER_DELAY_NEXT_GAME_SEC));
|
||||
seconds(server->GetServerDelayTime().getNextGameDelay()));
|
||||
|
||||
server->GetStateTimer1().async_wait(
|
||||
boost::bind(
|
||||
&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());
|
||||
|
||||
server->GetStateTimer1().expires_from_now(
|
||||
boost::posix_time::seconds(GetDealCardsDelaySec(*server)));
|
||||
seconds(GetDealCardsDelaySec(*server)));
|
||||
server->GetStateTimer1().async_wait(
|
||||
boost::bind(
|
||||
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
||||
@@ -1194,18 +1181,18 @@ int
|
||||
ServerGameStateHand::GetDealCardsDelaySec(ServerGame &server)
|
||||
{
|
||||
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;
|
||||
|
||||
switch(curGame.getCurrentHand()->getCurrentRound()) {
|
||||
case GAME_STATE_FLOP:
|
||||
delay = SERVER_DEAL_FLOP_CARDS_DELAY_SEC;
|
||||
delay = server.GetServerDelayTime().getDealFlopCardsDelay();
|
||||
break;
|
||||
case GAME_STATE_TURN:
|
||||
delay = SERVER_DEAL_TURN_CARD_DELAY_SEC + allInDelay;
|
||||
delay = server.GetServerDelayTime().getDealTurnCardsDelay() + allInDelay;
|
||||
break;
|
||||
case GAME_STATE_RIVER:
|
||||
delay = SERVER_DEAL_RIVER_CARD_DELAY_SEC;
|
||||
delay = server.GetServerDelayTime().getDealRiverCardsDelay();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1251,7 +1238,7 @@ ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server)
|
||||
if (tmpSession) {
|
||||
int cards[2];
|
||||
bool errorFlag = false;
|
||||
tmpPlayer->getMyCards(cards);
|
||||
tmpPlayer->getMyHoleCards(cards);
|
||||
|
||||
boost::shared_ptr<NetPacket> notifyCards = CreateNetPacketHandStart(*server);
|
||||
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
|
||||
#ifdef POKERTH_SERVER_TEST
|
||||
int timeoutSec = SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC;
|
||||
int timeoutSec = server->GetServerDelayTime().getPlayerTimeoutAddDelay();
|
||||
#else
|
||||
int timeoutSec = server->GetGameData().playerActionTimeoutSec + SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC;
|
||||
int timeoutSec = server->GetServerDelayTime().getPlayerTimeoutAddDelay() + server->GetGameData().playerActionTimeoutSec;
|
||||
#endif
|
||||
|
||||
server->GetStateTimer1().expires_from_now(boost::posix_time::seconds(timeoutSec));
|
||||
server->GetStateTimer1().expires_from_now(seconds(timeoutSec));
|
||||
server->GetStateTimer1().async_wait(
|
||||
boost::bind(
|
||||
&ServerGameStateWaitPlayerAction::TimerTimeout, this, boost::asio::placeholders::error, server));
|
||||
@@ -1641,7 +1628,7 @@ ServerGameStateWaitNextHand::Enter(boost::shared_ptr<ServerGame> server)
|
||||
#endif
|
||||
|
||||
server->GetStateTimer1().expires_from_now(
|
||||
boost::posix_time::seconds(timeoutSec));
|
||||
seconds(timeoutSec));
|
||||
|
||||
server->GetStateTimer1().async_wait(
|
||||
boost::bind(
|
||||
|
||||
@@ -45,6 +45,12 @@
|
||||
|
||||
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)
|
||||
: m_reconnectTimer(*ioService)
|
||||
{
|
||||
@@ -110,7 +116,7 @@ ServerLobbyBot::Run()
|
||||
if (m_ircLobbyThread) {
|
||||
// Initialise the reconnect timer.
|
||||
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(
|
||||
boost::bind(
|
||||
&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(
|
||||
boost::posix_time::seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
||||
seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
||||
m_reconnectTimer.async_wait(
|
||||
boost::bind(
|
||||
&ServerLobbyBot::Reconnect, shared_from_this(), boost::asio::placeholders::error));
|
||||
|
||||
@@ -95,6 +95,11 @@
|
||||
using namespace std;
|
||||
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
|
||||
{
|
||||
@@ -296,6 +301,7 @@ ServerLobbyThread::AddConnection(boost::shared_ptr<SessionData> sessionData)
|
||||
netAnnounce->set_latestbetarevision(POKERTH_BETA_REVISION);
|
||||
switch (GetServerMode()) {
|
||||
case SERVER_MODE_LAN:
|
||||
case SERVER_MODE_LAN_LOCAL:
|
||||
netAnnounce->set_servertype(AnnounceMessage::serverTypeLAN);
|
||||
break;
|
||||
case SERVER_MODE_INTERNET_NOAUTH:
|
||||
@@ -859,19 +865,19 @@ ServerLobbyThread::RegisterTimers()
|
||||
{
|
||||
// Remove closed games.
|
||||
m_removeGameTimer.expires_from_now(
|
||||
boost::posix_time::milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
||||
milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
||||
m_removeGameTimer.async_wait(
|
||||
boost::bind(
|
||||
&ServerLobbyThread::TimerRemoveGame, shared_from_this(), boost::asio::placeholders::error));
|
||||
// Update the statistics file.
|
||||
m_saveStatisticsTimer.expires_from_now(
|
||||
boost::posix_time::seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
||||
seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
||||
m_saveStatisticsTimer.async_wait(
|
||||
boost::bind(
|
||||
&ServerLobbyThread::TimerSaveStatisticsFile, shared_from_this(), boost::asio::placeholders::error));
|
||||
// Update the avatar upload locks.
|
||||
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(
|
||||
boost::bind(
|
||||
&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()->GetDBId(),
|
||||
GetGui(),
|
||||
m_serverConfig));
|
||||
m_serverConfig,
|
||||
m_mode));
|
||||
|
||||
game->Init();
|
||||
|
||||
// Add game to list of games.
|
||||
@@ -1689,8 +1697,7 @@ ServerLobbyThread::EstablishSession(boost::shared_ptr<SessionData> session)
|
||||
if (session->GetWebData()) {
|
||||
SessionError(session, ERR_NET_PLAYER_NAME_IN_USE);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// If this is not a websocket connection, disconnect the already connected player.
|
||||
InternalRemovePlayer(previousPlayerId, ERR_NET_PLAYER_NAME_IN_USE);
|
||||
}
|
||||
@@ -1860,7 +1867,7 @@ ServerLobbyThread::TimerRemoveGame(const boost::system::error_code &ec)
|
||||
}
|
||||
// Restart timer
|
||||
m_removeGameTimer.expires_from_now(
|
||||
boost::posix_time::milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
||||
milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
||||
m_removeGameTimer.async_wait(
|
||||
boost::bind(
|
||||
&ServerLobbyThread::TimerRemoveGame, shared_from_this(), boost::asio::placeholders::error));
|
||||
@@ -1885,7 +1892,7 @@ ServerLobbyThread::TimerUpdateClientLoginLock(const boost::system::error_code &e
|
||||
}
|
||||
// Restart timer
|
||||
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(
|
||||
boost::bind(
|
||||
&ServerLobbyThread::TimerUpdateClientLoginLock, shared_from_this(), boost::asio::placeholders::error));
|
||||
@@ -2232,7 +2239,7 @@ ServerLobbyThread::TimerSaveStatisticsFile(const boost::system::error_code &ec)
|
||||
}
|
||||
// Restart timer
|
||||
m_saveStatisticsTimer.expires_from_now(
|
||||
boost::posix_time::seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
||||
seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
||||
m_saveStatisticsTimer.async_wait(
|
||||
boost::bind(
|
||||
&ServerLobbyThread::TimerSaveStatisticsFile, shared_from_this(), boost::asio::placeholders::error));
|
||||
|
||||
@@ -41,6 +41,12 @@
|
||||
using namespace std;
|
||||
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)
|
||||
: 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),
|
||||
@@ -236,7 +242,7 @@ SessionData::TimerActivityWarning(const boost::system::error_code &ec)
|
||||
m_callback.SessionTimeoutWarning(shared_from_this(), m_activityWarningRemainingSec);
|
||||
|
||||
m_activityTimeoutTimer.expires_from_now(
|
||||
boost::posix_time::seconds(m_activityWarningRemainingSec));
|
||||
seconds(m_activityWarningRemainingSec));
|
||||
m_activityTimeoutTimer.async_wait(
|
||||
boost::bind(
|
||||
&SessionData::TimerSessionTimeout, shared_from_this(), boost::asio::placeholders::error));
|
||||
@@ -322,7 +328,7 @@ SessionData::ResetActivityTimer()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||
m_activityTimeoutTimer.expires_from_now(
|
||||
boost::posix_time::seconds(m_activityTimeoutSec - m_activityWarningRemainingSec));
|
||||
seconds(m_activityTimeoutSec - m_activityWarningRemainingSec));
|
||||
m_activityTimeoutTimer.async_wait(
|
||||
boost::bind(
|
||||
&SessionData::TimerActivityWarning, shared_from_this(), boost::asio::placeholders::error));
|
||||
@@ -333,7 +339,7 @@ SessionData::StartTimerInitTimeout(unsigned timeoutSec)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||
m_initTimeoutTimer.expires_from_now(
|
||||
boost::posix_time::seconds(timeoutSec));
|
||||
seconds(timeoutSec));
|
||||
m_initTimeoutTimer.async_wait(
|
||||
boost::bind(
|
||||
&SessionData::TimerInitTimeout, shared_from_this(), boost::asio::placeholders::error));
|
||||
@@ -344,7 +350,7 @@ SessionData::StartTimerGlobalTimeout(unsigned timeoutSec)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||
m_globalTimeoutTimer.expires_from_now(
|
||||
boost::posix_time::seconds(timeoutSec));
|
||||
seconds(timeoutSec));
|
||||
m_globalTimeoutTimer.async_wait(
|
||||
boost::bind(
|
||||
&SessionData::TimerSessionTimeout, shared_from_this(), boost::asio::placeholders::error));
|
||||
@@ -358,7 +364,7 @@ SessionData::StartTimerActivityTimeout(unsigned timeoutSec, unsigned warningRema
|
||||
m_activityWarningRemainingSec = warningRemainingSec;
|
||||
|
||||
m_activityTimeoutTimer.expires_from_now(
|
||||
boost::posix_time::seconds(timeoutSec - warningRemainingSec));
|
||||
seconds(timeoutSec - warningRemainingSec));
|
||||
m_activityTimeoutTimer.async_wait(
|
||||
boost::bind(
|
||||
&SessionData::TimerActivityWarning, shared_from_this(), boost::asio::placeholders::error));
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define _SERVERADMINBOT_H_
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <third_party/boost/timers.hpp>
|
||||
@@ -96,9 +97,9 @@ private:
|
||||
boost::shared_ptr<IrcThread> m_ircAdminThread;
|
||||
boost::timers::portable::second_timer m_notifyTimer;
|
||||
|
||||
boost::asio::deadline_timer m_reconnectTimer;
|
||||
boost::asio::deadline_timer m_notifyLoopTimer;
|
||||
boost::asio::deadline_timer m_checkFileTimer;
|
||||
boost::asio::steady_timer m_reconnectTimer;
|
||||
boost::asio::steady_timer m_notifyLoopTimer;
|
||||
boost::asio::steady_timer m_checkFileTimer;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <db/dbdefs.h>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
@@ -67,12 +68,12 @@ public:
|
||||
protected:
|
||||
|
||||
struct TimedPlayerBan {
|
||||
boost::shared_ptr<boost::asio::deadline_timer> timer;
|
||||
boost::shared_ptr<boost::asio::steady_timer> timer;
|
||||
std::string nameStr;
|
||||
boost::regex nameRegex;
|
||||
};
|
||||
struct TimedIPBan {
|
||||
boost::shared_ptr<boost::asio::deadline_timer> timer;
|
||||
boost::shared_ptr<boost::asio::steady_timer> timer;
|
||||
std::string ipAddress;
|
||||
};
|
||||
|
||||
@@ -81,8 +82,8 @@ protected:
|
||||
typedef std::list<boost::regex> RegexList;
|
||||
typedef std::vector<DB_id> DBPlayerIdList;
|
||||
|
||||
boost::shared_ptr<boost::asio::deadline_timer> InternalRegisterTimedBan(unsigned timerId, unsigned durationHours);
|
||||
void TimerRemoveBan(const boost::system::error_code &ec, unsigned banId, boost::shared_ptr<boost::asio::deadline_timer> timer);
|
||||
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::steady_timer> timer);
|
||||
|
||||
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_
|
||||
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <third_party/boost/timers.hpp>
|
||||
#include <map>
|
||||
|
||||
#include <net/sessionmanager.h>
|
||||
#include <net/serverdelaytime.h>
|
||||
#include <db/serverdbcallback.h>
|
||||
#include <gui/guiinterface.h>
|
||||
#include <gamedata.h>
|
||||
@@ -56,7 +58,7 @@ class ServerGame : public boost::enable_shared_from_this<ServerGame>
|
||||
public:
|
||||
ServerGame(
|
||||
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();
|
||||
|
||||
void Init();
|
||||
@@ -177,8 +179,8 @@ protected:
|
||||
ServerGameState &GetState();
|
||||
void SetState(ServerGameState &newState);
|
||||
|
||||
boost::asio::deadline_timer &GetStateTimer1();
|
||||
boost::asio::deadline_timer &GetStateTimer2();
|
||||
boost::asio::steady_timer &GetStateTimer1();
|
||||
boost::asio::steady_timer &GetStateTimer2();
|
||||
|
||||
const StartData &GetStartData() const;
|
||||
void SetStartData(const StartData &startData);
|
||||
@@ -190,6 +192,7 @@ protected:
|
||||
const SessionManager &GetSessionManager() const;
|
||||
SessionManager &GetSessionManager();
|
||||
ServerDBInterface &GetDatabase();
|
||||
const ServerDelayTime GetServerDelayTime() const;
|
||||
|
||||
private:
|
||||
ServerGame(const ServerGame &other);
|
||||
@@ -225,6 +228,8 @@ private:
|
||||
boost::shared_ptr<ServerDBInterface> m_database;
|
||||
GuiInterface &m_gui;
|
||||
|
||||
ServerDelayTime m_serverDelayTime;
|
||||
|
||||
const GameData m_gameData;
|
||||
StartData m_startData;
|
||||
boost::shared_ptr<Game> m_game;
|
||||
@@ -237,9 +242,9 @@ private:
|
||||
ConfigFile &m_playerConfig;
|
||||
unsigned m_gameNum;
|
||||
unsigned m_curPetitionId;
|
||||
boost::asio::deadline_timer m_voteKickTimer;
|
||||
boost::asio::deadline_timer m_stateTimer1;
|
||||
boost::asio::deadline_timer m_stateTimer2;
|
||||
boost::asio::steady_timer m_voteKickTimer;
|
||||
boost::asio::steady_timer m_stateTimer1;
|
||||
boost::asio::steady_timer m_stateTimer2;
|
||||
bool m_isNameReported;
|
||||
|
||||
friend class ServerLobbyThread;
|
||||
@@ -251,6 +256,7 @@ private:
|
||||
friend class ServerGameStateHand;
|
||||
friend class ServerGameStateWaitPlayerAction;
|
||||
friend class ServerGameStateWaitNextHand;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -34,6 +34,7 @@
|
||||
#define _SERVERLOBBYBOT_H_
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <string>
|
||||
#include <list>
|
||||
@@ -86,7 +87,7 @@ private:
|
||||
boost::shared_ptr<ServerLobbyThread> m_lobbyThread;
|
||||
boost::shared_ptr<IrcThread> m_ircLobbyThread;
|
||||
|
||||
boost::asio::deadline_timer m_reconnectTimer;
|
||||
boost::asio::steady_timer m_reconnectTimer;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -34,6 +34,7 @@
|
||||
#define _SERVERLOBBYTHREAD_H_
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/uuid/uuid_generators.hpp>
|
||||
|
||||
@@ -268,9 +269,9 @@ private:
|
||||
boost::shared_ptr<ChatCleanerManager> m_chatCleanerManager;
|
||||
boost::shared_ptr<ServerDBInterface> m_database;
|
||||
|
||||
boost::asio::deadline_timer m_removeGameTimer;
|
||||
boost::asio::deadline_timer m_saveStatisticsTimer;
|
||||
boost::asio::deadline_timer m_loginLockTimer;
|
||||
boost::asio::steady_timer m_removeGameTimer;
|
||||
boost::asio::steady_timer m_saveStatisticsTimer;
|
||||
boost::asio::steady_timer m_loginLockTimer;
|
||||
|
||||
boost::uuids::random_generator m_sessionIdGenerator;
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
typedef unsigned SessionId;
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <string>
|
||||
@@ -144,9 +145,9 @@ private:
|
||||
bool m_wantsLobbyMsg;
|
||||
unsigned m_activityTimeoutSec;
|
||||
unsigned m_activityWarningRemainingSec;
|
||||
boost::asio::deadline_timer m_initTimeoutTimer;
|
||||
boost::asio::deadline_timer m_globalTimeoutTimer;
|
||||
boost::asio::deadline_timer m_activityTimeoutTimer;
|
||||
boost::asio::steady_timer m_initTimeoutTimer;
|
||||
boost::asio::steady_timer m_globalTimeoutTimer;
|
||||
boost::asio::steady_timer m_activityTimeoutTimer;
|
||||
SessionDataCallback &m_callback;
|
||||
Gsasl_session *m_authSession;
|
||||
int m_curAuthStep;
|
||||
|
||||
@@ -61,6 +61,8 @@
|
||||
#define ERR_SOCK_TRANSFER_INVALID_URL 26
|
||||
#define ERR_SOCK_TRANSFER_SELECT_FAILED 27
|
||||
#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.
|
||||
#define ERR_NET_VERSION_NOT_SUPPORTED 101
|
||||
#define ERR_NET_SERVER_MAINTENANCE 102
|
||||
|
||||
@@ -75,6 +75,13 @@
|
||||
#define ENABLE_LEAK_CHECK()
|
||||
#endif
|
||||
|
||||
// #ifdef ANDROID
|
||||
// #ifndef ANDROID_TEST
|
||||
// // #include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
// // #include <jni.h>
|
||||
// #endif
|
||||
// #endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
class startWindowImpl;
|
||||
@@ -246,6 +253,29 @@ int main( int argc, char **argv )
|
||||
|
||||
startWindowImpl mainWin(myConfig,myLog);
|
||||
#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();
|
||||
#else
|
||||
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) {
|
||||
assert(false);
|
||||
@@ -325,7 +325,8 @@ void Session::startNetworkServer(bool dedicated)
|
||||
mode = SERVER_MODE_INTERNET_NOAUTH;
|
||||
#endif
|
||||
} 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);
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ public:
|
||||
void clientJoinGame(unsigned gameId, const std::string &password);
|
||||
void clientRejoinGame(unsigned gameId);
|
||||
|
||||
void startNetworkServer(bool dedicated);
|
||||
void startNetworkServer(bool dedicated, bool lan_local = false);
|
||||
void sendLeaveCurrentGame();
|
||||
void sendStartEvent(bool fillUpWithCpuPlayers);
|
||||
void terminateNetworkServer();
|
||||
|
||||
Reference in new issue
Block a user