Bool to string fix for challenges. String to bool applied for
achievements.
This commit is contained in:
parent
9b2b6c1c78
commit
06b7ba09f5
@ -131,13 +131,14 @@ MapAchievement::MapAchievement(const AchievementInfo * info)
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
void MapAchievement::load(XMLNode * input)
|
void MapAchievement::load(XMLNode * input)
|
||||||
{
|
{
|
||||||
std::string achieved("");
|
bool achieved = false;
|
||||||
input->get("achieved", &achieved);
|
input->get("achieved", &achieved);
|
||||||
if(achieved == "true")
|
if(achieved)
|
||||||
{
|
{
|
||||||
m_achieved = true;
|
m_achieved = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<XMLNode*> xml_entries;
|
std::vector<XMLNode*> xml_entries;
|
||||||
input->getNodes("entry", xml_entries);
|
input->getNodes("entry", xml_entries);
|
||||||
for (unsigned int n=0; n < xml_entries.size(); n++)
|
for (unsigned int n=0; n < xml_entries.size(); n++)
|
||||||
|
@ -240,7 +240,7 @@ void GameSlot::save(std::ofstream& out, const std::string& name)
|
|||||||
{
|
{
|
||||||
out << " <gameslot playerID=\"" << m_player_unique_id.c_str()
|
out << " <gameslot playerID=\"" << m_player_unique_id.c_str()
|
||||||
<< "\" kart=\"" << m_kart_ident.c_str()
|
<< "\" kart=\"" << m_kart_ident.c_str()
|
||||||
<< "\" firstTime=\"" << (m_first_time ? "true" : "false")
|
<< "\" firstTime=\"" << StringUtils::toString(m_first_time)
|
||||||
<< "\"> <!-- " << name.c_str() << " -->\n";
|
<< "\"> <!-- " << name.c_str() << " -->\n";
|
||||||
std::map<std::string, Challenge*>::const_iterator i;
|
std::map<std::string, Challenge*>::const_iterator i;
|
||||||
for(i = m_challenges_state.begin();
|
for(i = m_challenges_state.begin();
|
||||||
|
@ -72,7 +72,7 @@ namespace StringUtils
|
|||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Specialisiation for bools to return 'true' or 'false'*/
|
/** Specialisiation for bools to return 'true' or 'false'*/
|
||||||
inline std::string toString(bool &b)
|
inline std::string toString(const bool& b)
|
||||||
{
|
{
|
||||||
return (b ? "true" : "false");
|
return (b ? "true" : "false");
|
||||||
} // toString(bool)
|
} // toString(bool)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user