Only do default assignments of stk- to steam-accounts on first
start, after that use the saved settings (otherwise a user deciding to play without steam would get his setting overridden).
This commit is contained in:
parent
9d350ebaa6
commit
90f4855938
@ -270,28 +270,49 @@ bool PlayerManager::checkSteamAccount(const irr::core::stringw ¤t_name)
|
||||
} // same steam user id
|
||||
} // for i in m_all_players
|
||||
|
||||
for (unsigned int i = 0; i < m_all_players.size(); i++)
|
||||
// Now check for an existing account name that matches the steam name.
|
||||
// This is only done on the first time an STK version is running that
|
||||
// connects to steam. From then on the user must go to the user screen
|
||||
// to connect or disconnect STK accounts to steam accounts.
|
||||
if (UserConfigParams::m_steam_first_start)
|
||||
{
|
||||
// Ignore existing steam users, they must have a different id
|
||||
// (otherwise they would have been picked in the previous loop)
|
||||
if (m_all_players[i].isSteamUser()) continue;
|
||||
stringw name = m_all_players[i].getName();
|
||||
if (name.equals_ignore_case(steam_name))
|
||||
for (unsigned int i = 0; i < m_all_players.size(); i++)
|
||||
{
|
||||
Log::warn("PlayerManager",
|
||||
"Connecting '%ls' to current steam account '%ls'.",
|
||||
current_name.c_str(), steam_name.c_str());
|
||||
|
||||
m_current_player = getPlayer(i);
|
||||
m_current_player->setToCurrentSteamUser();
|
||||
return true;
|
||||
} // if steam and current name are different
|
||||
} // for i in m_all_players
|
||||
// Ignore existing steam users, they must have a different id
|
||||
// (otherwise they would have been picked in the previous loop)
|
||||
if (m_all_players[i].isSteamUser()) continue;
|
||||
stringw name = m_all_players[i].getName();
|
||||
if (name.equals_ignore_case(steam_name))
|
||||
{
|
||||
Log::warn("PlayerManager",
|
||||
"Connecting '%ls' to current steam account '%ls'.",
|
||||
current_name.c_str(), steam_name.c_str());
|
||||
|
||||
m_current_player = getPlayer(i);
|
||||
m_current_player->setToCurrentSteamUser();
|
||||
return true;
|
||||
} // if steam and current name are different
|
||||
} // for i in m_all_players
|
||||
|
||||
// No matching existing user found. Last try: if there is only
|
||||
// one stk account, connect it to the current steam account:
|
||||
if (m_all_players.size() == 1)
|
||||
{
|
||||
m_current_player = getPlayer(0);
|
||||
m_current_player->setToCurrentSteamUser();
|
||||
Log::warn("PlayerManager",
|
||||
"Connecting only account '%ls' to current steam account '%ls'.",
|
||||
m_current_player->getName().c_str(), steam_name.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
} // If first time steam version is started.
|
||||
|
||||
// Otherwise now current user is NULL: if this is the first time that
|
||||
// stk starts under steam (and an stk account existed, otherwise this
|
||||
// function is not called), main() will bring up the user login screen
|
||||
// where the user can connect and disconnect stk- and steam-accounts.
|
||||
|
||||
//TODO: At this stage there are a few options:
|
||||
// 1) If there is only one STK account, connect it to the steam account?
|
||||
// 2) automatically connect 'current' to the steam account?
|
||||
// 3) bring up a gui?
|
||||
return false;
|
||||
} // checkSteamAccount
|
||||
|
||||
|
@ -914,6 +914,16 @@ namespace UserConfigParams
|
||||
&m_online_group,
|
||||
"Version of the server API to use."));
|
||||
|
||||
// ---- Online gameplay related
|
||||
PARAM_PREFIX GroupUserConfigParam m_steam_group
|
||||
PARAM_DEFAULT(GroupUserConfigParam("Steam",
|
||||
"Everything related to steam."));
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_steam_first_start
|
||||
PARAM_DEFAULT(BoolUserConfigParam(true,
|
||||
"steam-first-start",
|
||||
&m_steam_group,
|
||||
"If this is the first time the STK steam version was started"));
|
||||
|
||||
// ---- Addon server related entries
|
||||
PARAM_PREFIX GroupUserConfigParam m_addon_group
|
||||
|
16
src/main.cpp
16
src/main.cpp
@ -1701,10 +1701,20 @@ int main(int argc, char *argv[] )
|
||||
// so we immediately start the main menu (unless it was requested
|
||||
// to always show the login screen). Otherwise show the login
|
||||
// screen first.
|
||||
if(PlayerManager::getCurrentPlayer() && !
|
||||
UserConfigParams::m_always_show_login_screen)
|
||||
if(PlayerManager::getCurrentPlayer() &&
|
||||
!UserConfigParams::m_always_show_login_screen)
|
||||
{
|
||||
MainMenuScreen::getInstance()->push();
|
||||
// If this is the first time that steam starts, and at startup
|
||||
// we could not detect a 'matching' stk account to the steam
|
||||
// account, bring up the user screen (on top of the main menu),
|
||||
// so that the user can manually connect an stk account with
|
||||
// a steam account.
|
||||
if (UserConfigParams::m_steam_first_start &&
|
||||
!PlayerManager::getCurrentPlayer()->isSteamUser())
|
||||
{
|
||||
UserScreen::getInstance()->push();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1801,7 +1811,7 @@ int main(int argc, char *argv[] )
|
||||
}
|
||||
|
||||
/* Program closing...*/
|
||||
|
||||
UserConfigParams::m_steam_first_start = false;
|
||||
#ifdef ENABLE_WIIUSE
|
||||
if(wiimote_manager)
|
||||
delete wiimote_manager;
|
||||
|
Loading…
Reference in New Issue
Block a user