Always use default name Player in mobile STK

This commit is contained in:
Benau 2019-12-29 10:44:13 +08:00
parent 8e19e96a9e
commit 44d2127800
2 changed files with 8 additions and 0 deletions

View File

@ -349,6 +349,9 @@ void PlayerManager::addDefaultPlayer()
{
core::stringw username = "Player";
#ifndef MOBILE_STK
// For mobile stk always use the name Player as in iOS the following
// getenv return "mobile" for some reason
#if defined(WIN32)
std::vector<wchar_t> env;
// An environment variable has a maximum size limit of 32,767 characters
@ -361,6 +364,7 @@ void PlayerManager::addDefaultPlayer()
username = getenv("USER");
else if (getenv("LOGNAME") != NULL) // Linux, Macs
username = getenv("LOGNAME");
#endif
#endif
// Set the name as the default name, but don't mark it as 'default'

View File

@ -89,6 +89,9 @@ void RegisterScreen::init()
}
else if (PlayerManager::get()->getNumPlayers() == 0)
{
#ifndef MOBILE_STK
// For mobile stk always use the name Player as in iOS the following
// getenv return "mobile" for some reason
#if defined(WIN32)
std::vector<wchar_t> env;
// An environment variable has a maximum size limit of 32,767 characters
@ -101,6 +104,7 @@ void RegisterScreen::init()
username = getenv("USER");
else if (getenv("LOGNAME") != NULL) // Linux, Macs
username = getenv("LOGNAME");
#endif
#endif
}