Remember last used number of goals value

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14141 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
deveee
2013-09-23 18:17:32 +00:00
parent d5bddb20fa
commit f7d41cf008
2 changed files with 9 additions and 2 deletions

View File

@@ -328,6 +328,9 @@ namespace UserConfigParams
PARAM_PREFIX IntUserConfigParam m_num_laps
PARAM_DEFAULT( IntUserConfigParam(4, "numlaps",
&m_race_setup_group, "Default number of laps.") );
PARAM_PREFIX IntUserConfigParam m_num_goals
PARAM_DEFAULT( IntUserConfigParam(3, "numgoals",
&m_race_setup_group, "Default number of goals in soccer mode.") );
PARAM_PREFIX IntUserConfigParam m_difficulty
PARAM_DEFAULT( IntUserConfigParam(0, "difficulty",
&m_race_setup_group,

View File

@@ -137,10 +137,12 @@ void SoccerSetupScreen::beforeAddingWidget()
void SoccerSetupScreen::init()
{
Screen::init();
if (UserConfigParams::m_num_goals <= 0)
UserConfigParams::m_num_goals = 3;
// TODO: remember in config.xml the last number of goals
SpinnerWidget* goalamount = getWidget<SpinnerWidget>("goalamount");
goalamount->setValue(3);
goalamount->setValue(UserConfigParams::m_num_goals);
// Set focus on "continue"
ButtonWidget* bt_continue = getWidget<ButtonWidget>("continue");
@@ -164,6 +166,8 @@ void SoccerSetupScreen::tearDown()
// Reset the 'map fire to select' option of the device manager
input_manager->getDeviceList()->mapFireToSelect(false);
UserConfigParams::m_num_goals = getWidget<SpinnerWidget>("goalamount")->getValue();
// Remove all ModelViewWidgets we created manually
PtrVector<Widget>& children = central_div->getChildren();