diff --git a/src/config/player_manager.cpp b/src/config/player_manager.cpp index 8d6322fd8..f4e23ffc2 100644 --- a/src/config/player_manager.cpp +++ b/src/config/player_manager.cpp @@ -190,7 +190,6 @@ void PlayerManager::load() return; } - m_current_player = NULL; std::vector player_list; m_player_data->getNodes("player", player_list); for(unsigned int i=0; iisDefault()) - m_current_player = player; + } + m_current_player = NULL; + const XMLNode *current = m_player_data->getNode("current"); + if(current) + { + stringw name; + current->get("player", &name); + m_current_player = getPlayer(name); } } // load @@ -250,6 +255,12 @@ void PlayerManager::save() players_file << L"\n"; players_file << L"\n"; + if(m_current_player && UserConfigParams::m_remember_user) + { + players_file << L" getName() << L"\"/>\n"; + } + PlayerProfile *player; for_in(player, m_all_players) { @@ -404,23 +415,14 @@ PlayerProfile *PlayerManager::getPlayer(const irr::core::stringw &name) } // getPlayer // ---------------------------------------------------------------------------- /** Sets the current player. This is the player that is used for story mode - * and achievements. If 'remember_me' is set, this information will be - * stored in the players.xml file, and automatically loaded next time - * STK is started. + * and achievements. * \param Player profile to be the current player. - * \param remember_me If this player should be marked as default - * player in players.xml */ void PlayerManager::setCurrentPlayer(PlayerProfile *player) { - bool remember_me = UserConfigParams::m_remember_user; - // Reset current default player - if(m_current_player) - m_current_player->setDefault(false); m_current_player = player; if(m_current_player) { - m_current_player->setDefault(remember_me); m_current_player->computeActive(); } } // setCurrentPlayer diff --git a/src/config/player_profile.cpp b/src/config/player_profile.cpp index bdf6224ac..1ff5c8534 100644 --- a/src/config/player_profile.cpp +++ b/src/config/player_profile.cpp @@ -43,8 +43,6 @@ PlayerProfile::PlayerProfile(const core::stringw& name, bool is_guest) m_is_guest_account = is_guest; m_use_frequency = is_guest ? -1 : 0; m_unique_id = PlayerManager::get()->getUniqueId(); - m_is_default = false; - m_is_default = false; m_saved_session = false; m_saved_token = ""; m_saved_user_id = 0; @@ -80,7 +78,6 @@ PlayerProfile::PlayerProfile(const XMLNode* node) node->get("guest", &m_is_guest_account); node->get("use-frequency", &m_use_frequency ); node->get("unique-id", &m_unique_id ); - node->get("is-default", &m_is_default ); node->get("saved-session", &m_saved_session ); node->get("saved-user", &m_saved_user_id ); node->get("saved-token", &m_saved_token ); @@ -136,8 +133,7 @@ void PlayerProfile::save(UTFWriter &out) << L"\" guest=\"" << m_is_guest_account << L"\" use-frequency=\"" << m_use_frequency << L"\"\n"; - out << L" is-default=\"" << m_is_default - << L"\" unique-id=\"" << m_unique_id + out << L" unique-id=\"" << m_unique_id << L"\" saved-session=\"" << m_saved_session << L"\"\n"; out << L" saved-user=\"" << m_saved_user_id diff --git a/src/config/player_profile.hpp b/src/config/player_profile.hpp index d68dc04ec..5d5b67910 100644 --- a/src/config/player_profile.hpp +++ b/src/config/player_profile.hpp @@ -83,9 +83,6 @@ private: /** A unique number for this player, used to link it to challenges etc. */ unsigned int m_unique_id; - /** True if this is the default (last used) player. */ - bool m_is_default; - /** True if this user has a saved session. */ bool m_saved_session; @@ -177,12 +174,6 @@ public: // ------------------------------------------------------------------------ /** Returns the unique id of this player. */ unsigned int getUniqueID() const { return m_unique_id; } - // ----------------------------------------------------------------------- - /** Returns true if this is the default (last used) player. */ - bool isDefault() const { return m_is_default; } - // ------------------------------------------------------------------------ - /** Sets if this player is the default player or not. */ - void setDefault(bool is_default) { m_is_default = is_default; } // ------------------------------------------------------------------------ /** Returnes if the feature (kart, track) is locked. */ bool isLocked(const std::string &feature) const