Removed the m_default_player from the user_config.hpp because the
default user is loaded from the players.xml file
This commit is contained in:
parent
a5eba8bf83
commit
2ef991e9e7
@ -508,57 +508,6 @@ void StringUserConfigParam::findYourDataInAnAttributeOf(const XMLNode* node)
|
||||
node->get( m_param_name, &m_value );
|
||||
} // findYourDataInAnAttributeOf
|
||||
|
||||
// ============================================================================
|
||||
WStringUserConfigParam::WStringUserConfigParam(const core::stringw& default_value,
|
||||
const char* param_name,
|
||||
const char* comment)
|
||||
{
|
||||
|
||||
m_value = default_value;
|
||||
m_default_value = default_value;
|
||||
|
||||
m_param_name = param_name;
|
||||
all_params.push_back(this);
|
||||
if(comment != NULL) m_comment = comment;
|
||||
} // WStringUserConfigParam
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
WStringUserConfigParam::WStringUserConfigParam(const core::stringw& default_value,
|
||||
const char* param_name,
|
||||
GroupUserConfigParam* group,
|
||||
const char* comment)
|
||||
{
|
||||
m_value = default_value;
|
||||
m_default_value = default_value;
|
||||
|
||||
m_param_name = param_name;
|
||||
group->addChild(this);
|
||||
if(comment != NULL) m_comment = comment;
|
||||
} // WStringUserConfigParam
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void WStringUserConfigParam::write(UTFWriter& stream) const
|
||||
{
|
||||
if(m_comment.size() > 0) stream << L" <!-- " << m_comment.c_str()
|
||||
<< L" -->\n";
|
||||
stream << L" <" << m_param_name.c_str() << L" value=\"" << m_value
|
||||
<< L"\" />\n\n";
|
||||
} // write
|
||||
// ----------------------------------------------------------------------------
|
||||
void WStringUserConfigParam::findYourDataInAChildOf(const XMLNode* node)
|
||||
{
|
||||
const XMLNode* child = node->getNode( m_param_name );
|
||||
if(child == NULL) return;
|
||||
|
||||
child->get( "value", &m_value );
|
||||
} // findYourDataInAChildOf
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void WStringUserConfigParam::findYourDataInAnAttributeOf(const XMLNode* node)
|
||||
{
|
||||
node->get( m_param_name, &m_value );
|
||||
} // findYourDataInAnAttributeOf
|
||||
|
||||
// ============================================================================
|
||||
BoolUserConfigParam::BoolUserConfigParam(bool default_value,
|
||||
const char* param_name,
|
||||
|
@ -223,37 +223,6 @@ public:
|
||||
const char* c_str() const { return m_value.c_str(); }
|
||||
}; // StringUserConfigParam
|
||||
|
||||
// ============================================================================
|
||||
class WStringUserConfigParam : public UserConfigParam
|
||||
{
|
||||
stringw m_value;
|
||||
stringw m_default_value;
|
||||
|
||||
public:
|
||||
|
||||
WStringUserConfigParam(const stringw& default_value,
|
||||
const char* param_name,
|
||||
const char* comment = NULL);
|
||||
WStringUserConfigParam(const stringw& default_value,
|
||||
const char* param_name,
|
||||
GroupUserConfigParam* group,
|
||||
const char* comment = NULL);
|
||||
|
||||
void write(UTFWriter& stream) const;
|
||||
void findYourDataInAChildOf(const XMLNode* node);
|
||||
void findYourDataInAnAttributeOf(const XMLNode* node);
|
||||
|
||||
void revertToDefaults() { m_value = m_default_value; }
|
||||
|
||||
irr::core::stringw toString() const { return m_value; }
|
||||
|
||||
operator stringw() const { return m_value; }
|
||||
stringw& operator=(const stringw& v) { m_value = v; return m_value; }
|
||||
stringw& operator=(const WStringUserConfigParam& v)
|
||||
{ m_value = (stringw)v; return m_value; }
|
||||
const wchar_t* c_str() const { return m_value.c_str(); }
|
||||
}; // WStringUserConfigParam
|
||||
|
||||
// ============================================================================
|
||||
class BoolUserConfigParam : public UserConfigParam
|
||||
{
|
||||
@ -677,10 +646,6 @@ namespace UserConfigParams
|
||||
PARAM_DEFAULT( StringUserConfigParam("Peach.stkskin", "skin_file",
|
||||
"Name of the skin to use") );
|
||||
|
||||
PARAM_PREFIX WStringUserConfigParam m_default_player
|
||||
PARAM_DEFAULT( WStringUserConfigParam(L"", "default_player",
|
||||
"Which player to use by default (if empty, will prompt)") );
|
||||
|
||||
// ---- Internet related
|
||||
|
||||
PARAM_PREFIX IntUserConfigParam m_internet_status
|
||||
|
@ -184,7 +184,6 @@ void OptionsScreenPlayers::eventCallback(Widget* widget, const std::string& name
|
||||
}
|
||||
else if (name == "playername")
|
||||
{
|
||||
UserConfigParams::m_default_player = L"";
|
||||
race_manager->clearKartLastPositionOnOverworld();
|
||||
StateManager::get()->pushScreen(StoryModeLobbyScreen::getInstance());
|
||||
}
|
||||
|
@ -55,18 +55,11 @@ void StoryModeLobbyScreen::init()
|
||||
ListWidget* list = getWidget<ListWidget>("gameslots");
|
||||
list->clear();
|
||||
|
||||
core::stringw name = UserConfigParams::m_default_player.toString();
|
||||
|
||||
|
||||
if (UserConfigParams::m_default_player.toString().size() > 0)
|
||||
PlayerProfile *player = PlayerManager::get()->getCurrentPlayer();
|
||||
if(player)
|
||||
{
|
||||
PlayerProfile *player = PlayerManager::get()->getPlayer(name);
|
||||
if(player)
|
||||
{
|
||||
PlayerManager::get()->setCurrentPlayer(player);
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
return;
|
||||
}
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
return;
|
||||
}
|
||||
|
||||
for (unsigned int n=0; n<PlayerManager::get()->getNumPlayers(); n++)
|
||||
@ -119,7 +112,8 @@ void StoryModeLobbyScreen::eventCallback(Widget* widget,
|
||||
CheckBoxWidget* cb = getWidget<CheckBoxWidget>("rememberme");
|
||||
if (cb->getState())
|
||||
{
|
||||
UserConfigParams::m_default_player = list->getSelectionLabel();
|
||||
PlayerManager::get()->setCurrentPlayer(PlayerManager::get()
|
||||
->getPlayer(list->getSelectionLabel()));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user