Restructured network server.

This commit is contained in:
lotodore
2007-05-14 21:18:24 +00:00
parent 80a11af74c
commit 5f033730da
19 changed files with 103 additions and 338 deletions
-121
View File
@@ -1,121 +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 "genericservergui.h"
#include <session.h>
#include <game.h>
using namespace std;
GenericServerGui::GenericServerGui(ConfigFile *config)
: myConfig(config)
{
}
GenericServerGui::~GenericServerGui()
{
}
void GenericServerGui::initGui(int speed)
{
}
Session &GenericServerGui::getSession()
{
assert(mySession.get());
return *mySession;
}
void GenericServerGui::setSession(boost::shared_ptr<Session> session)
{
mySession = session;
}
void GenericServerGui::waitForNetworkAction(GameState state, unsigned uniquePlayerId)
{
getSession().waitForNetworkServerAction(state, uniquePlayerId);
}
void GenericServerGui::dealHoleCards()
{
}
void GenericServerGui::dealFlopCards()
{
}
void GenericServerGui::dealTurnCard()
{
}
void GenericServerGui::dealRiverCard()
{
}
void GenericServerGui::nextPlayerAnimation()
{
}
void GenericServerGui::preflopAnimation1()
{
}
void GenericServerGui::preflopAnimation2()
{
}
void GenericServerGui::flopAnimation1()
{
}
void GenericServerGui::flopAnimation2()
{
}
void GenericServerGui::turnAnimation1()
{
}
void GenericServerGui::turnAnimation2()
{
}
void GenericServerGui::riverAnimation1()
{
}
void GenericServerGui::riverAnimation2()
{
}
void GenericServerGui::postRiverAnimation1()
{
}
void GenericServerGui::postRiverRunAnimation1()
{
}
void GenericServerGui::flipHolecardsAllIn()
{
}
-72
View File
@@ -1,72 +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 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);
void dealHoleCards();
void dealFlopCards();
void dealTurnCard();
void dealRiverCard();
void nextPlayerAnimation();
void preflopAnimation1();
void preflopAnimation2();
void flopAnimation1();
void flopAnimation2();
void turnAnimation1();
void turnAnimation2();
void riverAnimation1();
void riverAnimation2();
void postRiverAnimation1();
void postRiverRunAnimation1();
void flipHolecardsAllIn();
private:
boost::shared_ptr<Session> mySession;
ConfigFile *myConfig;
};
#endif
+21 -35
View File
@@ -18,16 +18,15 @@
***************************************************************************/
#include "serverguiwrapper.h"
#include "genericservergui.h"
#include <session.h>
using namespace std;
ServerGuiWrapper::ServerGuiWrapper(ConfigFile *config, ClientCallback *clientcb, ServerCallback *servercb)
: myClientcb(clientcb), myServercb(servercb)
: myConfig(config), myClientcb(clientcb), myServercb(servercb)
{
myGui.reset(new GenericServerGui(config));
}
ServerGuiWrapper::~ServerGuiWrapper()
@@ -38,26 +37,13 @@ void ServerGuiWrapper::initGui(int speed) {}
Session &ServerGuiWrapper::getSession()
{
return myGui->getSession();
assert(mySession.get());
return *mySession;
}
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 */
myGui->waitForNetworkAction(state, uniquePlayerId);
mySession = session;
}
void ServerGuiWrapper::refreshSet() const {}
@@ -74,32 +60,32 @@ void ServerGuiWrapper::refreshPot() const {}
void ServerGuiWrapper::refreshGroupbox(int playerID, int status) const {}
void ServerGuiWrapper::refreshPlayerName() const {}
void ServerGuiWrapper::dealHoleCards() { myGui->dealHoleCards(); }
void ServerGuiWrapper::dealFlopCards() { myGui->dealFlopCards(); }
void ServerGuiWrapper::dealTurnCard() { myGui->dealTurnCard(); }
void ServerGuiWrapper::dealRiverCard() { myGui->dealRiverCard(); }
void ServerGuiWrapper::dealHoleCards() {}
void ServerGuiWrapper::dealFlopCards() {}
void ServerGuiWrapper::dealTurnCard() {}
void ServerGuiWrapper::dealRiverCard() {}
void ServerGuiWrapper::highlightRoundLabel(string round) const {}
void ServerGuiWrapper::nextPlayerAnimation() { myGui->nextPlayerAnimation(); }
void ServerGuiWrapper::nextPlayerAnimation() {}
void ServerGuiWrapper::preflopAnimation1() { myGui->preflopAnimation1(); }
void ServerGuiWrapper::preflopAnimation2() { myGui->preflopAnimation2(); }
void ServerGuiWrapper::preflopAnimation1() {}
void ServerGuiWrapper::preflopAnimation2() {}
void ServerGuiWrapper::flopAnimation1() { myGui->flopAnimation1(); }
void ServerGuiWrapper::flopAnimation2() { myGui->flopAnimation2(); }
void ServerGuiWrapper::flopAnimation1() {}
void ServerGuiWrapper::flopAnimation2() {}
void ServerGuiWrapper::turnAnimation1() { myGui->turnAnimation1(); }
void ServerGuiWrapper::turnAnimation2() { myGui->turnAnimation2(); }
void ServerGuiWrapper::turnAnimation1() {}
void ServerGuiWrapper::turnAnimation2() {}
void ServerGuiWrapper::riverAnimation1() { myGui->riverAnimation1(); }
void ServerGuiWrapper::riverAnimation2() { myGui->riverAnimation2(); }
void ServerGuiWrapper::riverAnimation1() {}
void ServerGuiWrapper::riverAnimation2() {}
void ServerGuiWrapper::postRiverAnimation1() { myGui->postRiverAnimation1(); }
void ServerGuiWrapper::postRiverRunAnimation1() { myGui->postRiverRunAnimation1(); }
void ServerGuiWrapper::postRiverAnimation1() {}
void ServerGuiWrapper::postRiverRunAnimation1() {}
void ServerGuiWrapper::flipHolecardsAllIn() { myGui->flipHolecardsAllIn(); }
void ServerGuiWrapper::flipHolecardsAllIn() {}
void ServerGuiWrapper::nextRoundCleanGui() {}
+4 -5
View File
@@ -22,7 +22,7 @@
#include <guiinterface.h>
class ConfigFile;
class GenericServerGui;
class Session;
class ServerGuiWrapper : public GuiInterface
{
@@ -35,9 +35,6 @@ public:
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;
@@ -95,7 +92,9 @@ public:
private:
boost::shared_ptr<GenericServerGui> myGui;
boost::shared_ptr<Session> mySession;
ConfigFile *myConfig;
ClientCallback *myClientcb;
ServerCallback *myServercb;
};
-3
View File
@@ -39,9 +39,6 @@ public:
virtual Session &getSession() =0;
virtual void setSession(boost::shared_ptr<Session> session) =0;
virtual bool isNetworkServer() const =0;
virtual void waitForNetworkAction(GameState state, unsigned uniquePlayerId) =0;
//refresh-Funktionen
virtual void refreshSet() const=0;
virtual void refreshCash() const=0;
-3
View File
@@ -47,9 +47,6 @@ 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); }
bool GuiWrapper::isNetworkServer() const { /* TODO hack */ return false; }
void GuiWrapper::waitForNetworkAction(GameState state, unsigned uniquePlayerId) { /* TODO hack */ }
void GuiWrapper::refreshSet() const { myW->refreshSet(); }
void GuiWrapper::refreshCash() const { myW->refreshCash(); }
void GuiWrapper::refreshAction(int playerID, int playerAction) const { myW->refreshAction(playerID, playerAction); }
-3
View File
@@ -42,9 +42,6 @@ public:
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;