Added packet type to start a "Hand". Added generic gui for the server.

This commit is contained in:
lotodore
2007-05-13 17:50:48 +00:00
parent cdd34fe820
commit 37bf6e4eb9
12 changed files with 521 additions and 75 deletions
+53
View File
@@ -0,0 +1,53 @@
/***************************************************************************
* 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 "genericservergui.h"
using namespace std;
GenericServerGui::GenericServerGui(ConfigFile *config)
: myConfig(config)
{
}
GenericServerGui::~GenericServerGui()
{
}
void GenericServerGui::initGui(int speed)
{
}
Session &GenericServerGui::getSession()
{
return *mySession;
}
void GenericServerGui::setSession(boost::shared_ptr<Session> session)
{
mySession = session;
}
void GenericServerGui::waitForNetworkAction(GameState state, unsigned uniquePlayerId)
{
}
+48
View File
@@ -0,0 +1,48 @@
/***************************************************************************
* 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 GENERICSERVERGUI_H
#define GENERICSERVERGUI_H
#include <game_defs.h>
#include <boost/shared_ptr.hpp>
class Session;
class ConfigFile;
class GenericServerGui
{
public:
GenericServerGui(ConfigFile *config);
~GenericServerGui();
void initGui(int speed);
Session &getSession();
void setSession(boost::shared_ptr<Session> session);
void waitForNetworkAction(GameState state, unsigned uniquePlayerId);
private:
boost::shared_ptr<Session> mySession;
ConfigFile *myConfig;
};
#endif
+122
View File
@@ -0,0 +1,122 @@
/***************************************************************************
* 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 "serverguiwrapper.h"
#include "genericservergui.h"
using namespace std;
ServerGuiWrapper::ServerGuiWrapper(ConfigFile *config, ClientCallback *clientcb, ServerCallback *servercb)
: myClientcb(clientcb), myServercb(servercb)
{
myGui.reset(new GenericServerGui(config));
}
ServerGuiWrapper::~ServerGuiWrapper()
{
}
void ServerGuiWrapper::initGui(int speed) {}
Session &ServerGuiWrapper::getSession()
{
return myGui->getSession();
}
void ServerGuiWrapper::setSession(boost::shared_ptr<Session> session)
{
myGui->setSession(session);
}
bool
ServerGuiWrapper::isNetworkServer() const
{
/* TODO hack */
return true;
}
void
ServerGuiWrapper::waitForNetworkAction(GameState state, unsigned uniquePlayerId)
{
/* TODO hack */
}
void ServerGuiWrapper::refreshSet() const {}
void ServerGuiWrapper::refreshCash() const {}
void ServerGuiWrapper::refreshAction(int playerID, int playerAction) const {}
void ServerGuiWrapper::refreshChangePlayer() const {}
void ServerGuiWrapper::refreshAll() const {}
void ServerGuiWrapper::refreshPot() const {}
void ServerGuiWrapper::refreshGroupbox(int playerID, int status) const {}
void ServerGuiWrapper::refreshPlayerName() const {}
void ServerGuiWrapper::dealHoleCards() const {}
void ServerGuiWrapper::dealFlopCards() const {}
void ServerGuiWrapper::dealTurnCard() const {}
void ServerGuiWrapper::dealRiverCard() const {}
void ServerGuiWrapper::highlightRoundLabel(string round) const {}
void ServerGuiWrapper::nextPlayerAnimation() const {}
void ServerGuiWrapper::preflopAnimation1() const {}
void ServerGuiWrapper::preflopAnimation2() const {}
void ServerGuiWrapper::flopAnimation1() const {}
void ServerGuiWrapper::flopAnimation2() const {}
void ServerGuiWrapper::turnAnimation1() const {}
void ServerGuiWrapper::turnAnimation2() const {}
void ServerGuiWrapper::riverAnimation1() const {}
void ServerGuiWrapper::riverAnimation2() const {}
void ServerGuiWrapper::postRiverAnimation1() const {}
void ServerGuiWrapper::postRiverRunAnimation1() const {}
void ServerGuiWrapper::flipHolecardsAllIn() const {}
void ServerGuiWrapper::nextRoundCleanGui() const {}
void ServerGuiWrapper::meInAction() const {}
void ServerGuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) {}
void ServerGuiWrapper::logNewGameHandMsg(int gameID, int handID) {}
void ServerGuiWrapper::SignalNetClientConnect(int actionID) { if (myClientcb) myClientcb->SignalNetClientConnect(actionID); }
void ServerGuiWrapper::SignalNetClientGameInfo(int actionID) { if (myClientcb) myClientcb->SignalNetClientGameInfo(actionID); }
void ServerGuiWrapper::SignalNetClientError(int errorID, int osErrorID) { if (myClientcb) myClientcb->SignalNetClientError(errorID, osErrorID); }
void ServerGuiWrapper::SignalNetClientPlayerJoined(const string &playerName) { if (myClientcb) myClientcb->SignalNetClientPlayerJoined(playerName); }
void ServerGuiWrapper::SignalNetClientPlayerLeft(const string &playerName) { if (myClientcb) myClientcb->SignalNetClientPlayerLeft(playerName); }
void ServerGuiWrapper::SignalNetClientGameStart(const GameData &gameData) { if (myClientcb) myClientcb->SignalNetClientGameStart(gameData); }
void ServerGuiWrapper::SignalNetServerSuccess(int actionID) { if (myServercb) myServercb->SignalNetServerSuccess(actionID); }
void ServerGuiWrapper::SignalNetServerError(int errorID, int osErrorID) { if (myServercb) myServercb->SignalNetServerError(errorID, osErrorID); }
void ServerGuiWrapper::SignalNetServerPlayerJoined(const string &playerName) { if (myServercb) myServercb->SignalNetServerPlayerJoined(playerName); }
void ServerGuiWrapper::SignalNetServerPlayerLeft(const string &playerName) { if (myServercb) myServercb->SignalNetServerPlayerLeft(playerName); }
+103
View File
@@ -0,0 +1,103 @@
/***************************************************************************
* 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 SERVERGUIWRAPPER_H
#define SERVERGUIWRAPPER_H
#include <guiinterface.h>
class ConfigFile;
class GenericServerGui;
class ServerGuiWrapper : public GuiInterface
{
public:
ServerGuiWrapper(ConfigFile *config, ClientCallback *clientcb, ServerCallback *servercb);
~ServerGuiWrapper();
void initGui(int speed);
Session &getSession();
void setSession(boost::shared_ptr<Session> session);
bool isNetworkServer() const;
void waitForNetworkAction(GameState state, unsigned uniquePlayerId);
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() const;
void dealFlopCards() const;
void dealTurnCard() const;
void dealRiverCard() const;
void highlightRoundLabel(std::string round) const;
void nextPlayerAnimation() const;
void preflopAnimation1() const;
void preflopAnimation2() const;
void flopAnimation1() const;
void flopAnimation2() const;
void turnAnimation1() const;
void turnAnimation2() const;
void riverAnimation1() const;
void riverAnimation2() const;
void postRiverAnimation1() const;
void postRiverRunAnimation1() const;
void flipHolecardsAllIn() const;
void nextRoundCleanGui() const;
void meInAction() const;
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 SignalNetClientGameStart(const GameData &gameData);
void SignalNetServerSuccess(int actionID);
void SignalNetServerError(int errorID, int osErrorID);
void SignalNetServerPlayerJoined(const std::string &playerName);
void SignalNetServerPlayerLeft(const std::string &playerName);
private:
boost::shared_ptr<GenericServerGui> myGui;
ClientCallback *myClientcb;
ServerCallback *myServercb;
};
#endif