Mostly fix focused track issue (see ticket 80)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7781 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-03-02 00:16:58 +00:00
parent 3a3619750a
commit ffc53dabf6
2 changed files with 9 additions and 2 deletions

View File

@ -373,7 +373,7 @@ namespace UserConfigParams
PARAM_PREFIX StringUserConfigParam m_track_group
PARAM_DEFAULT( StringUserConfigParam(DEFAULT_GROUP_NAME, "track_group", "Last selected track group") );
PARAM_PREFIX StringUserConfigParam m_last_track
PARAM_DEFAULT( StringUserConfigParam("jungle", "last_track", "Name of the last track used.") );
PARAM_DEFAULT( StringUserConfigParam("olivermath", "last_track", "Name of the last track used.") );
PARAM_PREFIX StringUserConfigParam m_skin_file
PARAM_DEFAULT( StringUserConfigParam("Peach.stkskin", "skin_file", "Name of the skin to use") );

View File

@ -101,6 +101,8 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, const
std::cout << "Clicked on track " << selection.c_str()
<< std::endl;
UserConfigParams::m_last_track = selection;
if (selection == "random_track")
{
RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups");
@ -239,7 +241,12 @@ void TracksScreen::init()
buildTrackList();
// select something for the game master
tracks_widget->setSelection(tracks_widget->getItems()[0].m_code_name, PLAYER_ID_GAME_MASTER, true);
// FIXME: 'setSelection' will not scroll up to the passed track, so if given track is not visible
// with current scrolling this fails
if (!tracks_widget->setSelection(UserConfigParams::m_last_track, PLAYER_ID_GAME_MASTER, true))
{
tracks_widget->setSelection(0, PLAYER_ID_GAME_MASTER, true);
}
}
// -----------------------------------------------------------------------------------------------