[Dvar] Revert d528a2c5 and set name from steam

This commit is contained in:
momo5502 2017-02-10 10:19:36 +01:00
parent ee06e79a28
commit a15ac958a3

View File

@ -163,7 +163,19 @@ namespace Components
} }
}); });
return Dvar::Register<const char*>(name, "Unknown Soldier", Dvar::Flag(flag | Game::dvar_flag::DVAR_FLAG_SAVED).val, description).get<Game::dvar_t*>(); std::string username = "Unknown Soldier";
if (Steam::Proxy::SteamFriends)
{
const char* steamName = Steam::Proxy::SteamFriends->GetPersonaName();
if (steamName && !std::string(steamName).empty())
{
username = steamName;
}
}
return Dvar::Register<const char*>(name, username.data(), Dvar::Flag(flag | Game::dvar_flag::DVAR_FLAG_SAVED).val, description).get<Game::dvar_t*>();
} }
Dvar::Dvar() Dvar::Dvar()