Fixes that characters previously selected wouldn't be selected the next time you go into the character selection menu.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1331 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2007-12-09 23:49:56 +00:00
parent 748dc0841f
commit a28879b077
2 changed files with 16 additions and 4 deletions

View File

@ -105,8 +105,20 @@ CharSel::CharSel(int whichPlayer)
//FIXME: widget_manager says that token -1 is already in use //FIXME: widget_manager says that token -1 is already in use
widget_manager->layout(WGT_AREA_TOP); widget_manager->layout(WGT_AREA_TOP);
m_current_kart = -1; m_current_kart = -1;
switchCharacter(0);
const int LAST_KART = user_config->m_player[m_player_index].getLastKartId();
if( LAST_KART != -1 )
{
widget_manager->set_selected_wgt(WTOK_RACER0 + LAST_KART);
switchCharacter(LAST_KART);
}
else
{
switchCharacter(0);
}
m_clock = 0; m_clock = 0;
//test //test

View File

@ -31,16 +31,16 @@ class Player
private: private:
std::string m_name; std::string m_name;
Input m_action_map[KA_LAST+1]; Input m_action_map[KA_LAST+1];
unsigned int m_last_kart_id; int m_last_kart_id;
public: public:
Player(){} Player(){}
Player(const std::string &name_):m_name(name_){} Player(const std::string &name_):m_name(name_),m_last_kart_id(-1){}
void setName(const std::string &name_){m_name = name_;} void setName(const std::string &name_){m_name = name_;}
std::string getName() {return m_name;} std::string getName() {return m_name;}
unsigned int getLastKartId(){ return m_last_kart_id; } int getLastKartId(){ return m_last_kart_id; }
void setLastKartId(int newLastKartId){ m_last_kart_id = newLastKartId; } void setLastKartId(int newLastKartId){ m_last_kart_id = newLastKartId; }
}; };