Removed dependencies on old preflop/flop/turn/river interface from networking. Compiles, but networking is BROKEN. Also includes first try of computer players for networking, which is broken, too.

This commit is contained in:
lotodore
2007-08-06 21:38:09 +00:00
parent 96419b3588
commit 0aef0d9e42
18 changed files with 233 additions and 121 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ public:
int getMyBeRoID() const { return myBeRoID; }
int getHighestCardsValue() const {}
int getHighestCardsValue() const {return 0;}
void setHighestCardsValue(int theValue) {}
void run() {}
@@ -11,6 +11,12 @@
//
#include "localberofactory.h"
#include <localberopreflop.h>
#include <localberoflop.h>
#include <localberoturn.h>
#include <localberoriver.h>
#include <localberopostriver.h>
using namespace std;
LocalBeRoFactory::LocalBeRoFactory (HandInterface* hi, int id, int aP, int dP, int sB)
@@ -21,11 +21,6 @@
#include <berofactoryinterface.h>
#include <berointerface.h>
#include <handinterface.h>
#include <localberopreflop.h>
#include <localberoflop.h>
#include <localberoturn.h>
#include <localberoriver.h>
#include <localberopostriver.h>
/**
@author FThauer FHammer <webmaster@pokerth.net>
+18 -10
View File
@@ -10,10 +10,13 @@
//
//
#include "clientberofactory.h"
#include "berointerface.h"
#include <clientpreflop.h>
#include <clientflop.h>
#include <clientturn.h>
#include <clientriver.h>
ClientBeRoFactory::ClientBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB)
: BeRoFactoryInterface()
: myHand(hi), myID(id), actualQuantityPlayers(aP), dealerPosition(dP), smallBlind(sB)
{
}
@@ -24,14 +27,19 @@ ClientBeRoFactory::~ClientBeRoFactory()
std::vector<boost::shared_ptr<BeRoInterface> > ClientBeRoFactory::createBeRo()
{
std::vector<boost::shared_ptr<BeRoInterface> > bettingRounds;
//         bettingRounds.push_back(boost::shared_ptr<BeRoInterface>(new
// LocalBeRoPreflop(...)));
//         bettingRounds.push_back(boost::shared_ptr<BeRoInterface>(new
// LocalBeRoFlop(...)));
//
//         ...
return bettingRounds;
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoPreflop(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoFlop(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoTurn(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoRiver(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
// myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoPostRiver(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
return myBeRo;
}
@@ -35,6 +35,14 @@ public:
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo();
private:
HandInterface* myHand;
int myID;
int actualQuantityPlayers;
int dealerPosition;
int smallBlind;
};
#endif
@@ -56,22 +56,22 @@ PlayerInterface* ClientEngineFactory::createPlayer(BoardInterface *b, int id, un
PreflopInterface* ClientEngineFactory::createPreflop(HandInterface* hi, int id, int aP, int dP, int sB)
{
return new ClientPreflop(hi, id, aP, dP, sB);
return NULL;
}
FlopInterface* ClientEngineFactory::createFlop(HandInterface* hi, int id, int aP, int dP, int sB)
{
return new ClientFlop(hi, id, aP, dP, sB);
return NULL;
}
TurnInterface* ClientEngineFactory::createTurn(HandInterface* hi, int id, int aP, int dP, int sB)
{
return new ClientTurn(hi, id, aP, dP, sB);
return NULL;
}
RiverInterface* ClientEngineFactory::createRiver(HandInterface* hi, int id, int aP, int dP, int sB)
{
return new ClientRiver(hi, id, aP, dP, sB);
return NULL;
}
BeRoFactoryInterface* ClientEngineFactory::createBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB)
+20 -19
View File
@@ -22,100 +22,101 @@
//using namespace std;
ClientFlop::ClientFlop(HandInterface* bR, int id, int qP, int dP, int sB)
ClientBeRoFlop::ClientBeRoFlop(HandInterface* bR, int id, int qP, int dP, int sB)
: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstFlopRun(1), firstFlopRound(1), playersTurn(dP)
{
}
ClientFlop::~ClientFlop()
ClientBeRoFlop::~ClientBeRoFlop()
{
}
int
ClientBeRoFlop::getMyBeRoID() const
{
return GAME_STATE_FLOP;
}
void
ClientFlop::setPlayersTurn(int theValue)
ClientBeRoFlop::setPlayersTurn(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
playersTurn = theValue;
}
int
ClientFlop::getPlayersTurn() const
ClientBeRoFlop::getPlayersTurn() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return playersTurn;
}
void
ClientFlop::setHighestSet(int theValue)
ClientBeRoFlop::setHighestSet(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
highestSet = theValue;
}
int
ClientFlop::getHighestSet() const
ClientBeRoFlop::getHighestSet() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return highestSet;
}
void
ClientFlop::setFirstFlopRound(bool theValue)
ClientBeRoFlop::setFirstFlopRound(bool theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
firstFlopRound = theValue;
}
bool
ClientFlop::getFirstFlopRound() const
ClientBeRoFlop::getFirstFlopRound() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return firstFlopRound;
}
void
ClientFlop::setSmallBlindPosition(int theValue)
ClientBeRoFlop::setSmallBlindPosition(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
smallBlindPosition = theValue;
}
int
ClientFlop::getSmallBlindPosition() const
ClientBeRoFlop::getSmallBlindPosition() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return smallBlindPosition;
}
void
ClientFlop::setSmallBlind(int theValue)
ClientBeRoFlop::setSmallBlind(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
smallBlind = theValue;
}
int
ClientFlop::getSmallBlind() const
ClientBeRoFlop::getSmallBlind() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return smallBlind;
}
void
ClientFlop::resetFirstRun()
ClientBeRoFlop::resetFirstRun()
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
firstFlopRun = false;
}
void
ClientFlop::flopRun()
{
}
void
ClientFlop::nextPlayer2()
ClientBeRoFlop::run()
{
}
+17 -6
View File
@@ -19,17 +19,18 @@
#ifndef CLIENTFLOP_H
#define CLIENTFLOP_H
#include "flopinterface.h"
#include "berointerface.h"
#include <boost/thread.hpp>
class HandInterface;
class ClientFlop : public FlopInterface
class ClientBeRoFlop : public BeRoInterface
{
public:
ClientFlop(HandInterface*, int, int, int, int);
~ClientFlop();
ClientBeRoFlop(HandInterface*, int, int, int, int);
~ClientBeRoFlop();
int getMyBeRoID() const;
void setPlayersTurn(int theValue);
int getPlayersTurn() const;
@@ -46,10 +47,20 @@ public:
void setSmallBlind(int theValue);
int getSmallBlind() const;
void setHighestCardsValue(int theValue) {}
int getHighestCardsValue() const {return 0;}
void resetFirstRun();
void flopRun();
void nextPlayer2();
void run();
void preflopRun() {}
void flopRun() {}
void turnRun() {}
void riverRun() {}
void postRiverRun() {}
void nextPlayer2() {}
private:
mutable boost::recursive_mutex m_syncMutex;
+14 -8
View File
@@ -23,52 +23,58 @@
using namespace std;
ClientPreflop::ClientPreflop(HandInterface* bR, int id, int qP, int dP, int sB)
ClientBeRoPreflop::ClientBeRoPreflop(HandInterface* bR, int id, int qP, int dP, int sB)
: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), bigBlindPosition(0), smallBlind(sB), highestSet(2*sB), preflopFirstRound(1), playersTurn(0)
{
}
ClientPreflop::~ClientPreflop()
ClientBeRoPreflop::~ClientBeRoPreflop()
{
}
int
ClientBeRoPreflop::getMyBeRoID() const
{
return GAME_STATE_PREFLOP;
}
void
ClientPreflop::setPlayersTurn(int theValue)
ClientBeRoPreflop::setPlayersTurn(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
playersTurn = theValue;
}
int
ClientPreflop::getPlayersTurn() const
ClientBeRoPreflop::getPlayersTurn() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return playersTurn;
}
void
ClientPreflop::setHighestSet(int theValue)
ClientBeRoPreflop::setHighestSet(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
highestSet = theValue;
}
int
ClientPreflop::getHighestSet() const
ClientBeRoPreflop::getHighestSet() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return highestSet;
}
void
ClientPreflop::preflopRun()
ClientBeRoPreflop::resetFirstRun()
{
}
void
ClientPreflop::nextPlayer2()
ClientBeRoPreflop::run()
{
}
+20 -6
View File
@@ -19,16 +19,18 @@
#ifndef CLIENTPREFLOP_H
#define CLIENTPREFLOP_H
#include <preflopinterface.h>
#include <berointerface.h>
#include <boost/thread.hpp>
class HandInterface;
class ClientPreflop : public PreflopInterface{
class ClientBeRoPreflop : public BeRoInterface{
public:
ClientPreflop(HandInterface*, int, int, int, int);
~ClientPreflop();
ClientBeRoPreflop(HandInterface*, int, int, int, int);
~ClientBeRoPreflop();
int getMyBeRoID() const;
void setPlayersTurn(int theValue);
int getPlayersTurn() const;
@@ -36,8 +38,20 @@ public:
void setHighestSet(int theValue);
int getHighestSet() const;
void preflopRun();
void nextPlayer2();
void setHighestCardsValue(int theValue) {}
int getHighestCardsValue() const {return 0;}
void resetFirstRun();
void run();
void preflopRun() {}
void flopRun() {}
void turnRun() {}
void riverRun() {}
void postRiverRun() {}
void nextPlayer2() {}
private:
mutable boost::recursive_mutex m_syncMutex;
+23 -26
View File
@@ -22,122 +22,119 @@
//using namespace std;
ClientRiver::ClientRiver(HandInterface* bR, int id, int qP, int dP, int sB)
ClientBeRoRiver::ClientBeRoRiver(HandInterface* bR, int id, int qP, int dP, int sB)
: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), playersTurn(dP), highestCardsValue(0)
{
}
ClientRiver::~ClientRiver()
ClientBeRoRiver::~ClientBeRoRiver()
{
}
int
ClientBeRoRiver::getMyBeRoID() const
{
return GAME_STATE_RIVER;
}
void
ClientRiver::setPlayersTurn(int theValue)
ClientBeRoRiver::setPlayersTurn(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
playersTurn = theValue;
}
int
ClientRiver::getPlayersTurn() const
ClientBeRoRiver::getPlayersTurn() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return playersTurn;
}
void
ClientRiver::setHighestSet(int theValue)
ClientBeRoRiver::setHighestSet(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
highestSet = theValue;
}
int
ClientRiver::getHighestSet() const
ClientBeRoRiver::getHighestSet() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return highestSet;
}
void
ClientRiver::setFirstRiverRound(bool theValue)
ClientBeRoRiver::setFirstRiverRound(bool theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
firstRiverRound = theValue;
}
bool
ClientRiver::getFirstRiverRound() const
ClientBeRoRiver::getFirstRiverRound() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return firstRiverRound;
}
void
ClientRiver::setSmallBlindPosition(int theValue)
ClientBeRoRiver::setSmallBlindPosition(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
smallBlindPosition = theValue;
}
int
ClientRiver::getSmallBlindPosition() const
ClientBeRoRiver::getSmallBlindPosition() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return smallBlindPosition;
}
void
ClientRiver::setSmallBlind(int theValue)
ClientBeRoRiver::setSmallBlind(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
smallBlind = theValue;
}
int
ClientRiver::getSmallBlind() const
ClientBeRoRiver::getSmallBlind() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return smallBlind;
}
void
ClientRiver::setHighestCardsValue(int theValue)
ClientBeRoRiver::setHighestCardsValue(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
highestCardsValue = theValue;
}
int
ClientRiver::getHighestCardsValue() const
ClientBeRoRiver::getHighestCardsValue() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return highestCardsValue;
}
void
ClientRiver::resetFirstRun()
ClientBeRoRiver::resetFirstRun()
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
firstRiverRun = false;
}
void
ClientRiver::riverRun()
ClientBeRoRiver::distributePot()
{
}
void
ClientRiver::postRiverRun()
ClientBeRoRiver::run()
{
}
void
ClientRiver::nextPlayer2()
{
}
void
ClientRiver::distributePot()
{
}
+17 -8
View File
@@ -19,16 +19,18 @@
#ifndef CLIENTRIVER_H
#define CLIENTRIVER_H
#include <riverinterface.h>
#include <berointerface.h>
#include <boost/thread.hpp>
class HandInterface;
class ClientRiver : public RiverInterface{
class ClientBeRoRiver : public BeRoInterface{
public:
ClientRiver(HandInterface*, int, int, int, int);
~ClientRiver();
ClientBeRoRiver(HandInterface*, int, int, int, int);
~ClientBeRoRiver();
int getMyBeRoID() const;
void setPlayersTurn(int theValue);
int getPlayersTurn() const;
@@ -50,11 +52,18 @@ public:
void resetFirstRun();
void riverRun();
void postRiverRun();
void nextPlayer2();
void distributePot();
void run();
void preflopRun() {}
void flopRun() {}
void turnRun() {}
void riverRun() {}
void postRiverRun() {}
void nextPlayer2() {}
private:
mutable boost::recursive_mutex m_syncMutex;
+20 -19
View File
@@ -22,99 +22,100 @@
//using namespace std;
ClientTurn::ClientTurn(HandInterface* bR, int id, int qP, int dP, int sB)
ClientBeRoTurn::ClientBeRoTurn(HandInterface* bR, int id, int qP, int dP, int sB)
: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstTurnRun(1), firstTurnRound(1), playersTurn(dP)
{
}
ClientTurn::~ClientTurn()
ClientBeRoTurn::~ClientBeRoTurn()
{
}
int
ClientBeRoTurn::getMyBeRoID() const
{
return GAME_STATE_TURN;
}
void
ClientTurn::setPlayersTurn(int theValue)
ClientBeRoTurn::setPlayersTurn(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
playersTurn = theValue;
}
int
ClientTurn::getPlayersTurn() const
ClientBeRoTurn::getPlayersTurn() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return playersTurn;
}
void
ClientTurn::setHighestSet(int theValue)
ClientBeRoTurn::setHighestSet(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
highestSet = theValue;
}
int
ClientTurn::getHighestSet() const
ClientBeRoTurn::getHighestSet() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return highestSet;
}
void
ClientTurn::setFirstTurnRound(bool theValue)
ClientBeRoTurn::setFirstTurnRound(bool theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
firstTurnRound = theValue;
}
bool
ClientTurn::getFirstTurnRound() const
ClientBeRoTurn::getFirstTurnRound() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return firstTurnRound;
}
void
ClientTurn::setSmallBlindPosition(int theValue)
ClientBeRoTurn::setSmallBlindPosition(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
smallBlindPosition = theValue;
}
int
ClientTurn::getSmallBlindPosition() const
ClientBeRoTurn::getSmallBlindPosition() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return smallBlindPosition;
}
void
ClientTurn::setSmallBlind(int theValue)
ClientBeRoTurn::setSmallBlind(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
smallBlind = theValue;
}
int
ClientTurn::getSmallBlind() const
ClientBeRoTurn::getSmallBlind() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return smallBlind;
}
void
ClientTurn::resetFirstRun()
ClientBeRoTurn::resetFirstRun()
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
firstTurnRun = false;
}
void
ClientTurn::turnRun()
{
}
void
ClientTurn::nextPlayer2()
ClientBeRoTurn::run()
{
}
+18 -6
View File
@@ -19,15 +19,17 @@
#ifndef CLIENTTURN_H
#define CLIENTTURN_H
#include <turninterface.h>
#include <berointerface.h>
#include <boost/thread.hpp>
class HandInterface;
class ClientTurn : public TurnInterface{
class ClientBeRoTurn : public BeRoInterface{
public:
ClientTurn(HandInterface*, int, int, int, int);
~ClientTurn();
ClientBeRoTurn(HandInterface*, int, int, int, int);
~ClientBeRoTurn();
int getMyBeRoID() const;
void setPlayersTurn(int theValue);
int getPlayersTurn() const;
@@ -44,10 +46,20 @@ public:
void setSmallBlind(int theValue);
int getSmallBlind() const;
void setHighestCardsValue(int theValue) {}
int getHighestCardsValue() const {return 0;}
void resetFirstRun();
void turnRun();
void nextPlayer2();
void run();
void preflopRun() {}
void flopRun() {}
void turnRun() {}
void riverRun() {}
void postRiverRun() {}
void nextPlayer2() {}
private:
mutable boost::recursive_mutex m_syncMutex;
+33 -2
View File
@@ -340,6 +340,22 @@ ServerRecvStateInit::InternalProcess(ServerRecvThread &server, SessionWrapper se
}
else if (packet->ToNetPacketStartEvent())
{
boost::shared_ptr<PlayerData> tmpPlayerData(
new PlayerData(m_curUniquePlayerId++, 0, PLAYER_TYPE_COMPUTER, PLAYER_RIGHTS_NORMAL));
tmpPlayerData->SetName("Computer");
// Send "Player Joined" to other fully connected clients.
boost::shared_ptr<NetPacket> thisPlayerJoined(new NetPacketPlayerJoined);
NetPacketPlayerJoined::Data thisPlayerJoinedData;
thisPlayerJoinedData.playerId = tmpPlayerData->GetUniqueId();
thisPlayerJoinedData.playerName = tmpPlayerData->GetName();
thisPlayerJoinedData.ptype = tmpPlayerData->GetType();
thisPlayerJoinedData.prights = tmpPlayerData->GetRights();
static_cast<NetPacketPlayerJoined *>(thisPlayerJoined.get())->SetData(thisPlayerJoinedData);
server.SendToAllPlayers(thisPlayerJoined);
server.AddComputerPlayer(tmpPlayerData);
server.InternalStartGame();
server.SetState(SERVER_START_GAME_STATE::Instance());
}
@@ -762,11 +778,17 @@ ServerRecvStateWaitPlayerAction::Process(ServerRecvThread &server)
{
int retVal;
// If the player we are waiting for left, continue without him.
PlayerInterface *tmpPlayer = GetCurrentPlayer(server.GetGame());
assert(tmpPlayer);
assert(!tmpPlayer->getMyName().empty());
if (!server.IsPlayerConnected(tmpPlayer->getMyName()))
// If the player is computer controlled, let the engine act.
if (tmpPlayer->getMyType() == PLAYER_TYPE_COMPUTER)
{
tmpPlayer->action();
}
// If the player we are waiting for left, continue without him.
else if (!server.IsPlayerConnected(tmpPlayer->getMyName()))
{
PerformPlayerAction(server, tmpPlayer, PLAYER_ACTION_FOLD, 0);
@@ -832,6 +854,15 @@ ServerRecvStateWaitPlayerAction::PerformPlayerAction(ServerRecvThread &server, P
curGame.getCurrentHand()->getBoard()->collectSets();
}
SendPlayerAction(server, player);
}
void
ServerRecvStateWaitPlayerAction::SendPlayerAction(ServerRecvThread &server, PlayerInterface *player)
{
Game &curGame = server.GetGame();
assert(player);
boost::shared_ptr<NetPacket> notifyActionDone(new NetPacketPlayersActionDone);
NetPacketPlayersActionDone::Data actionDoneData;
actionDoneData.gameState = static_cast<GameState>(curGame.getCurrentHand()->getActualRound());
+9 -1
View File
@@ -469,7 +469,7 @@ ServerRecvThread::RemoveDisconnectedPlayers()
for (int i = 0; i < m_game->getStartQuantityPlayers(); i++)
{
PlayerInterface *tmpPlayer = m_game->getPlayerArray()[i];
if (!IsPlayerConnected(tmpPlayer->getMyUniqueID()))
if (!IsPlayerConnected(tmpPlayer->getMyUniqueID()) && tmpPlayer->getMyType() == PLAYER_TYPE_HUMAN)
{
tmpPlayer->setMyCash(0);
tmpPlayer->setMyActiveStatus(false);
@@ -479,6 +479,12 @@ ServerRecvThread::RemoveDisconnectedPlayers()
}
}
void
ServerRecvThread::AddComputerPlayer(boost::shared_ptr<PlayerData> player)
{
m_computerPlayers.push_back(player);
}
size_t
ServerRecvThread::GetCurNumberOfPlayers() const
{
@@ -552,6 +558,8 @@ ServerRecvThread::GetPlayerDataList() const
}
++session_i;
}
if (!m_computerPlayers.empty())
playerList.insert(playerList.end(), m_computerPlayers.begin(), m_computerPlayers.end());
return playerList;
}
+1
View File
@@ -208,6 +208,7 @@ protected:
virtual int InternalProcess(ServerRecvThread &server, SessionWrapper session, boost::shared_ptr<NetPacket> packet);
static void PerformPlayerAction(ServerRecvThread &server, PlayerInterface *player, PlayerAction action, int bet);
static void SendPlayerAction(ServerRecvThread &server, PlayerInterface *player);
static int GetHighestSet(Game &curGame);
static void SetHighestSet(Game &curGame, int highestSet);
};
+4
View File
@@ -112,6 +112,8 @@ protected:
void RemoveNotEstablishedSessions();
void RemoveDisconnectedPlayers();
void AddComputerPlayer(boost::shared_ptr<PlayerData> player);
size_t GetCurNumberOfPlayers() const;
bool IsPlayerConnected(const std::string &playerName) const;
bool IsPlayerConnected(unsigned uniquePlayerId) const;
@@ -147,6 +149,8 @@ private:
SocketSessionMap m_sessionMap;
mutable boost::mutex m_sessionMapMutex;
PlayerDataList m_computerPlayers;
CloseSessionList m_closeSessionList;
std::auto_ptr<ReceiverHelper> m_receiver;