From d1ab5f8aaf4b712ec7b6e48906a7ed1b19173cc4 Mon Sep 17 00:00:00 2001 From: Benau Date: Tue, 16 Jun 2020 09:46:56 +0800 Subject: [PATCH] Allow remembering network splitscreen option when opening STK --- src/config/user_config.hpp | 4 ++++ src/states_screens/online/online_screen.cpp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index 2f4557ed5..47682c461 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -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")); diff --git a/src/states_screens/online/online_screen.cpp b/src/states_screens/online/online_screen.cpp index 5e3692b2c..9fa99e10f 100644 --- a/src/states_screens/online/online_screen.cpp +++ b/src/states_screens/online/online_screen.cpp @@ -68,7 +68,7 @@ void OnlineScreen::loadedFromFile() { m_enable_splitscreen = getWidget("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; }