fixed
This commit is contained in:
+1
-1
@@ -113,7 +113,7 @@ Game::~Game()
|
|||||||
delete actualHand;
|
delete actualHand;
|
||||||
actualHand = 0;
|
actualHand = 0;
|
||||||
|
|
||||||
// PlayerInterface *tempPlayer;
|
// boost::shared_ptr<PlayerInterface> tempPlayer;
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
// tempPlayer = playerArray[i];
|
// tempPlayer = playerArray[i];
|
||||||
// playerArray[i] = 0;
|
// playerArray[i] = 0;
|
||||||
|
|||||||
+1
-1
@@ -82,7 +82,7 @@ private:
|
|||||||
HandInterface *actualHand;
|
HandInterface *actualHand;
|
||||||
BoardInterface *actualBoard;
|
BoardInterface *actualBoard;
|
||||||
std::vector<boost::shared_ptr<PlayerInterface> > playerArray;
|
std::vector<boost::shared_ptr<PlayerInterface> > playerArray;
|
||||||
// PlayerInterface *playerArray[MAX_NUMBER_OF_PLAYERS];
|
// boost::shared_ptr<PlayerInterface> playerArray[MAX_NUMBER_OF_PLAYERS];
|
||||||
|
|
||||||
//Startvariablen
|
//Startvariablen
|
||||||
int startQuantityPlayers;
|
int startQuantityPlayers;
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
|||||||
{
|
{
|
||||||
assert(newRound > curRound);
|
assert(newRound > curRound);
|
||||||
// Retrieve active players. If only one player is left, no cards are shown.
|
// Retrieve active players. If only one player is left, no cards are shown.
|
||||||
std::list<PlayerInterface *> activePlayers = GetActivePlayers(curGame);
|
std::list<boost::shared_ptr<PlayerInterface> > activePlayers = GetActivePlayers(curGame);
|
||||||
|
|
||||||
if (curGame.getCurrentHand()->getAllInCondition()
|
if (curGame.getCurrentHand()->getAllInCondition()
|
||||||
&& !curGame.getCurrentHand()->getCardsShown()
|
&& !curGame.getCurrentHand()->getCardsShown()
|
||||||
@@ -557,8 +557,8 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
|||||||
boost::shared_ptr<NetPacket> allIn(new NetPacketAllInShowCards);
|
boost::shared_ptr<NetPacket> allIn(new NetPacketAllInShowCards);
|
||||||
NetPacketAllInShowCards::Data allInData;
|
NetPacketAllInShowCards::Data allInData;
|
||||||
|
|
||||||
std::list<PlayerInterface *>::iterator i = activePlayers.begin();
|
std::list<boost::shared_ptr<PlayerInterface> >::iterator i = activePlayers.begin();
|
||||||
std::list<PlayerInterface *>::iterator end = activePlayers.end();
|
std::list<boost::shared_ptr<PlayerInterface> >::iterator end = activePlayers.end();
|
||||||
|
|
||||||
while (i != end)
|
while (i != end)
|
||||||
{
|
{
|
||||||
@@ -617,13 +617,13 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
|||||||
curGame.getCurrentHand()->getCurrentBeRo()->run();
|
curGame.getCurrentHand()->getCurrentBeRo()->run();
|
||||||
|
|
||||||
// Retrieve active players. If only one player is left, no cards are shown.
|
// Retrieve active players. If only one player is left, no cards are shown.
|
||||||
std::list<PlayerInterface *> activePlayers = GetActivePlayers(curGame);
|
std::list<boost::shared_ptr<PlayerInterface> > activePlayers = GetActivePlayers(curGame);
|
||||||
// if (activePlayers.empty()) TODO throw exception
|
// if (activePlayers.empty()) TODO throw exception
|
||||||
|
|
||||||
if (activePlayers.size() == 1)
|
if (activePlayers.size() == 1)
|
||||||
{
|
{
|
||||||
// End of Hand, but keep cards hidden.
|
// End of Hand, but keep cards hidden.
|
||||||
PlayerInterface *player = activePlayers.front();
|
boost::shared_ptr<PlayerInterface> player = activePlayers.front();
|
||||||
boost::shared_ptr<NetPacket> endHand(new NetPacketEndOfHandHideCards);
|
boost::shared_ptr<NetPacket> endHand(new NetPacketEndOfHandHideCards);
|
||||||
NetPacketEndOfHandHideCards::Data endHandData;
|
NetPacketEndOfHandHideCards::Data endHandData;
|
||||||
endHandData.playerId = player->getMyUniqueID();
|
endHandData.playerId = player->getMyUniqueID();
|
||||||
@@ -639,8 +639,8 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
|||||||
boost::shared_ptr<NetPacket> endHand(new NetPacketEndOfHandShowCards);
|
boost::shared_ptr<NetPacket> endHand(new NetPacketEndOfHandShowCards);
|
||||||
NetPacketEndOfHandShowCards::Data endHandData;
|
NetPacketEndOfHandShowCards::Data endHandData;
|
||||||
|
|
||||||
std::list<PlayerInterface *>::iterator i = activePlayers.begin();
|
std::list<boost::shared_ptr<PlayerInterface> >::iterator i = activePlayers.begin();
|
||||||
std::list<PlayerInterface *>::iterator end = activePlayers.end();
|
std::list<boost::shared_ptr<PlayerInterface> >::iterator end = activePlayers.end();
|
||||||
|
|
||||||
while (i != end)
|
while (i != end)
|
||||||
{
|
{
|
||||||
@@ -778,7 +778,7 @@ ServerRecvStateWaitPlayerAction::InternalProcess(ServerRecvThread &server, Sessi
|
|||||||
packet->ToNetPacketPlayersAction()->GetData(actionData);
|
packet->ToNetPacketPlayersAction()->GetData(actionData);
|
||||||
|
|
||||||
Game &curGame = server.GetGame();
|
Game &curGame = server.GetGame();
|
||||||
PlayerInterface *tmpPlayer = curGame.getPlayerByUniqueId(session.playerData->GetUniqueId());
|
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame.getPlayerByUniqueId(session.playerData->GetUniqueId());
|
||||||
assert(tmpPlayer); // TODO throw exception
|
assert(tmpPlayer); // TODO throw exception
|
||||||
// TODO: check whether this is the correct player
|
// TODO: check whether this is the correct player
|
||||||
// TODO: check game state
|
// TODO: check game state
|
||||||
@@ -793,7 +793,7 @@ ServerRecvStateWaitPlayerAction::InternalProcess(ServerRecvThread &server, Sessi
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerRecvStateWaitPlayerAction::PerformPlayerAction(ServerRecvThread &server, PlayerInterface *player, PlayerAction action, int bet)
|
ServerRecvStateWaitPlayerAction::PerformPlayerAction(ServerRecvThread &server, boost::shared_ptr<PlayerInterface> player, PlayerAction action, int bet)
|
||||||
{
|
{
|
||||||
Game &curGame = server.GetGame();
|
Game &curGame = server.GetGame();
|
||||||
assert(player);
|
assert(player);
|
||||||
@@ -813,7 +813,7 @@ ServerRecvStateWaitPlayerAction::PerformPlayerAction(ServerRecvThread &server, P
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerRecvStateWaitPlayerAction::SendPlayerAction(ServerRecvThread &server, PlayerInterface *player)
|
ServerRecvStateWaitPlayerAction::SendPlayerAction(ServerRecvThread &server, boost::shared_ptr<PlayerInterface> player)
|
||||||
{
|
{
|
||||||
Game &curGame = server.GetGame();
|
Game &curGame = server.GetGame();
|
||||||
assert(player);
|
assert(player);
|
||||||
@@ -980,7 +980,7 @@ ServerRecvStateNextGameDelay::Process(ServerRecvThread &server)
|
|||||||
{
|
{
|
||||||
Game &curGame = server.GetGame();
|
Game &curGame = server.GetGame();
|
||||||
// The game has ended. Notify all clients.
|
// The game has ended. Notify all clients.
|
||||||
PlayerInterface *winnerPlayer = NULL;
|
boost::shared_ptr<PlayerInterface> winnerPlayer;
|
||||||
for (int i = 0; i < curGame.getStartQuantityPlayers(); i++)
|
for (int i = 0; i < curGame.getStartQuantityPlayers(); i++)
|
||||||
{
|
{
|
||||||
winnerPlayer = curGame.getCurrentHand()->getPlayerArray()[i];
|
winnerPlayer = curGame.getCurrentHand()->getPlayerArray()[i];
|
||||||
|
|||||||
@@ -206,8 +206,8 @@ protected:
|
|||||||
|
|
||||||
virtual int InternalProcess(ServerRecvThread &server, SessionWrapper session, boost::shared_ptr<NetPacket> packet);
|
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 PerformPlayerAction(ServerRecvThread &server, boost::shared_ptr<PlayerInterface> player, PlayerAction action, int bet);
|
||||||
static void SendPlayerAction(ServerRecvThread &server, PlayerInterface *player);
|
static void SendPlayerAction(ServerRecvThread &server, boost::shared_ptr<PlayerInterface> player);
|
||||||
};
|
};
|
||||||
|
|
||||||
// State: Delay after dealing cards
|
// State: Delay after dealing cards
|
||||||
|
|||||||
Reference in New Issue
Block a user