The track select gui now selects by default the last played track.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2477 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2008-11-19 22:29:53 +00:00
parent 05ca336742
commit b7eed2c9c5
3 changed files with 22 additions and 7 deletions

View File

@ -85,8 +85,17 @@ TrackSel::TrackSel()
w->setPosition(WGT_DIR_FROM_LEFT, 0.1f, NULL, WGT_DIR_FROM_BOTTOM, 0.0f, prev_widget);
m_offset = 0;
m_current_track = -1;
switchGroup();
m_current_track = -1;
for(unsigned int i=0; i<m_index_avail_tracks.size(); i++)
{
if(track_manager->getTrack(m_index_avail_tracks[i])->getIdent()==
user_config->m_last_track)
{
m_offset = i-m_max_entries/2;
break;
}
}
updateScrollPosition();
widget_manager->layout(WGT_AREA_TOP);
@ -351,6 +360,7 @@ void TrackSel::select()
}
const Track* TRACK = track_manager->getTrack(m_index_avail_tracks[track_number]);
user_config->m_last_track = TRACK->getIdent();
bool isAvailable = !unlock_manager->isLocked(TRACK->getIdent());
if( isAvailable )

View File

@ -109,15 +109,16 @@ void UserConfig::setDefaults()
m_use_kph = false;
m_width = 800;
m_height = 600;
m_prev_width = m_width;
m_prev_height = m_height;
m_prev_windowed = false;
m_crashed = false;
m_prev_width = m_width;
m_prev_height = m_height;
m_prev_windowed = false;
m_crashed = false;
m_blacklist_res.clear();
m_karts = 4;
m_log_errors = false;
m_kart_group = "standard";
m_track_group = "standard";
m_last_track = "jungle";
m_server_address = "localhost";
m_server_port = 2305;
@ -443,6 +444,7 @@ void UserConfig::loadConfig(const std::string& filename)
lisp->get("log-errors", m_log_errors);
lisp->get("kart-group", m_kart_group);
lisp->get("track-group", m_track_group);
lisp->get("last-track", m_last_track);
// Handle loading the stick config in it own method.
readStickConfigs(lisp);
@ -694,6 +696,8 @@ void UserConfig::saveConfig(const std::string& filename)
writer->write("kart-group", m_kart_group);
writer->writeComment("Last selected track group");
writer->write("track-group", m_track_group);
writer->writeComment("Last track played");
writer->write("last-track", m_last_track);
writer->writeComment("Information about last server used");
writer->write("server-address", m_server_address);
writer->write("server-port", m_server_port);

View File

@ -174,8 +174,9 @@ public:
std::string m_item_style;
std::string m_username;
std::string m_background_music;
std::string m_kart_group; // Kart group used last
std::string m_track_group; // Track group used last
std::string m_kart_group; //< Kart group used last
std::string m_track_group; //< Track group used last
std::string m_last_track; //< name of the last track used
std::string m_server_address;
int m_server_port;
bool m_use_kph;