Allow remembering network splitscreen option when opening STK

This commit is contained in:
Benau 2020-06-16 09:46:56 +08:00
parent 07f6282142
commit d1ab5f8aaf
2 changed files with 6 additions and 1 deletions

View File

@ -812,6 +812,10 @@ namespace UserConfigParams
PARAM_PREFIX GroupUserConfigParam m_network_group
PARAM_DEFAULT(GroupUserConfigParam("Network", "Network Settings"));
PARAM_PREFIX BoolUserConfigParam m_enable_network_splitscreen
PARAM_DEFAULT(BoolUserConfigParam(false, "enable-network-splitscreen",
&m_network_group, "The default value of enable splitscreen checkbox "
"in online screen."));
PARAM_PREFIX BoolUserConfigParam m_log_packets
PARAM_DEFAULT(BoolUserConfigParam(false, "log-network-packets",
&m_network_group, "If all network packets should be logged"));

View File

@ -68,7 +68,7 @@ void OnlineScreen::loadedFromFile()
{
m_enable_splitscreen = getWidget<CheckBoxWidget>("enable-splitscreen");
assert(m_enable_splitscreen);
m_enable_splitscreen->setState(false);
m_enable_splitscreen->setState(UserConfigParams::m_enable_network_splitscreen);
} // loadedFromFile
// ----------------------------------------------------------------------------
@ -178,6 +178,7 @@ void OnlineScreen::eventCallback(Widget* widget, const std::string& name,
// Let lobby add the players
NetworkConfig::get()->cleanNetworkPlayers();
}
UserConfigParams::m_enable_network_splitscreen = splitscreen->getState();
return;
}