This commit is contained in:
doitux
2007-08-10 23:34:56 +00:00
parent a9a2d33e3f
commit 7a0ae803e2
12 changed files with 28 additions and 26 deletions
+6 -6
View File
@@ -575,7 +575,7 @@ ClientStateWaitHand::InternalProcess(ClientThread &client, boost::shared_ptr<Net
{
NetPacketEndOfGame::Data endData;
packet->ToNetPacketEndOfGame()->GetData(endData);
PlayerInterface *tmpPlayer = curGame->getPlayerByUniqueId(endData.winnerPlayerId);
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId(endData.winnerPlayerId);
if (!tmpPlayer)
throw ClientException(ERR_NET_UNKNOWN_PLAYER_ID, 0);
client.GetGui().logPlayerWinGame(tmpPlayer->getMyName(), curGame->getMyGameID());
@@ -618,7 +618,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
{
NetPacketPlayersActionDone::Data actionDoneData;
packet->ToNetPacketPlayersActionDone()->GetData(actionDoneData);
PlayerInterface *tmpPlayer = curGame->getPlayerByUniqueId(actionDoneData.playerId);
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId(actionDoneData.playerId);
if (!tmpPlayer)
throw ClientException(ERR_NET_UNKNOWN_PLAYER_ID, 0);
@@ -667,7 +667,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
{
NetPacketPlayersTurn::Data turnData;
packet->ToNetPacketPlayersTurn()->GetData(turnData);
PlayerInterface *tmpPlayer = curGame->getPlayerByUniqueId(turnData.playerId);
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId(turnData.playerId);
if (!tmpPlayer)
throw ClientException(ERR_NET_UNKNOWN_PLAYER_ID, 0);
@@ -759,7 +759,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
while (i != end)
{
PlayerInterface *tmpPlayer = curGame->getPlayerByUniqueId((*i).playerId);
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId((*i).playerId);
if (!tmpPlayer)
throw ClientException(ERR_NET_UNKNOWN_PLAYER_ID, 0);
@@ -786,7 +786,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
NetPacketEndOfHandHideCards::Data endHandData;
packet->ToNetPacketEndOfHandHideCards()->GetData(endHandData);
PlayerInterface *tmpPlayer = curGame->getPlayerByUniqueId(endHandData.playerId);
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId(endHandData.playerId);
if (!tmpPlayer)
throw ClientException(ERR_NET_UNKNOWN_PLAYER_ID, 0);
@@ -823,7 +823,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
int highestValueOfCards = 0;
while (i != end)
{
PlayerInterface *tmpPlayer = curGame->getPlayerByUniqueId((*i).playerId);
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId((*i).playerId);
if (!tmpPlayer)
throw ClientException(ERR_NET_UNKNOWN_PLAYER_ID, 0);
+1 -1
View File
@@ -418,7 +418,7 @@ ClientThread::RemoveDisconnectedPlayers()
{
for (int i = 0; i < m_game->getStartQuantityPlayers(); i++)
{
PlayerInterface *tmpPlayer = m_game->getPlayerArray()[i];
boost::shared_ptr<PlayerInterface> tmpPlayer = m_game->getPlayerArray()[i];
if (tmpPlayer->getMyActiveStatus())
{
// If a player is not in the player data list, it was disconnected.
+6 -6
View File
@@ -45,7 +45,7 @@ using namespace std;
// Helper functions
// TODO: these are hacks.
static PlayerInterface *GetCurrentPlayer(Game &curGame)
static boost::shared_ptr<PlayerInterface> GetCurrentPlayer(Game &curGame)
{
int curPlayerNum = curGame.getCurrentHand()->getCurrentBeRo()->getPlayersTurn();
assert(curPlayerNum < curGame.getStartQuantityPlayers()); // TODO: throw exception
@@ -450,7 +450,7 @@ ServerRecvStateStartHand::Process(ServerRecvThread &server)
curGame.getCurrentHand()->getTurn()->resetFirstRun();
curGame.getCurrentHand()->getRiver()->resetFirstRun();
PlayerInterface **playerArray = curGame.getPlayerArray();
std::vector<boost::shared_ptr<PlayerInterface> >playerArray = curGame.getPlayerArray();
// Send cards to all players.
for (int i = 0; i < curGame.getStartQuantityPlayers(); i++)
@@ -595,7 +595,7 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
assert (!curGame.getCurrentHand()->getAllInCondition()); // this would be an error.
// Retrieve current player.
PlayerInterface *curPlayer = GetCurrentPlayer(curGame);
boost::shared_ptr<PlayerInterface> curPlayer = GetCurrentPlayer(curGame);
assert(curPlayer); // TODO throw exception
assert(curPlayer->getMyActiveStatus()); // TODO throw exception
@@ -696,10 +696,10 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
return retVal;
}
std::list<PlayerInterface *>
std::list<boost::shared_ptr<PlayerInterface> >
ServerRecvStateStartRound::GetActivePlayers(Game &curGame)
{
std::list<PlayerInterface *> activePlayers;
std::list<boost::shared_ptr<PlayerInterface> > activePlayers;
for (int i = 0; i < curGame.getStartQuantityPlayers() ; i++)
{
if (curGame.getPlayerArray()[i]->getMyActiveStatus()
@@ -733,7 +733,7 @@ ServerRecvStateWaitPlayerAction::Process(ServerRecvThread &server)
{
int retVal;
PlayerInterface *tmpPlayer = GetCurrentPlayer(server.GetGame());
boost::shared_ptr<PlayerInterface> tmpPlayer = GetCurrentPlayer(server.GetGame());
assert(tmpPlayer);
assert(!tmpPlayer->getMyName().empty());
+1 -1
View File
@@ -468,7 +468,7 @@ ServerRecvThread::RemoveDisconnectedPlayers()
{
for (int i = 0; i < m_game->getStartQuantityPlayers(); i++)
{
PlayerInterface *tmpPlayer = m_game->getPlayerArray()[i];
boost::shared_ptr<PlayerInterface> tmpPlayer = m_game->getPlayerArray()[i];
if (!IsPlayerConnected(tmpPlayer->getMyUniqueID()) && tmpPlayer->getMyType() == PLAYER_TYPE_HUMAN)
{
tmpPlayer->setMyCash(0);