diff --git a/pokerth.pro b/pokerth.pro index 480240dc..2fc634c6 100755 --- a/pokerth.pro +++ b/pokerth.pro @@ -97,7 +97,6 @@ HEADERS += src/game.h \ src/gui/qt/mainwindow/mycardspixmaplabel.h \ src/gui/qt/mainwindow/startsplash/startsplash.h \ src/gui/qt/guiwrapper.h \ - src/gui/qt/gamedatawrapper.h \ src/gui/qt/aboutpokerth/aboutpokerthimpl.h \ src/gui/qt/connecttoserverdialog/connecttoserverdialogimpl.h \ src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.h \ @@ -170,7 +169,6 @@ SOURCES += src/game.cpp \ src/net/common/netexception.cpp \ src/net/common/receiverhelper.cpp \ src/gui/qt/guiwrapper.cpp \ - src/gui/qt/gamedatawrapper.cpp \ src/gui/qt/mainwindow/mainwindowimpl.cpp \ src/gui/qt/mainwindow/mycardspixmaplabel.cpp \ src/gui/qt/mainwindow/startsplash/startsplash.cpp \ diff --git a/src/gamedata.h b/src/gamedata.h index 47bda1d3..c5b8ffae 100644 --- a/src/gamedata.h +++ b/src/gamedata.h @@ -26,10 +26,10 @@ struct GameData { GameData() : numberOfPlayers(0), startCash(0), smallBlind(0), handsBeforeRaise(1) {} - unsigned numberOfPlayers; - unsigned startCash; - unsigned smallBlind; - unsigned handsBeforeRaise; + int numberOfPlayers; + int startCash; + int smallBlind; + int handsBeforeRaise; }; #endif diff --git a/src/gui/qt/gamedatawrapper.cpp b/src/gui/qt/gamedatawrapper.cpp deleted file mode 100644 index e054efd3..00000000 --- a/src/gui/qt/gamedatawrapper.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Lothar May * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include "gamedatawrapper.h" - -GameDataWrapper::GameDataWrapper(const GameData &gameData) -: m_gameData(gameData) -{ -} - -GameDataWrapper::GameDataWrapper(const GameDataWrapper &other) -: m_gameData(other.GetGameData()) -{ -} - -const GameData& -GameDataWrapper::GetGameData() const -{ - return m_gameData; -} - -const GameDataWrapper & -GameDataWrapper::operator=(const GameDataWrapper &other) -{ - if (this != &other) - m_gameData = other.GetGameData(); - return *this; -} - diff --git a/src/gui/qt/gamedatawrapper.h b/src/gui/qt/gamedatawrapper.h deleted file mode 100644 index 90e920ca..00000000 --- a/src/gui/qt/gamedatawrapper.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Lothar May * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef GAMEDATAWRAPPER_H -#define GAMEDATAWRAPPER_H - -#include -#include - - -class GameDataWrapper : public QObject -{ -Q_OBJECT - -public: - GameDataWrapper(const GameData &gameData); - GameDataWrapper(const GameDataWrapper &other); - - const GameData &GetGameData() const; - - const GameDataWrapper &operator=(const GameDataWrapper &other); - -private: - GameData m_gameData; -}; - -#endif diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index 9508f7d3..e6c19a77 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -92,7 +92,7 @@ void GuiWrapper::SignalNetClientConnect(int actionID) { myW->SignalNetClientConn void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->SignalNetClientGameInfo(actionID); } void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->SignalNetClientError(errorID, osErrorID); } -void GuiWrapper::SignalNetClientGameStart(const GameData &gameData) { myW->SignalNetClientGameStart(GameDataWrapper(gameData)); } +void GuiWrapper::SignalNetClientGameStart(const GameData &gameData) { myW->SignalNetClientGameStart(gameData.numberOfPlayers, gameData.startCash, gameData.smallBlind, gameData.handsBeforeRaise); } void GuiWrapper::SignalNetServerSuccess(int actionID) { } void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { } diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index a68ee3cf..ec899d8d 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -538,7 +538,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent) connect(this, SIGNAL(SignalNetClientGameInfo(int)), myWaitingForServerGameDialog, SLOT(refresh(int))); // Errors are handled globally, not within one dialog. connect(this, SIGNAL(SignalNetClientError(int, int)), this, SLOT(networkError(int, int))); - connect(this, SIGNAL(SignalNetClientGameStart(GameDataWrapper)), this, SLOT(networkStart(GameDataWrapper))); + connect(this, SIGNAL(SignalNetClientGameStart(int, int, int, int)), this, SLOT(networkStart(int, int, int, int))); connect(this, SIGNAL(SignalNetServerPlayerJoined(QString)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(QString))); @@ -2200,9 +2200,14 @@ void mainWindowImpl::networkError(int errorID, int osErrorID) { myWaitingForServerGameDialog->reject(); } -void mainWindowImpl::networkStart(GameDataWrapper gameData) +void mainWindowImpl::networkStart(int numberOfPlayers, int startCash, int smallBlind, int handsBeforeRaise) { - mySession->startGame(gameData.GetGameData()); + GameData gameData; + gameData.numberOfPlayers = numberOfPlayers; + gameData.startCash = startCash; + gameData.smallBlind = smallBlind; + gameData.handsBeforeRaise = handsBeforeRaise; + mySession->startGame(gameData); } void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) { diff --git a/src/gui/qt/mainwindow/mainwindowimpl.h b/src/gui/qt/mainwindow/mainwindowimpl.h index f4f06795..dd25ecc1 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.h +++ b/src/gui/qt/mainwindow/mainwindowimpl.h @@ -29,7 +29,7 @@ #include "handinterface.h" #include "game_defs.h" -#include +#include class Session; class Game; @@ -94,7 +94,7 @@ signals: void SignalNetClientConnect(int actionID); void SignalNetClientGameInfo(int actionID); void SignalNetClientError(int errorID, int osErrorID); - void SignalNetClientGameStart(GameDataWrapper gameData); + void SignalNetClientGameStart(int numberOfPlayers, int startCash, int smallBlind, int handsBeforeRaise); void SignalNetServerPlayerJoined(QString playerName); public slots: @@ -191,7 +191,7 @@ public slots: void paintStartSplash(); void networkError(int, int); - void networkStart(GameDataWrapper); + void networkStart(int, int, int, int); private: diff --git a/src/session.cpp b/src/session.cpp index d70cf343..807782bb 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -51,7 +51,7 @@ void Session::startGame(const GameData &gameData) { currentGameID++; PlayerDataList playerDataList; - for(unsigned i=0; i