When a player logs in with an online account, reset any other saved

session for this online account (since these token are now invalid).
This commit is contained in:
hiker
2014-05-22 08:21:41 +10:00
parent f4688fa621
commit de8c6ac8b8

View File

@@ -139,6 +139,23 @@ namespace Online
PlayerManager::getCurrentPlayer()->signIn(isSuccess(), getXMLData());
GUIEngine::Screen *screen = GUIEngine::getCurrentScreen();
BaseUserScreen *login = dynamic_cast<BaseUserScreen*>(screen);
// If the login is successful, reset any saved session of other
// local players using the same online account (which are now invalid)
if(isSuccess())
{
PlayerProfile *current = PlayerManager::getCurrentPlayer();
for(unsigned int i=0; i<PlayerManager::get()->getNumPlayers(); i++)
{
PlayerProfile *player = PlayerManager::get()->getPlayer(i);
if(player!=current &&
player->hasSavedSession() &&
player->getLastOnlineName() == current->getLastOnlineName())
{
player->clearSession();
}
}
}
if(login)
{
if(isSuccess())