Bool to string fix for challenges. String to bool applied for

achievements.
This commit is contained in:
gl3nn 2014-02-02 15:50:10 +01:00
parent 9b2b6c1c78
commit 06b7ba09f5
3 changed files with 5 additions and 4 deletions

View File

@ -131,13 +131,14 @@ MapAchievement::MapAchievement(const AchievementInfo * info)
// ============================================================================
void MapAchievement::load(XMLNode * input)
{
std::string achieved("");
bool achieved = false;
input->get("achieved", &achieved);
if(achieved == "true")
if(achieved)
{
m_achieved = true;
return;
}
std::vector<XMLNode*> xml_entries;
input->getNodes("entry", xml_entries);
for (unsigned int n=0; n < xml_entries.size(); n++)

View File

@ -240,7 +240,7 @@ void GameSlot::save(std::ofstream& out, const std::string& name)
{
out << " <gameslot playerID=\"" << m_player_unique_id.c_str()
<< "\" kart=\"" << m_kart_ident.c_str()
<< "\" firstTime=\"" << (m_first_time ? "true" : "false")
<< "\" firstTime=\"" << StringUtils::toString(m_first_time)
<< "\"> <!-- " << name.c_str() << " -->\n";
std::map<std::string, Challenge*>::const_iterator i;
for(i = m_challenges_state.begin();

View File

@ -72,7 +72,7 @@ namespace StringUtils
// ------------------------------------------------------------------------
/** 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");
} // toString(bool)