Save Steam user name for accounts connected to steam.
This commit is contained in:
parent
d651e0c710
commit
31f970f625
@ -264,6 +264,8 @@ bool PlayerManager::checkSteamAccount(const irr::core::stringw ¤t_name)
|
|||||||
} // if steam and current name are different
|
} // if steam and current name are different
|
||||||
|
|
||||||
m_current_player = getPlayer(i);
|
m_current_player = getPlayer(i);
|
||||||
|
// Update the steam name in case that the user did a rename
|
||||||
|
m_current_player->setSteamName(Steam::get()->getUserNameWchar());
|
||||||
return true;
|
return true;
|
||||||
} // same steam user id
|
} // same steam user id
|
||||||
} // for i in m_all_players
|
} // for i in m_all_players
|
||||||
@ -279,8 +281,10 @@ bool PlayerManager::checkSteamAccount(const irr::core::stringw ¤t_name)
|
|||||||
Log::warn("PlayerManager",
|
Log::warn("PlayerManager",
|
||||||
"Connecting '%ls' to current steam account '%ls'.",
|
"Connecting '%ls' to current steam account '%ls'.",
|
||||||
current_name.c_str(), steam_name.c_str());
|
current_name.c_str(), steam_name.c_str());
|
||||||
m_all_players[i].setSteamUserID(steam_id);
|
|
||||||
m_current_player = getPlayer(i);
|
m_current_player = getPlayer(i);
|
||||||
|
m_current_player->setSteamUserID(steam_id);
|
||||||
|
m_current_player->setSteamName(steam_name);
|
||||||
return true;
|
return true;
|
||||||
} // if steam and current name are different
|
} // if steam and current name are different
|
||||||
} // for i in m_all_players
|
} // for i in m_all_players
|
||||||
|
@ -40,13 +40,16 @@ PlayerProfile::PlayerProfile(const core::stringw& name, bool is_guest)
|
|||||||
m_magic_number = 0xABCD1234;
|
m_magic_number = 0xABCD1234;
|
||||||
#endif
|
#endif
|
||||||
if(Steam::get()->isSteamAvailable() &&
|
if(Steam::get()->isSteamAvailable() &&
|
||||||
name == StringUtils::utf8ToWide(Steam::get()->getUserName()) )
|
name == Steam::get()->getUserNameWchar() )
|
||||||
{
|
{
|
||||||
m_steam_id = Steam::get()->getSteamID();
|
m_steam_id = Steam::get()->getSteamID();
|
||||||
|
m_steam_name = Steam::get()->getUserNameWchar();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_steam_id = "";
|
m_steam_id = "";
|
||||||
|
m_steam_name = "";
|
||||||
|
}
|
||||||
m_local_name = name;
|
m_local_name = name;
|
||||||
m_is_guest_account = is_guest;
|
m_is_guest_account = is_guest;
|
||||||
m_use_frequency = is_guest ? -1 : 0;
|
m_use_frequency = is_guest ? -1 : 0;
|
||||||
@ -78,6 +81,7 @@ PlayerProfile::PlayerProfile(const core::stringw& name, bool is_guest)
|
|||||||
PlayerProfile::PlayerProfile(const XMLNode* node)
|
PlayerProfile::PlayerProfile(const XMLNode* node)
|
||||||
{
|
{
|
||||||
m_steam_id = "";
|
m_steam_id = "";
|
||||||
|
m_steam_name = "";
|
||||||
m_saved_session = false;
|
m_saved_session = false;
|
||||||
m_saved_token = "";
|
m_saved_token = "";
|
||||||
m_saved_user_id = 0;
|
m_saved_user_id = 0;
|
||||||
@ -90,6 +94,7 @@ PlayerProfile::PlayerProfile(const XMLNode* node)
|
|||||||
|
|
||||||
node->getAndDecode("name", &m_local_name );
|
node->getAndDecode("name", &m_local_name );
|
||||||
node->get("steam-id", &m_steam_id );
|
node->get("steam-id", &m_steam_id );
|
||||||
|
node->get("steam-name", &m_steam_name );
|
||||||
node->get("guest", &m_is_guest_account );
|
node->get("guest", &m_is_guest_account );
|
||||||
node->get("use-frequency", &m_use_frequency );
|
node->get("use-frequency", &m_use_frequency );
|
||||||
node->get("unique-id", &m_unique_id );
|
node->get("unique-id", &m_unique_id );
|
||||||
@ -230,7 +235,9 @@ void PlayerProfile::save(UTFWriter &out)
|
|||||||
<< L"\" guest=\"" << m_is_guest_account
|
<< L"\" guest=\"" << m_is_guest_account
|
||||||
<< L"\" use-frequency=\"" << m_use_frequency << L"\"\n";
|
<< L"\" use-frequency=\"" << m_use_frequency << L"\"\n";
|
||||||
|
|
||||||
out << L" steam-id=\"" << m_steam_id << L"\"\n";
|
out << L" steam-id=\"" << m_steam_id
|
||||||
|
<< L"\" steam-name=\"" << m_steam_name << L"\"\n";
|
||||||
|
|
||||||
out << L" icon-filename=\"" << m_icon_filename << L"\"\n";
|
out << L" icon-filename=\"" << m_icon_filename << L"\"\n";
|
||||||
|
|
||||||
out << L" unique-id=\"" << m_unique_id
|
out << L" unique-id=\"" << m_unique_id
|
||||||
|
@ -102,6 +102,10 @@ private:
|
|||||||
* the user is logged into steam! */
|
* the user is logged into steam! */
|
||||||
std::string m_steam_id;
|
std::string m_steam_id;
|
||||||
|
|
||||||
|
/** Name of the corresponding steam account. Empty if this is
|
||||||
|
* not a steam account. */
|
||||||
|
core::stringw m_steam_name;
|
||||||
|
|
||||||
/** The online user name used last (empty if not used online). */
|
/** The online user name used last (empty if not used online). */
|
||||||
core::stringw m_last_online_name;
|
core::stringw m_last_online_name;
|
||||||
|
|
||||||
@ -314,6 +318,13 @@ public:
|
|||||||
/** Sets the steam user id of this player. */
|
/** Sets the steam user id of this player. */
|
||||||
void setSteamUserID(const std::string &id) { m_steam_id = id; }
|
void setSteamUserID(const std::string &id) { m_steam_id = id; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
/** Returns the steam name of the connected steam account (or "" if
|
||||||
|
* this account is not a steam account. */
|
||||||
|
const core::stringw &getSteamName() const { return m_steam_name; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Sets the steam name of this account. */
|
||||||
|
void setSteamName(const core::stringw &name) { m_steam_name = name; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
}; // class PlayerProfile
|
}; // class PlayerProfile
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user