session boost_ptr refactoring

This commit is contained in:
doitux
2008-10-07 21:16:27 +00:00
parent 13cc3d5aeb
commit de6228bb7d
18 changed files with 138 additions and 144 deletions
+2 -2
View File
@@ -35,10 +35,10 @@ ServerGuiWrapper::~ServerGuiWrapper()
void ServerGuiWrapper::initGui(int /*speed*/) {}
Session &ServerGuiWrapper::getSession()
boost::shared_ptr<Session> ServerGuiWrapper::getSession()
{
assert(mySession.get());
return *mySession;
return mySession;
}
void ServerGuiWrapper::setSession(boost::shared_ptr<Session> session)
+1 -1
View File
@@ -33,7 +33,7 @@ public:
void initGui(int speed);
Session &getSession();
boost::shared_ptr<Session> getSession();
void setSession(boost::shared_ptr<Session> session);
gameTableImpl* getMyW() const {return NULL;}
+1 -1
View File
@@ -37,7 +37,7 @@ public:
virtual void initGui(int speed) =0;
virtual Session &getSession() =0;
virtual boost::shared_ptr<Session> getSession() =0;
virtual void setSession(boost::shared_ptr<Session> session) =0;
virtual gameTableImpl *getMyW() const=0;
+3 -2
View File
@@ -23,6 +23,7 @@
#include <string>
#include <QtCore>
#include <QtGui>
#include <boost/shared_ptr.hpp>
class Session;
class ConfigFile;
@@ -36,7 +37,7 @@ public:
~ChatTools();
void setSession(Session *session) { mySession = session; }
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
public slots:
@@ -67,7 +68,7 @@ private:
QTreeWidget *myNickTreeWidget;
QStringList myNickStringList;
QTextBrowser *myTextBrowser;
Session *mySession;
boost::shared_ptr<Session> mySession;
int myNotifyMode; // 0 == no notification, 1 == bold notification, 2 == yellow notification
ConfigFile *myConfig;
@@ -19,7 +19,7 @@
#include <net/socket_msg.h>
gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), mySession(NULL), currentGameName(""), myPlayerId(0), isAdmin(false), inGame(false), myChat(NULL), keyUpCounter(0)
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), isAdmin(false), inGame(false), myChat(NULL), keyUpCounter(0)
{
#ifdef __APPLE__
@@ -87,11 +87,6 @@ gameLobbyDialogImpl::~gameLobbyDialogImpl()
}
void gameLobbyDialogImpl::setSession(Session *session)
{
mySession = session;
}
void gameLobbyDialogImpl::createGame()
{
assert(mySession);
@@ -43,8 +43,8 @@ public:
LobbyChat *getLobbyChat() { return myChat; }
void setSession(Session *session);
Session& getSession() { return *mySession; }
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
boost::shared_ptr<Session> getSession() { assert(mySession.get()); return mySession; }
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
@@ -110,7 +110,7 @@ private:
gameTableImpl* myW;
startWindowImpl* myStartWindow;
ConfigFile *myConfig;
Session *mySession;
boost::shared_ptr<Session> mySession;
createInternetGameDialogImpl *myCreateInternetGameDialog;
QString currentGameName;
unsigned myPlayerId;
@@ -48,7 +48,7 @@ void LobbyChat::sendMessage() {
QString tmpMsg(myLobby->lineEdit_ChatInput->text());
if (tmpMsg.size())
{
myLobby->getSession().sendIrcChatMessage(tmpMsg.toUtf8().constData());
myLobby->getSession()->sendIrcChatMessage(tmpMsg.toUtf8().constData());
myLobby->lineEdit_ChatInput->setText("");
displayMessage(myNick, tmpMsg);
+4 -4
View File
@@ -50,13 +50,13 @@ void Chat::sendMessage() {
playerToKick.remove(0, sizeof(COMMAND_KICK_STR) - 1);
myW->lineEdit_ChatInput->setText("");
if(myW->getSession().getClientGameInfo(myW->getSession().getClientCurrentGameId()).adminPlayerId == myW->getSession().getCurrentGame()->getSeatsList()->front()->getMyUniqueID()) {
if(myW->getSession()->getClientGameInfo(myW->getSession()->getClientCurrentGameId()).adminPlayerId == myW->getSession()->getCurrentGame()->getSeatsList()->front()->getMyUniqueID()) {
if(playerToKick.toUtf8().constData() == myW->getSession().getCurrentGame()->getSeatsList()->front()->getMyName()) {
if(playerToKick.toUtf8().constData() == myW->getSession()->getCurrentGame()->getSeatsList()->front()->getMyName()) {
myW->textBrowser_Chat->append("<span style=\"color:#ff0000;\">"+tr("You cannot kick yourself!")+"</span>");
}
else {
myW->getSession().kickPlayer(playerToKick.toUtf8().constData());
myW->getSession()->kickPlayer(playerToKick.toUtf8().constData());
}
}
else {
@@ -66,7 +66,7 @@ void Chat::sendMessage() {
}
fillChatLinesHistory(myW->lineEdit_ChatInput->text());
myW->getSession().sendChatMessage(myW->lineEdit_ChatInput->text().toUtf8().constData());
myW->getSession()->sendChatMessage(myW->lineEdit_ChatInput->text().toUtf8().constData());
myW->lineEdit_ChatInput->setText("");
}
+94 -96
View File
@@ -597,12 +597,12 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) {
else { groupBox_RightToolBox->hide(); }
//Add avatar (if set)
mySession->addOwnAvatar(myConfig->readConfigString("MyAvatar"));
myStartWindow->getSession()->addOwnAvatar(myConfig->readConfigString("MyAvatar"));
//Falls Spielernamen geändert wurden --> neu zeichnen --> erst beim nächsten Neustart neu ausgelesen
if (mySettingsDialog->getPlayerNickIsChanged() && mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) {
if (mySettingsDialog->getPlayerNickIsChanged() && myStartWindow->getSession()->getCurrentGame() && !myStartWindow->getSession()->isNetworkClientRunning()) {
Game *currentGame = mySession->getCurrentGame();
Game *currentGame = myStartWindow->getSession()->getCurrentGame();
PlayerListIterator it = currentGame->getSeatsList()->begin();
(*it)->setMyName(mySettingsDialog->lineEdit_HumanPlayerName->text().toUtf8().constData());
(*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent1Name->text().toUtf8().constData());
@@ -616,9 +616,9 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) {
refreshPlayerName();
}
if(mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) {
if(myStartWindow->getSession()->getCurrentGame() && !myStartWindow->getSession()->isNetworkClientRunning()) {
Game *currentGame = mySession->getCurrentGame();
Game *currentGame = myStartWindow->getSession()->getCurrentGame();
PlayerListIterator it = currentGame->getSeatsList()->begin();
(*it)->setMyAvatar(mySettingsDialog->pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData());
(*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent1Avatar->getMyLink().toUtf8().constData());
@@ -644,11 +644,11 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) {
}
//Check for anti-peek mode
if(mySession->getCurrentGame()) {
if(myStartWindow->getSession()->getCurrentGame()) {
QPixmap tempCardsPixmapArray[2];
int tempCardsIntArray[2];
mySession->getCurrentGame()->getSeatsList()->front()->getMyCards(tempCardsIntArray);
myStartWindow->getSession()->getCurrentGame()->getSeatsList()->front()->getMyCards(tempCardsIntArray);
if(myConfig->readConfigInt("AntiPeekMode")) {
holeCardsArray[0][0]->setPixmap(*flipside, TRUE);
tempCardsPixmapArray[0] = QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[0], 10)+".png"));
@@ -665,7 +665,7 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) {
}
}
if(mySession->getCurrentGame()) {
if(myStartWindow->getSession()->getCurrentGame()) {
//blind buttons refresh
refreshButton();
}
@@ -703,7 +703,7 @@ void gameTableImpl::initGui(int speed)
}
//set speeds for local game and for first network game
if( !mySession->isNetworkClientRunning() || (mySession->isNetworkClientRunning() && !mySession->getCurrentGame()) ) {
if( !myStartWindow->getSession()->isNetworkClientRunning() || (myStartWindow->getSession()->isNetworkClientRunning() && !myStartWindow->getSession()->getCurrentGame()) ) {
guiGameSpeed = speed;
//positioning Slider
@@ -712,14 +712,14 @@ void gameTableImpl::initGui(int speed)
}
}
Session &gameTableImpl::getSession() { assert(mySession.get()); return *mySession; }
void gameTableImpl::setSession(boost::shared_ptr<Session> session) { mySession = session; }
boost::shared_ptr<Session> gameTableImpl::getSession() { assert(myStartWindow->getSession().get()); return myStartWindow->getSession(); }
// void gameTableImpl::setSession(boost::shared_ptr<Session> session) { mySession = session; }
//refresh-Funktionen
void gameTableImpl::refreshSet() {
Game *currentGame = mySession->getCurrentGame();
Game *currentGame = myStartWindow->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
@@ -728,8 +728,6 @@ void gameTableImpl::refreshSet() {
else
setLabelArray[(*it_c)->getMyID()]->setText("Bet: $"+QString::number((*it_c)->getMySet(),10));
}
}
void gameTableImpl::refreshButton() {
@@ -739,7 +737,7 @@ void gameTableImpl::refreshButton() {
QPixmap bigblindButton = QPixmap::fromImage(QImage(myAppDataPath +"gfx/gui/table/default/bigblindPuck.png"));
QPixmap onePix = QPixmap::fromImage(QImage(myAppDataPath +"gfx/gui/misc/1px.png"));
Game *currentGame = mySession->getCurrentGame();
Game *currentGame = myStartWindow->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
@@ -794,7 +792,7 @@ void gameTableImpl::refreshButton() {
void gameTableImpl::refreshPlayerName() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
@@ -812,7 +810,7 @@ void gameTableImpl::refreshPlayerAvatar() {
QPixmap onePix = QPixmap::fromImage(QImage(myAppDataPath +"gfx/gui/misc/1px.png"));
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
@@ -833,9 +831,9 @@ void gameTableImpl::refreshPlayerAvatar() {
void gameTableImpl::setPlayerAvatar(int myID, QString myAvatar) {
if(mySession->getCurrentGame()) {
if(myStartWindow->getSession()->getCurrentGame()) {
boost::shared_ptr<PlayerInterface> tmpPlayer = mySession->getCurrentGame()->getPlayerByUniqueId(myID);
boost::shared_ptr<PlayerInterface> tmpPlayer = myStartWindow->getSession()->getCurrentGame()->getPlayerByUniqueId(myID);
if (tmpPlayer.get()) {
if(QFile::QFile(myAvatar).exists()) {
@@ -859,7 +857,7 @@ void gameTableImpl::refreshAction(int playerID, int playerAction) {
QStringList actionArray;
actionArray << "" << "fold" << "check" << "call" << "bet" << "raise" << "allin";
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
if(playerID == -1 || playerAction == -1) {
@@ -915,7 +913,7 @@ void gameTableImpl::refreshAction(int playerID, int playerAction) {
void gameTableImpl::refreshCash() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
@@ -937,7 +935,7 @@ void gameTableImpl::refreshGroupbox(int playerID, int status) {
if(playerID == -1 || status == -1) {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
@@ -1065,8 +1063,8 @@ void gameTableImpl::refreshGameLabels(int gameState) {
}
}
label_handNumberValue->setText(QString::number(mySession->getCurrentGame()->getCurrentHand()->getMyID(),10));
label_gameNumberValue->setText(QString::number(mySession->getCurrentGame()->getMyGameID(),10));
label_handNumberValue->setText(QString::number(myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getMyID(),10));
label_gameNumberValue->setText(QString::number(myStartWindow->getSession()->getCurrentGame()->getMyGameID(),10));
}
void gameTableImpl::refreshAll() {
@@ -1074,7 +1072,7 @@ void gameTableImpl::refreshAll() {
refreshSet();
refreshButton();
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
refreshAction( (*it_c)->getMyID(), (*it_c)->getMyAction());
@@ -1090,7 +1088,7 @@ void gameTableImpl::refreshChangePlayer() {
refreshSet();
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
refreshAction( (*it_c)->getMyID(), (*it_c)->getMyAction());
@@ -1100,7 +1098,7 @@ void gameTableImpl::refreshChangePlayer() {
}
void gameTableImpl::refreshPot() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
textLabel_Sets->setText("$"+QString::number(currentHand->getBoard()->getSets(),10));
textLabel_Pot->setText("$"+QString::number(currentHand->getBoard()->getPot(),10));
@@ -1124,7 +1122,7 @@ void gameTableImpl::dealHoleCards() {
// Karten der Gegner und eigene Karten austeilen
int j;
Game *currentGame = mySession->getCurrentGame();
Game *currentGame = myStartWindow->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
for(it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
@@ -1207,7 +1205,7 @@ void gameTableImpl::dealFlopCards4() {
int tempBoardCardsArray[5];
mySession->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
QPixmap card = QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempBoardCardsArray[0], 10)+".png"));
//Config? mit oder ohne Eye-Candy?
@@ -1225,7 +1223,7 @@ void gameTableImpl::dealFlopCards4() {
void gameTableImpl::dealFlopCards5() {
int tempBoardCardsArray[5];
mySession->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
QPixmap card = QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempBoardCardsArray[1], 10)+".png"));
//Config? mit oder ohne Eye-Candy?
@@ -1243,7 +1241,7 @@ void gameTableImpl::dealFlopCards5() {
void gameTableImpl::dealFlopCards6() {
int tempBoardCardsArray[5];
mySession->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
QPixmap card = QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempBoardCardsArray[2], 10)+".png"));
//Config? mit oder ohne Eye-Candy?
@@ -1258,7 +1256,7 @@ void gameTableImpl::dealFlopCards6() {
// stable
// wenn alle All In
if(mySession->getCurrentGame()->getCurrentHand()->getAllInCondition()) { dealFlopCards6Timer->start(AllInDealCardsSpeed); }
if(myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getAllInCondition()) { dealFlopCards6Timer->start(AllInDealCardsSpeed); }
// sonst normale Variante
else {
updateMyButtonsState(0); //mode 0 == called from dealberocards
@@ -1277,7 +1275,7 @@ void gameTableImpl::dealTurnCards1() {
void gameTableImpl::dealTurnCards2() {
int tempBoardCardsArray[5];
mySession->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
QPixmap card = QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempBoardCardsArray[3], 10)+".png"));
//Config? mit oder ohne Eye-Candy?
@@ -1292,7 +1290,7 @@ void gameTableImpl::dealTurnCards2() {
// stable
// wenn alle All In
if(mySession->getCurrentGame()->getCurrentHand()->getAllInCondition()) { dealTurnCards2Timer->start(AllInDealCardsSpeed);
if(myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getAllInCondition()) { dealTurnCards2Timer->start(AllInDealCardsSpeed);
}
// sonst normale Variante
else {
@@ -1315,7 +1313,7 @@ void gameTableImpl::dealRiverCards1() {
void gameTableImpl::dealRiverCards2() {
int tempBoardCardsArray[5];
mySession->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
QPixmap card = QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempBoardCardsArray[4], 10)+".png"));
//Config? mit oder ohne Eye-Candy?
@@ -1330,7 +1328,7 @@ void gameTableImpl::dealRiverCards2() {
// stable
// wenn alle All In
if(mySession->getCurrentGame()->getCurrentHand()->getAllInCondition()) { dealRiverCards2Timer->start(AllInDealCardsSpeed); }
if(myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getAllInCondition()) { dealRiverCards2Timer->start(AllInDealCardsSpeed); }
// sonst normale Variante
else {
updateMyButtonsState(0); //mode 0 == called from dealberocards
@@ -1347,7 +1345,7 @@ void gameTableImpl::provideMyActions(int mode) {
QString lastPushButtonCallCheckString = pushButton_CallCheck->text();
Game *currentGame = mySession->getCurrentGame();
Game *currentGame = myStartWindow->getSession()->getCurrentGame();
HandInterface *currentHand = currentGame->getCurrentHand();
// cout << "provideMyActions get myAction" << currentHand->getSeatsList()->front()->getMyAction() << endl;
@@ -1476,12 +1474,12 @@ void gameTableImpl::provideMyActions(int mode) {
resetMyButtonsCheckStateMemory();
}
if((mySession->getGameType() == Session::GAME_TYPE_INTERNET || mySession->getGameType() == Session::GAME_TYPE_NETWORK) && !lineEdit_ChatInput->hasFocus() && myConfig->readConfigInt("EnableBetInputFocusSwitch")) {
if((myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) && !lineEdit_ChatInput->hasFocus() && myConfig->readConfigInt("EnableBetInputFocusSwitch")) {
lineEdit_betValue->setFocus();
lineEdit_betValue->selectAll();
}
if(mySession->getGameType() == Session::GAME_TYPE_LOCAL) {
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) {
lineEdit_betValue->setFocus();
lineEdit_betValue->selectAll();
}
@@ -1496,7 +1494,7 @@ void gameTableImpl::meInAction() {
horizontalSlider_bet->setEnabled(TRUE);
lineEdit_betValue->setEnabled(TRUE);
if((mySession->getGameType() == Session::GAME_TYPE_INTERNET || mySession->getGameType() == Session::GAME_TYPE_NETWORK) && lineEdit_ChatInput->text() == "" && myConfig->readConfigInt("EnableBetInputFocusSwitch")) {
if((myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) && lineEdit_ChatInput->text() == "" && myConfig->readConfigInt("EnableBetInputFocusSwitch")) {
lineEdit_betValue->setFocus();
lineEdit_betValue->selectAll();
}
@@ -1549,7 +1547,7 @@ void gameTableImpl::meInAction() {
}
void gameTableImpl::startTimeoutAnimation(int playerId, int timeoutSec) {
assert(playerId >= 0 && playerId < mySession->getCurrentGame()->getStartQuantityPlayers());
assert(playerId >= 0 && playerId < myStartWindow->getSession()->getCurrentGame()->getStartQuantityPlayers());
//beep for player 0
if(playerId) { setLabelArray[playerId]->startTimeOutAnimation(timeoutSec, FALSE); }
@@ -1557,13 +1555,13 @@ void gameTableImpl::startTimeoutAnimation(int playerId, int timeoutSec) {
}
void gameTableImpl::stopTimeoutAnimation(int playerId) {
assert(playerId >= 0 && playerId < mySession->getCurrentGame()->getStartQuantityPlayers());
assert(playerId >= 0 && playerId < myStartWindow->getSession()->getCurrentGame()->getStartQuantityPlayers());
setLabelArray[playerId]->stopTimeOutAnimation();
}
void gameTableImpl::disableMyButtons() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
clearMyButtons();
@@ -1593,7 +1591,7 @@ void gameTableImpl::myFold(){
if(pushButton_Fold->text() == "Fold") {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
currentHand->getSeatsList()->front()->setMyAction(1);
currentHand->getSeatsList()->front()->setMyTurn(0);
@@ -1608,7 +1606,7 @@ void gameTableImpl::myFold(){
}
void gameTableImpl::myCheck() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
currentHand->getSeatsList()->front()->setMyTurn(0);
currentHand->getSeatsList()->front()->setMyAction(2);
@@ -1624,7 +1622,7 @@ void gameTableImpl::myCheck() {
int gameTableImpl::getMyCallAmount() {
int tempHighestSet = 0;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
tempHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
@@ -1650,7 +1648,7 @@ int gameTableImpl::getBetRaisePushButtonValue() {
int gameTableImpl::getMyBetAmount() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
int betValue = getBetRaisePushButtonValue();
int minimum;
@@ -1668,7 +1666,7 @@ int gameTableImpl::getMyBetAmount() {
void gameTableImpl::myCall(){
int tempHighestSet = 0;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
tempHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
@@ -1700,7 +1698,7 @@ void gameTableImpl::mySet(){
if(pushButton_BetRaise->text() != "") {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
int tempCash = currentHand->getSeatsList()->front()->getMyCash();
// cout << "Set-Value " << getBetRaisePushButtonValue() << endl;
@@ -1752,7 +1750,7 @@ void gameTableImpl::mySet(){
void gameTableImpl::myAllIn(){
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash());
currentHand->getSeatsList()->front()->setMyCash(0);
@@ -1892,12 +1890,12 @@ void gameTableImpl::myActionDone() {
// If a network client is running, we need
// to transfer the action to the server.
mySession->sendClientPlayerAction();
myStartWindow->getSession()->sendClientPlayerAction();
// TODO: Should not call in networking game.
disableMyButtons();
if (!mySession->isNetworkClientRunning())
if (!myStartWindow->getSession()->isNetworkClientRunning())
nextPlayerAnimation();
//prevent escape button working while allIn
@@ -1907,7 +1905,7 @@ void gameTableImpl::myActionDone() {
void gameTableImpl::nextPlayerAnimation() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
//refresh Change Player
refreshSet();
@@ -1946,32 +1944,32 @@ void gameTableImpl::beRoAnimation2(int myBeRoID) {
void gameTableImpl::preflopAnimation1() { preflopAnimation1Timer->start(nextPlayerSpeed2); }
void gameTableImpl::preflopAnimation1Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
void gameTableImpl::preflopAnimation1Action() { myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
void gameTableImpl::preflopAnimation2() { preflopAnimation2Timer->start(preflopNextPlayerSpeed); }
void gameTableImpl::preflopAnimation2Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
void gameTableImpl::preflopAnimation2Action() { myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
void gameTableImpl::flopAnimation1() { flopAnimation1Timer->start(nextPlayerSpeed2); }
void gameTableImpl::flopAnimation1Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
void gameTableImpl::flopAnimation1Action() { myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
void gameTableImpl::flopAnimation2() { flopAnimation2Timer->start(nextPlayerSpeed3); }
void gameTableImpl::flopAnimation2Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
void gameTableImpl::flopAnimation2Action() { myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
void gameTableImpl::turnAnimation1() { turnAnimation1Timer->start(nextPlayerSpeed2); }
void gameTableImpl::turnAnimation1Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
void gameTableImpl::turnAnimation1Action() { myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
void gameTableImpl::turnAnimation2() { turnAnimation2Timer->start(nextPlayerSpeed3); }
void gameTableImpl::turnAnimation2Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
void gameTableImpl::turnAnimation2Action() { myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
void gameTableImpl::riverAnimation1() { riverAnimation1Timer->start(nextPlayerSpeed2); }
void gameTableImpl::riverAnimation1Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
void gameTableImpl::riverAnimation1Action() { myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
void gameTableImpl::riverAnimation2() { riverAnimation2Timer->start(nextPlayerSpeed3); }
void gameTableImpl::riverAnimation2Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
void gameTableImpl::riverAnimation2Action() { myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
void gameTableImpl::postRiverAnimation1() { postRiverAnimation1Timer->start(nextPlayerSpeed2); }
void gameTableImpl::postRiverAnimation1Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->postRiverRun(); }
void gameTableImpl::postRiverAnimation1Action() { myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->postRiverRun(); }
void gameTableImpl::postRiverRunAnimation1() { postRiverRunAnimation1Timer->start(postRiverRunAnimationSpeed); }
@@ -1986,7 +1984,7 @@ void gameTableImpl::postRiverRunAnimation2() {
horizontalSlider_bet->setDisabled(TRUE);
lineEdit_betValue->setDisabled(TRUE);
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
int nonfoldPlayersCounter = 0;
PlayerListConstIterator it_c;
@@ -2076,7 +2074,7 @@ void gameTableImpl::postRiverRunAnimation2() {
// TODO
void gameTableImpl::postRiverRunAnimation2_flipHoleCards1() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
currentHand->getCurrentBeRo()->setPlayersTurn(currentHand->getCurrentBeRo()->getLastActionPlayer());
@@ -2097,7 +2095,7 @@ void gameTableImpl::postRiverRunAnimation2_flipHoleCards2() {
void gameTableImpl::postRiverRunAnimation3() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
//Alle Winner erhellen und "Winner" schreiben
int nonfoldPlayerCounter = 0;
@@ -2230,7 +2228,7 @@ void gameTableImpl::postRiverRunAnimation4() {
void gameTableImpl::postRiverRunAnimation5() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
@@ -2269,14 +2267,14 @@ void gameTableImpl::postRiverRunAnimation5() {
void gameTableImpl::postRiverRunAnimation6() {
// int i;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
refreshCash();
refreshPot();
// TODO HACK
// Check for network client, do not start new hand if client is running.
if (mySession->isNetworkClientRunning())
if (myStartWindow->getSession()->isNetworkClientRunning())
return;
// wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen
@@ -2293,13 +2291,13 @@ void gameTableImpl::postRiverRunAnimation6() {
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
if ((*it_c)->getMyCash() > 0) {
currentHand->getGuiInterface()->logPlayerWinGame((*it_c)->getMyName(), mySession->getCurrentGame()->getMyGameID());
currentHand->getGuiInterface()->logPlayerWinGame((*it_c)->getMyName(), myStartWindow->getSession()->getCurrentGame()->getMyGameID());
}
}
if( !DEBUG_MODE ) {
if(mySession->getGameType() == Session::GAME_TYPE_LOCAL) {
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) {
currentGameOver = TRUE;
pushButton_break->setDisabled(FALSE);
QFontMetrics tempMetrics = this->fontMetrics();
@@ -2321,7 +2319,7 @@ void gameTableImpl::postRiverRunAnimation6() {
void gameTableImpl::flipHolecardsAllIn() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
if(!flipHolecardsAllInAlreadyDone) {
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
@@ -2393,7 +2391,7 @@ void gameTableImpl::showMyCards() {
//TempArrays
int tempCardsIntArray[2];
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
currentHand->getSeatsList()->front()->getMyCards(tempCardsIntArray);
if( currentHand->getSeatsList()->front()->getMyCardsFlip() == 0 && currentHand->getCurrentRound() == 4 && currentHand->getSeatsList()->front()->getMyActiveStatus() && currentHand->getSeatsList()->front()->getMyAction() != PLAYER_ACTION_FOLD) {
@@ -2407,12 +2405,12 @@ void gameTableImpl::showMyCards() {
void gameTableImpl::startNewHand() {
if( !breakAfterCurrentHand){
mySession->getCurrentGame()->initHand();
mySession->getCurrentGame()->startHand();
myStartWindow->getSession()->getCurrentGame()->initHand();
myStartWindow->getSession()->getCurrentGame()->startHand();
}
else {
if(mySession->getGameType() == Session::GAME_TYPE_LOCAL) {
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) {
pushButton_break->setDisabled(FALSE);
QFontMetrics tempMetrics = this->fontMetrics();
@@ -2427,7 +2425,7 @@ void gameTableImpl::startNewHand() {
}
}
void gameTableImpl::handSwitchRounds() { mySession->getCurrentGame()->getCurrentHand()->switchRounds();
void gameTableImpl::handSwitchRounds() { myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->switchRounds();
}
void gameTableImpl::nextRoundCleanGui() {
@@ -2448,7 +2446,7 @@ void gameTableImpl::nextRoundCleanGui() {
}
// for startNewGame during human player is active
if(mySession->getCurrentGame()->getCurrentHand()->getSeatsList()->front()->getMyActiveStatus() == 1) {
if(myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getSeatsList()->front()->getMyActiveStatus() == 1) {
disableMyButtons();
}
@@ -2459,7 +2457,7 @@ void gameTableImpl::nextRoundCleanGui() {
flipHolecardsAllInAlreadyDone = FALSE;
//Wenn Pause zwischen den Hands in der Konfiguration steht den Stop Button drücken!
if (myConfig->readConfigInt("PauseBetweenHands") && blinkingStartButtonAnimationTimer->isActive() == FALSE && mySession->getGameType() == Session::GAME_TYPE_LOCAL) {
if (myConfig->readConfigInt("PauseBetweenHands") && blinkingStartButtonAnimationTimer->isActive() == FALSE && myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) {
pushButton_break->click();
}
else {
@@ -2469,7 +2467,7 @@ void gameTableImpl::nextRoundCleanGui() {
}
//Clean breakbutton
if(mySession->getGameType() == Session::GAME_TYPE_LOCAL) {
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) {
blinkingStartButtonAnimationTimer->stop();
pushButton_break->setStyleSheet("QPushButton { background-color: #145300; color: #99D500;}");
blinkingStartButtonAnimationTimer->stop();
@@ -2620,7 +2618,7 @@ void gameTableImpl::keyPressEvent ( QKeyEvent * event ) {
if (event->key() == Qt::Key_F6) { radioButton_autoCheckFold->click(); }
if (event->key() == Qt::Key_F7) { radioButton_autoCheckCallAny->click(); }
if (event->key() == 16777249) { //CTRL
if(mySession->getGameType() == Session::GAME_TYPE_LOCAL) {
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) {
pushButton_break->click();
ctrlPressed = TRUE;
}
@@ -2817,14 +2815,14 @@ void gameTableImpl::networkGameModification() {
tabWidget_Left->setCurrentIndex(1);
myChat->clearNewGame();
if(mySession->getGameType() == Session::GAME_TYPE_INTERNET) {
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET) {
pushButton_break->show();
QFontMetrics tempMetrics = this->fontMetrics();
int width = tempMetrics.width(tr("Lobby"));
pushButton_break->setText(tr("Lobby"));
pushButton_break->setMinimumSize(width+10,20);
}
if(mySession->getGameType() == Session::GAME_TYPE_NETWORK) {
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) {
pushButton_break->hide();
}
@@ -2837,8 +2835,8 @@ void gameTableImpl::networkGameModification() {
void gameTableImpl::mouseOverFlipCards(bool front) {
if(mySession->getCurrentGame()) {
if(myConfig->readConfigInt("AntiPeekMode") && mySession->getCurrentGame()->getCurrentHand()->getSeatsList()->front()->getMyActiveStatus() && mySession->getCurrentGame()->getSeatsList()->front()->getMyAction() != PLAYER_ACTION_FOLD) {
if(myStartWindow->getSession()->getCurrentGame()) {
if(myConfig->readConfigInt("AntiPeekMode") && myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getSeatsList()->front()->getMyActiveStatus() && myStartWindow->getSession()->getCurrentGame()->getSeatsList()->front()->getMyAction() != PLAYER_ACTION_FOLD) {
holeCardsArray[0][0]->signalFastFlipCards(front);
holeCardsArray[0][1]->signalFastFlipCards(front);
}
@@ -2847,14 +2845,14 @@ void gameTableImpl::mouseOverFlipCards(bool front) {
void gameTableImpl::updateMyButtonsState(int mode) {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
if(currentHand->getLastPlayersTurn() == 0) {
myButtonsCheckable(FALSE);
clearMyButtons();
}
else {
if(mySession->getCurrentGame()->getSeatsList()->front()->getMyAction() != PLAYER_ACTION_ALLIN) { // dont show pre-actions after flip cards when allin
if(myStartWindow->getSession()->getCurrentGame()->getSeatsList()->front()->getMyAction() != PLAYER_ACTION_ALLIN) { // dont show pre-actions after flip cards when allin
myButtonsCheckable(TRUE);
provideMyActions(mode);
}
@@ -2937,21 +2935,21 @@ void gameTableImpl::showMaximized () {
void gameTableImpl::closeGameTable() {
if (myServerGuiInterface.get() && myServerGuiInterface->getSession().isNetworkServerRunning()) {
if (myServerGuiInterface.get() && myServerGuiInterface->getSession()->isNetworkServerRunning()) {
QMessageBox msgBox(QMessageBox::Warning, tr("Closing PokerTH during network game"),
tr("You are the hosting server. Do you want to close PokerTH anyway?"), QMessageBox::Yes | QMessageBox::No, this);
if (msgBox.exec() == QMessageBox::Yes ) {
mySession->terminateNetworkClient();
myStartWindow->getSession()->terminateNetworkClient();
stopTimer();
if (myServerGuiInterface.get()) myServerGuiInterface->getSession().terminateNetworkServer();
if (myServerGuiInterface.get()) myServerGuiInterface->getSession()->terminateNetworkServer();
myStartWindow->show();
this->hide();
}
}
else {
mySession->terminateNetworkClient();
myStartWindow->getSession()->terminateNetworkClient();
stopTimer();
myStartWindow->show();
this->hide();
@@ -3014,12 +3012,12 @@ void gameTableImpl::lineEditBetValueChanged(QString valueString) {
void gameTableImpl::leaveCurrentNetworkGame() {
if (mySession->isNetworkClientRunning()) {
if (myStartWindow->getSession()->isNetworkClientRunning()) {
if(myConfig->readConfigInt("DisableBackToLobbyWarning")) {
assert(mySession);
mySession->sendLeaveCurrentGame();
assert(myStartWindow->getSession());
myStartWindow->getSession()->sendLeaveCurrentGame();
}
else {
myMessageDialogImpl dialog(this);
@@ -3033,8 +3031,8 @@ void gameTableImpl::leaveCurrentNetworkGame() {
myConfig->writeConfigInt("DisableBackToLobbyWarning",1);
myConfig->writeBuffer();
}
assert(mySession);
mySession->sendLeaveCurrentGame();
assert(myStartWindow->getSession());
myStartWindow->getSession()->sendLeaveCurrentGame();
}
}
}
@@ -3043,6 +3041,6 @@ void gameTableImpl::leaveCurrentNetworkGame() {
void gameTableImpl::voteForKick(int id) {
qDebug() << "vote for kick user: " << id;
// mySession->sendVoteKickSignal(id);
// myStartWindow->getSession()->sendVoteKickSignal(id);
}
+2 -2
View File
@@ -57,8 +57,8 @@ public:
~gameTableImpl();
Session &getSession();
void setSession(boost::shared_ptr<Session> session);
boost::shared_ptr<Session> getSession();
// void setSession(boost::shared_ptr<Session> session);
void setStartWindow(startWindowImpl* s) { myStartWindow = s; }
void setLog(Log* l) { myLog = l; }
+3 -3
View File
@@ -151,7 +151,7 @@ void Log::logPlayerActionMsg(QString msg, int action, int setValue) {
void Log::logNewGameHandMsg(int gameID, int handID) {
PlayerListConstIterator it_c;
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myW->getSession()->getCurrentGame()->getCurrentHand();
myW->textBrowser_Log->append("<span style=\"font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
@@ -183,7 +183,7 @@ void Log::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbNa
myW->textBrowser_Log->append("<span>"+bbName+" posts big blind ($"+QString::number(bbSet,10)+")</span>");
PlayerListConstIterator it_c;
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myW->getSession()->getCurrentGame()->getCurrentHand();
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
if(currentHand->getActivePlayerList()->size() > 2) {
if((*it_c)->getMyButton() == BUTTON_DEALER) {
@@ -1237,7 +1237,7 @@ QString Log::determineHandName(int myCardsValueInt) {
list<int> sameHandCardsValueInt;
bool different = false;
bool equal = false;
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
HandInterface *currentHand = myW->getSession()->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
// collect cardsValueInt of all players who will show their cards
+2 -2
View File
@@ -46,9 +46,9 @@ GuiWrapper::~GuiWrapper()
void GuiWrapper::initGui(int speed) { myW->signalInitGui(speed); }
Session &GuiWrapper::getSession() { return myW->getSession(); }
boost::shared_ptr<Session> GuiWrapper::getSession() { return myStartWindow->getSession(); }
void GuiWrapper::setSession(boost::shared_ptr<Session> session) {
myW->setSession(session);
myStartWindow->setSession(session);
}
+1 -1
View File
@@ -41,7 +41,7 @@ public:
void initGui(int speed);
Session &getSession();
boost::shared_ptr<Session> getSession();
void setSession(boost::shared_ptr<Session> session);
gameTableImpl* getMyW() const { return myW; }
@@ -25,7 +25,7 @@
#include <net/socket_msg.h>
startNetworkGameDialogImpl::startNetworkGameDialogImpl(startWindowImpl *parent, ConfigFile *config)
: QDialog(parent), myW(NULL), myStartWindow(parent), keyUpDownChatCounter(0), myPlayerId(0), isAdmin(false), myConfig(config), mySession(NULL), myChat(NULL)
: QDialog(parent), myW(NULL), myStartWindow(parent), keyUpDownChatCounter(0), myPlayerId(0), isAdmin(false), myConfig(config), myChat(NULL)
{
#ifdef __APPLE__
setWindowModality(Qt::ApplicationModal);
@@ -197,7 +197,7 @@ void startNetworkGameDialogImpl::clearDialog()
myPlayerId = 0;
}
void startNetworkGameDialogImpl::setSession(Session *session)
void startNetworkGameDialogImpl::setSession(boost::shared_ptr<Session> session)
{
mySession = session;
myChat->setSession(mySession);
@@ -37,7 +37,7 @@ Q_OBJECT
public:
startNetworkGameDialogImpl(startWindowImpl *parent = 0, ConfigFile *config = 0);
void setSession(Session *session);
void setSession(boost::shared_ptr<Session> session);
public slots:
@@ -82,7 +82,7 @@ private:
unsigned myPlayerId;
bool isAdmin;
ConfigFile *myConfig;
Session *mySession;
boost::shared_ptr<Session> mySession;
ChatTools *myChat;
};
+12 -12
View File
@@ -173,7 +173,7 @@ void startWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
// Start new local game - terminate existing network game.
mySession->terminateNetworkClient();
if (myServerGuiInterface.get())
myServerGuiInterface->getSession().terminateNetworkServer();
myServerGuiInterface->getSession()->terminateNetworkServer();
//get values from local game dialog
GameData gameData;
@@ -294,9 +294,9 @@ void startWindowImpl::joinGameLobby() {
// Join Lobby
mySession->terminateNetworkClient();
if (myServerGuiInterface)
myServerGuiInterface->getSession().terminateNetworkServer();
myGameLobbyDialog->setSession(&getSession());
myStartNetworkGameDialog->setSession(&getSession());
myServerGuiInterface->getSession()->terminateNetworkServer();
myGameLobbyDialog->setSession(getSession());
myStartNetworkGameDialog->setSession(getSession());
// Clear Lobby dialog.
myGameLobbyDialog->clearDialog();
@@ -366,7 +366,7 @@ void startWindowImpl::callCreateNetworkGameDialog() {
// Terminate existing network games.
mySession->terminateNetworkClient();
myServerGuiInterface->getSession().terminateNetworkServer();
myServerGuiInterface->getSession()->terminateNetworkServer();
GameData gameData;
gameData.maxNumberOfPlayers = myCreateNetworkGameDialog->spinBox_quantityPlayers->value();
@@ -408,13 +408,13 @@ void startWindowImpl::callCreateNetworkGameDialog() {
gameData.guiSpeed = myCreateNetworkGameDialog->spinBox_gameSpeed->value();
gameData.playerActionTimeoutSec = myCreateNetworkGameDialog->spinBox_netTimeOutPlayerAction->value();
myGameLobbyDialog->setSession(&getSession());
myStartNetworkGameDialog->setSession(&getSession());
myGameLobbyDialog->setSession(getSession());
myStartNetworkGameDialog->setSession(getSession());
// Clear network game dialog.
myStartNetworkGameDialog->clearDialog();
myServerGuiInterface->getSession().startNetworkServer();
myServerGuiInterface->getSession()->startNetworkServer();
mySession->startNetworkClientForLocalServer(gameData);
myStartNetworkGameDialog->setMaxPlayerNumber(gameData.maxNumberOfPlayers);
@@ -437,10 +437,10 @@ void startWindowImpl::callJoinNetworkGameDialog() {
mySession->terminateNetworkClient();
if (myServerGuiInterface)
myServerGuiInterface->getSession().terminateNetworkServer();
myServerGuiInterface->getSession()->terminateNetworkServer();
myGameLobbyDialog->setSession(&getSession());
myStartNetworkGameDialog->setSession(&getSession());
myGameLobbyDialog->setSession(getSession());
myStartNetworkGameDialog->setSession(getSession());
// Clear network game dialog
myStartNetworkGameDialog->clearDialog();
// Maybe use QUrl::toPunycode.
@@ -520,7 +520,7 @@ void startWindowImpl::showNetworkStartDialog()
else {
mySession->terminateNetworkClient();
if (myServerGuiInterface)
myServerGuiInterface->getSession().terminateNetworkServer();
myServerGuiInterface->getSession()->terminateNetworkServer();
}
}
+1 -1
View File
@@ -50,7 +50,7 @@ public:
startWindowImpl(ConfigFile *c =0);
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
Session &getSession() { assert(mySession.get()); return *mySession; }
boost::shared_ptr<Session> getSession() { assert(mySession.get()); return mySession; }
signals:
void signalShowClientDialog();
+3 -3
View File
@@ -164,14 +164,14 @@ main(int argc, char *argv[])
LOG_ERROR("Missing files - please check your directory settings!");
myServerGuiInterface->setSession(session);
myServerGuiInterface->getSession().startNetworkServer();
myServerGuiInterface->getSession()->startNetworkServer();
while (!g_pokerthTerminate)
{
Thread::Msleep(100);
if (myServerGuiInterface->getSession().pollNetworkServerTerminated())
if (myServerGuiInterface->getSession()->pollNetworkServerTerminated())
g_pokerthTerminate = true;
}
myServerGuiInterface->getSession().terminateNetworkServer();
myServerGuiInterface->getSession()->terminateNetworkServer();
LOG_MSG("Terminating PokerTH dedicated server." << endl);
socket_cleanup();