More work on rejoin: The server now detects when a rejoin is possible and allows the player to login directly, without waiting for a possible existing connection to be terminated. A session GUID is stored in the cache directory on client side for this purpose.

This commit is contained in:
lotodore
2011-08-28 17:14:03 +00:00
parent 0a49783889
commit 32ba77709e
18 changed files with 195 additions and 24 deletions
+18
View File
@@ -78,6 +78,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
string myName;
string myAvatarFile;
string myGuid;
unsigned uniqueId = 0;
PlayerType type = PLAYER_TYPE_COMPUTER;
@@ -86,12 +87,14 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
type = (*player_i)->GetType();
myName = (*player_i)->GetName();
myAvatarFile = (*player_i)->GetAvatarFile();
myGuid = (*player_i)->GetGuid();
++player_i;
}
// create player objects
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0);
tmpPlayer->setIsConnected(true);
tmpPlayer->setMyGuid(myGuid);
// fill player lists
seatsList->push_back(tmpPlayer);
@@ -219,6 +222,21 @@ boost::shared_ptr<PlayerInterface> Game::getCurrentPlayer()
return tmpPlayer;
}
boost::shared_ptr<PlayerInterface> Game::getPlayerByName(const std::string &name)
{
boost::shared_ptr<PlayerInterface> tmpPlayer;
PlayerListIterator i = getSeatsList()->begin();
PlayerListIterator end = getSeatsList()->end();
while (i != end) {
if ((*i)->getMyName() == name) {
tmpPlayer = *i;
break;
}
++i;
}
return tmpPlayer;
}
void Game::raiseBlinds()
{