Now using int as parameters for the signal/slot method. This needs to be fixed some time...
This commit is contained in:
+4
-4
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 <gamedata.h>
|
||||
#include <QtCore>
|
||||
|
||||
|
||||
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
|
||||
@@ -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) { }
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "handinterface.h"
|
||||
#include "game_defs.h"
|
||||
#include <gamedatawrapper.h>
|
||||
#include <gamedata.h>
|
||||
|
||||
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:
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ void Session::startGame(const GameData &gameData) {
|
||||
currentGameID++;
|
||||
|
||||
PlayerDataList playerDataList;
|
||||
for(unsigned i=0; i<gameData.numberOfPlayers; i++) {
|
||||
for(int i=0; i<gameData.numberOfPlayers; i++) {
|
||||
|
||||
//Namen und Avatarpfad abfragen
|
||||
ostringstream myName;
|
||||
|
||||
Reference in New Issue
Block a user