From 06b7ba09f5b915ae98f550d551d5282e47f87f74 Mon Sep 17 00:00:00 2001 From: gl3nn Date: Sun, 2 Feb 2014 15:50:10 +0100 Subject: [PATCH] Bool to string fix for challenges. String to bool applied for achievements. --- src/achievements/achievement.cpp | 5 +++-- src/challenges/game_slot.cpp | 2 +- src/utils/string_utils.hpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/achievements/achievement.cpp b/src/achievements/achievement.cpp index be439a8ed..99586c0f1 100644 --- a/src/achievements/achievement.cpp +++ b/src/achievements/achievement.cpp @@ -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 xml_entries; input->getNodes("entry", xml_entries); for (unsigned int n=0; n < xml_entries.size(); n++) diff --git a/src/challenges/game_slot.cpp b/src/challenges/game_slot.cpp index 2ac0449ac..17b80ffc3 100644 --- a/src/challenges/game_slot.cpp +++ b/src/challenges/game_slot.cpp @@ -240,7 +240,7 @@ void GameSlot::save(std::ofstream& out, const std::string& name) { out << " \n"; std::map::const_iterator i; for(i = m_challenges_state.begin(); diff --git a/src/utils/string_utils.hpp b/src/utils/string_utils.hpp index ee46848ea..084140589 100644 --- a/src/utils/string_utils.hpp +++ b/src/utils/string_utils.hpp @@ -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)