This commit is contained in:
deve 2014-10-08 14:04:38 +02:00
commit 95483268cf
4 changed files with 10 additions and 5 deletions

View File

@ -170,7 +170,11 @@ PlayerManager::~PlayerManager()
for_var_in(PlayerProfile*, player, m_all_players)
{
if(!player->rememberPassword())
player->clearSession();
{
// Don't let the player trigger a save, since it
// will be done below anyway.
player->clearSession(/*save*/false);
}
}
save();

View File

@ -235,12 +235,13 @@ void PlayerProfile::saveSession(int user_id, const std::string &token)
// ------------------------------------------------------------------------
/** Unsets any saved session data. */
void PlayerProfile::clearSession()
void PlayerProfile::clearSession(bool save)
{
m_saved_session = false;
m_saved_user_id = 0;
m_saved_token = "";
PlayerManager::get()->save();
if(save)
PlayerManager::get()->save();
} // clearSession
//------------------------------------------------------------------------------

View File

@ -121,7 +121,7 @@ public:
bool operator<(const PlayerProfile &other);
void raceFinished();
void saveSession(int user_id, const std::string &token);
void clearSession();
void clearSession(bool save=true);
void addIcon();
/** Abstract virtual classes, to be implemented by the OnlinePlayer. */

View File

@ -436,7 +436,7 @@ bool onEvent(const SEvent &event)
else if (cmdID == DEBUG_HIDE_KARTS)
{
if (!world) return false;
for (int n = 0; n<world->getNumKarts(); n++)
for (unsigned int n = 0; n<world->getNumKarts(); n++)
{
AbstractKart* kart = world->getKart(n);
if (kart->getController()->isPlayerController())