Networking should mostly be working now. Some small issues concerning the display of pot/sets, and some delays are still needed.

This commit is contained in:
lotodore
2007-05-26 17:06:03 +00:00
parent 9c2d3a9723
commit 5cb5509dec
29 changed files with 901 additions and 295 deletions
+1
View File
@@ -59,6 +59,7 @@ void ServerGuiWrapper::refreshAll() const {}
void ServerGuiWrapper::refreshPot() const {}
void ServerGuiWrapper::refreshGroupbox(int playerID, int status) const {}
void ServerGuiWrapper::refreshPlayerName() const {}
void ServerGuiWrapper::refreshButton() const {}
void ServerGuiWrapper::dealHoleCards() {}
void ServerGuiWrapper::dealFlopCards() {}
+1
View File
@@ -43,6 +43,7 @@ public:
void refreshGroupbox(int =-1, int =-1) const;
void refreshAll() const;
void refreshPlayerName() const;
void refreshButton() const;
void dealHoleCards();
void dealFlopCards();
+1 -5
View File
@@ -48,11 +48,7 @@ public:
virtual void refreshGroupbox(int =-1, int =-1) const=0;
virtual void refreshAll() const=0;
virtual void refreshPlayerName() const=0;
// virtual void refreshButton() const=0;
// virtual void refreshAction() const=0;
// virtual void refreshCash() const=0;
virtual void refreshButton() const =0;
// // Karten-Funktionen
virtual void dealHoleCards()=0;
+109 -108
View File
@@ -1,108 +1,109 @@
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* 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 "guiwrapper.h"
#include "session.h"
#include "log.h"
#include "chat.h"
#include "mainwindowimpl.h"
#include "configfile.h"
using namespace std;
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(0), myW(0), myConfig(c)
{
myW = new mainWindowImpl(myConfig);
myW->show();
myLog = new Log(myW, myConfig);
myChat = new Chat(myW, myConfig);
}
GuiWrapper::~GuiWrapper()
{
}
void GuiWrapper::initGui(int speed) { myW->initGui(speed); }
Session &GuiWrapper::getSession() { return myW->getSession(); }
void GuiWrapper::setSession(boost::shared_ptr<Session> session) { myW->setSession(session); }
void GuiWrapper::refreshSet() const { myW->signalRefreshSet(); }
void GuiWrapper::refreshCash() const { myW->signalRefreshCash(); }
void GuiWrapper::refreshAction(int playerID, int playerAction) const { myW->signalRefreshAction(playerID, playerAction); }
void GuiWrapper::refreshChangePlayer() const { myW->signalRefreshChangePlayer(); }
void GuiWrapper::refreshAll() const { myW->signalRefreshAll(); }
void GuiWrapper::refreshPot() const { myW->signalRefreshPot(); }
void GuiWrapper::refreshGroupbox(int playerID, int status) const { myW->signalRefreshGroupbox(playerID, status); }
void GuiWrapper::refreshPlayerName() const { myW->signalRefreshPlayerName(); }
void GuiWrapper::dealHoleCards() { myW->signalDealHoleCards(); }
void GuiWrapper::dealFlopCards() { myW->signalDealFlopCards0(); }
void GuiWrapper::dealTurnCard() { myW->signalDealTurnCards0(); }
void GuiWrapper::dealRiverCard() { myW->signalDealRiverCards0(); }
void GuiWrapper::highlightRoundLabel(string round) const { myW->signalHighlightRoundLabel(QString::fromUtf8(round.c_str())); }
void GuiWrapper::nextPlayerAnimation() { myW->signalNextPlayerAnimation(); }
void GuiWrapper::preflopAnimation1() { myW->signalPreflopAnimation1(); }
void GuiWrapper::preflopAnimation2() { myW->signalPreflopAnimation2(); }
void GuiWrapper::flopAnimation1() { myW->signalFlopAnimation1(); }
void GuiWrapper::flopAnimation2() { myW->signalFlopAnimation2(); }
void GuiWrapper::turnAnimation1() { myW->signalTurnAnimation1(); }
void GuiWrapper::turnAnimation2() { myW->signalTurnAnimation2(); }
void GuiWrapper::riverAnimation1() { myW->signalRiverAnimation1(); }
void GuiWrapper::riverAnimation2() { myW->signalRiverAnimation2(); }
void GuiWrapper::postRiverAnimation1() { myW->signalPostRiverAnimation1(); }
void GuiWrapper::postRiverRunAnimation1() { myW->signalPostRiverRunAnimation1(); }
void GuiWrapper::flipHolecardsAllIn() { myW->signalFlipHolecardsAllIn(); }
void GuiWrapper::nextRoundCleanGui() { myW->signalNextRoundCleanGui(); }
void GuiWrapper::meInAction() { myW->signalMeInAction(); }
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
void GuiWrapper::SignalNetClientConnect(int actionID) { myW->signalNetClientConnect(actionID); }
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGameInfo(actionID); }
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->signalNetClientError(errorID, osErrorID); }
void GuiWrapper::SignalNetClientPlayerJoined(const string &playerName) { myW->signalNetClientPlayerJoined(QString::fromUtf8(playerName.c_str())); }
void GuiWrapper::SignalNetClientPlayerLeft(const string &playerName) { myW->signalNetClientPlayerLeft(QString::fromUtf8(playerName.c_str())); }
void GuiWrapper::SignalNetClientGameStart(boost::shared_ptr<Game> game) { myW->signalNetClientGameStart(game); }
void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myChat->signalChatMessage(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); }
void GuiWrapper::SignalNetServerSuccess(int actionID) { }
void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { }
void GuiWrapper::SignalNetServerPlayerJoined(const string &playerName) { myW->signalNetServerPlayerJoined(QString::fromUtf8(playerName.c_str())); }
void GuiWrapper::SignalNetServerPlayerLeft(const string &playerName) { myW->signalNetServerPlayerLeft(QString::fromUtf8(playerName.c_str())); }
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* 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 "guiwrapper.h"
#include "session.h"
#include "log.h"
#include "chat.h"
#include "mainwindowimpl.h"
#include "configfile.h"
using namespace std;
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(0), myW(0), myConfig(c)
{
myW = new mainWindowImpl(myConfig);
myW->show();
myLog = new Log(myW, myConfig);
myChat = new Chat(myW, myConfig);
}
GuiWrapper::~GuiWrapper()
{
}
void GuiWrapper::initGui(int speed) { myW->initGui(speed); }
Session &GuiWrapper::getSession() { return myW->getSession(); }
void GuiWrapper::setSession(boost::shared_ptr<Session> session) { myW->setSession(session); }
void GuiWrapper::refreshSet() const { myW->signalRefreshSet(); }
void GuiWrapper::refreshCash() const { myW->signalRefreshCash(); }
void GuiWrapper::refreshAction(int playerID, int playerAction) const { myW->signalRefreshAction(playerID, playerAction); }
void GuiWrapper::refreshChangePlayer() const { myW->signalRefreshChangePlayer(); }
void GuiWrapper::refreshAll() const { myW->signalRefreshAll(); }
void GuiWrapper::refreshPot() const { myW->signalRefreshPot(); }
void GuiWrapper::refreshGroupbox(int playerID, int status) const { myW->signalRefreshGroupbox(playerID, status); }
void GuiWrapper::refreshPlayerName() const { myW->signalRefreshPlayerName(); }
void GuiWrapper::refreshButton() const { myW->signalRefreshButton(); }
void GuiWrapper::dealHoleCards() { myW->signalDealHoleCards(); }
void GuiWrapper::dealFlopCards() { myW->signalDealFlopCards0(); }
void GuiWrapper::dealTurnCard() { myW->signalDealTurnCards0(); }
void GuiWrapper::dealRiverCard() { myW->signalDealRiverCards0(); }
void GuiWrapper::highlightRoundLabel(string round) const { myW->signalHighlightRoundLabel(QString::fromUtf8(round.c_str())); }
void GuiWrapper::nextPlayerAnimation() { myW->signalNextPlayerAnimation(); }
void GuiWrapper::preflopAnimation1() { myW->signalPreflopAnimation1(); }
void GuiWrapper::preflopAnimation2() { myW->signalPreflopAnimation2(); }
void GuiWrapper::flopAnimation1() { myW->signalFlopAnimation1(); }
void GuiWrapper::flopAnimation2() { myW->signalFlopAnimation2(); }
void GuiWrapper::turnAnimation1() { myW->signalTurnAnimation1(); }
void GuiWrapper::turnAnimation2() { myW->signalTurnAnimation2(); }
void GuiWrapper::riverAnimation1() { myW->signalRiverAnimation1(); }
void GuiWrapper::riverAnimation2() { myW->signalRiverAnimation2(); }
void GuiWrapper::postRiverAnimation1() { myW->signalPostRiverAnimation1(); }
void GuiWrapper::postRiverRunAnimation1() { myW->signalPostRiverRunAnimation1(); }
void GuiWrapper::flipHolecardsAllIn() { myW->signalFlipHolecardsAllIn(); }
void GuiWrapper::nextRoundCleanGui() { myW->signalNextRoundCleanGui(); }
void GuiWrapper::meInAction() { myW->signalMeInAction(); }
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
void GuiWrapper::SignalNetClientConnect(int actionID) { myW->signalNetClientConnect(actionID); }
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGameInfo(actionID); }
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->signalNetClientError(errorID, osErrorID); }
void GuiWrapper::SignalNetClientPlayerJoined(const string &playerName) { myW->signalNetClientPlayerJoined(QString::fromUtf8(playerName.c_str())); }
void GuiWrapper::SignalNetClientPlayerLeft(const string &playerName) { myW->signalNetClientPlayerLeft(QString::fromUtf8(playerName.c_str())); }
void GuiWrapper::SignalNetClientGameStart(boost::shared_ptr<Game> game) { myW->signalNetClientGameStart(game); }
void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myChat->signalChatMessage(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); }
void GuiWrapper::SignalNetServerSuccess(int actionID) { }
void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { }
void GuiWrapper::SignalNetServerPlayerJoined(const string &playerName) { myW->signalNetServerPlayerJoined(QString::fromUtf8(playerName.c_str())); }
void GuiWrapper::SignalNetServerPlayerLeft(const string &playerName) { myW->signalNetServerPlayerLeft(QString::fromUtf8(playerName.c_str())); }
+112 -111
View File
@@ -1,111 +1,112 @@
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* 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 GUIWRAPPER_H
#define GUIWRAPPER_H
#include <guiinterface.h>
#include <string>
#include <iostream>
class Session;
class mainWindowImpl;
class Log;
class Chat;
class ConfigFile;
class GuiWrapper : public GuiInterface
{
public:
GuiWrapper(ConfigFile*);
~GuiWrapper();
void initGui(int speed);
Session &getSession();
void setSession(boost::shared_ptr<Session> session);
void refreshSet() const;
void refreshCash() const;
void refreshAction(int =-1, int =-1) const;
void refreshChangePlayer() const;
void refreshPot() const;
void refreshGroupbox(int =-1, int =-1) const;
void refreshAll() const;
void refreshPlayerName() const;
void dealHoleCards();
void dealFlopCards();
void dealTurnCard();
void dealRiverCard();
void highlightRoundLabel(std::string round) const;
void nextPlayerAnimation();
void preflopAnimation1();
void preflopAnimation2();
void flopAnimation1();
void flopAnimation2();
void turnAnimation1();
void turnAnimation2();
void riverAnimation1();
void riverAnimation2();
void postRiverAnimation1();
void postRiverRunAnimation1();
void flipHolecardsAllIn();
void nextRoundCleanGui();
void meInAction();
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
void logNewGameHandMsg(int gameID, int handID) ;
void SignalNetClientConnect(int actionID);
void SignalNetClientGameInfo(int actionID);
void SignalNetClientError(int errorID, int osErrorID);
void SignalNetClientPlayerJoined(const std::string &playerName);
void SignalNetClientPlayerLeft(const std::string &playerName);
void SignalNetClientChatMsg(const std::string &playerName, const std::string &msg);
void SignalNetClientGameStart(boost::shared_ptr<Game> game);
void SignalNetServerSuccess(int actionID);
void SignalNetServerError(int errorID, int osErrorID);
void SignalNetServerPlayerJoined(const std::string &playerName);
void SignalNetServerPlayerLeft(const std::string &playerName);
private:
Log *myLog;
Chat *myChat;
mainWindowImpl *myW;
ConfigFile *myConfig;
};
#endif
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* 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 GUIWRAPPER_H
#define GUIWRAPPER_H
#include <guiinterface.h>
#include <string>
#include <iostream>
class Session;
class mainWindowImpl;
class Log;
class Chat;
class ConfigFile;
class GuiWrapper : public GuiInterface
{
public:
GuiWrapper(ConfigFile*);
~GuiWrapper();
void initGui(int speed);
Session &getSession();
void setSession(boost::shared_ptr<Session> session);
void refreshSet() const;
void refreshCash() const;
void refreshAction(int =-1, int =-1) const;
void refreshChangePlayer() const;
void refreshPot() const;
void refreshGroupbox(int =-1, int =-1) const;
void refreshAll() const;
void refreshPlayerName() const;
void refreshButton() const;
void dealHoleCards();
void dealFlopCards();
void dealTurnCard();
void dealRiverCard();
void highlightRoundLabel(std::string round) const;
void nextPlayerAnimation();
void preflopAnimation1();
void preflopAnimation2();
void flopAnimation1();
void flopAnimation2();
void turnAnimation1();
void turnAnimation2();
void riverAnimation1();
void riverAnimation2();
void postRiverAnimation1();
void postRiverRunAnimation1();
void flipHolecardsAllIn();
void nextRoundCleanGui();
void meInAction();
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
void logNewGameHandMsg(int gameID, int handID) ;
void SignalNetClientConnect(int actionID);
void SignalNetClientGameInfo(int actionID);
void SignalNetClientError(int errorID, int osErrorID);
void SignalNetClientPlayerJoined(const std::string &playerName);
void SignalNetClientPlayerLeft(const std::string &playerName);
void SignalNetClientChatMsg(const std::string &playerName, const std::string &msg);
void SignalNetClientGameStart(boost::shared_ptr<Game> game);
void SignalNetServerSuccess(int actionID);
void SignalNetServerError(int errorID, int osErrorID);
void SignalNetServerPlayerJoined(const std::string &playerName);
void SignalNetServerPlayerLeft(const std::string &playerName);
private:
Log *myLog;
Chat *myChat;
mainWindowImpl *myW;
ConfigFile *myConfig;
};
#endif
+7 -1
View File
@@ -571,6 +571,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
connect(this, SIGNAL(signalRefreshGroupbox(int, int)), this, SLOT(refreshGroupbox(int, int)));
connect(this, SIGNAL(signalRefreshAll()), this, SLOT(refreshAll()));
connect(this, SIGNAL(signalRefreshPlayerName()), this, SLOT(refreshPlayerName()));
connect(this, SIGNAL(signalRefreshButton()), this, SLOT(refreshButton()));
connect(this, SIGNAL(signalMeInAction()), this, SLOT(meInAction()));
@@ -1799,7 +1800,7 @@ void mainWindowImpl::postRiverRunAnimation2() {
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
int activePlayersCounter = 0;
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if (currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus() == 1) activePlayersCounter++;
if (currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus()) activePlayersCounter++;
}
if(activePlayersCounter!=1) {
@@ -2021,6 +2022,11 @@ void mainWindowImpl::postRiverRunAnimation6() {
refreshCash();
refreshPot();
// TODO HACK
// Check for network client, do not start new hand if client is running.
if (mySession->isNetworkClientRunning())
return;
// wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen
int playersPositiveCashCounter = 0;
for (i=0; i<mySession->getCurrentGame()->getStartQuantityPlayers(); i++) {
+1
View File
@@ -81,6 +81,7 @@ signals:
void signalRefreshGroupbox(int =-1, int =-1);
void signalRefreshAll();
void signalRefreshPlayerName();
void signalRefreshButton();
void signalMeInAction();