From ef750af24ec43624a500f0c442114ec85da1a013 Mon Sep 17 00:00:00 2001 From: auria Date: Wed, 25 Apr 2012 19:41:23 +0000 Subject: [PATCH] challenges.xml no longer contain a player name, only a player ID, so it no more needs to be UTF-32. Back to good old ASCII :) git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11152 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/challenges/challenge.cpp | 16 ++++++++-------- src/challenges/challenge.hpp | 2 +- src/challenges/game_slot.cpp | 8 ++++---- src/challenges/game_slot.hpp | 2 +- src/challenges/unlock_manager.cpp | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/challenges/challenge.cpp b/src/challenges/challenge.cpp index e9174f3e2..3a1c97c67 100644 --- a/src/challenges/challenge.cpp +++ b/src/challenges/challenge.cpp @@ -91,16 +91,16 @@ void Challenge::setSolved(RaceManager::Difficulty d) //----------------------------------------------------------------------------- -const wchar_t* boolstr(bool b) +const char* boolstr(bool b) { - return (b ? L"true" : L"false"); + return (b ? "true" : "false"); } -void Challenge::save(XMLWriter& writer) +void Challenge::save(std::ofstream& writer) { - writer << L" <" << core::stringw(m_data->getId().c_str()) << L">\n" - << L" \n" - << L" \n" - << L" \n" - << L" getId().c_str()) << L">\n"; + writer << " <" << m_data->getId().c_str() << ">\n" + << " \n" + << " \n" + << " \n" + << " getId().c_str() << ">\n"; } // save diff --git a/src/challenges/challenge.hpp b/src/challenges/challenge.hpp index 7b16f2f2e..18d1e5783 100644 --- a/src/challenges/challenge.hpp +++ b/src/challenges/challenge.hpp @@ -62,7 +62,7 @@ public: } virtual ~Challenge() {}; void load(const XMLNode* config); - void save(XMLWriter& writer); + void save(std::ofstream& writer); // ------------------------------------------------------------------------ bool isSolved(RaceManager::Difficulty d) const {return m_state[d]==CH_SOLVED; } diff --git a/src/challenges/game_slot.cpp b/src/challenges/game_slot.cpp index f2abeee84..496f03691 100644 --- a/src/challenges/game_slot.cpp +++ b/src/challenges/game_slot.cpp @@ -186,11 +186,11 @@ void GameSlot::grandPrixFinished() //----------------------------------------------------------------------------- -void GameSlot::save(XMLWriter& out) +void GameSlot::save(std::ofstream& out) { - out << L" \n"; + out << " \n"; std::map::const_iterator i; for(i = m_challenges_state.begin(); i != m_challenges_state.end(); i++) diff --git a/src/challenges/game_slot.hpp b/src/challenges/game_slot.hpp index eb1f631bd..2485b324a 100644 --- a/src/challenges/game_slot.hpp +++ b/src/challenges/game_slot.hpp @@ -96,7 +96,7 @@ public: void raceFinished (); void grandPrixFinished (); - void save (XMLWriter& file); + void save (std::ofstream& file); int getPoints () const { return m_points; } diff --git a/src/challenges/unlock_manager.cpp b/src/challenges/unlock_manager.cpp index 062b03a9e..cf15ec410 100644 --- a/src/challenges/unlock_manager.cpp +++ b/src/challenges/unlock_manager.cpp @@ -255,9 +255,10 @@ void UnlockManager::load() void UnlockManager::save() { std::string filename = file_manager->getChallengeFile("challenges.xml"); - XMLWriter challenge_file(filename.c_str()); + + std::ofstream challenge_file(filename.c_str(), std::ios::out); - if(!challenge_file.is_open()) + if (!challenge_file.is_open()) { std::cerr << "Failed to open " << filename << " for writing, challenges won't be saved\n"; return; @@ -266,7 +267,6 @@ void UnlockManager::save() challenge_file << "\n"; challenge_file << "\n"; - std::map::iterator it; for (it = m_game_slots.begin(); it != m_game_slots.end(); it++) {