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
This commit is contained in:
parent
caf8083b62
commit
ef750af24e
@ -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"
|
writer << " <" << m_data->getId().c_str() << ">\n"
|
||||||
<< L" <easy solved=\"" << boolstr(isSolved(RaceManager::RD_EASY)) << L"\"/>\n"
|
<< " <easy solved=\"" << boolstr(isSolved(RaceManager::RD_EASY)) << "\"/>\n"
|
||||||
<< L" <medium solved=\"" << boolstr(isSolved(RaceManager::RD_MEDIUM)) << L"\"/>\n"
|
<< " <medium solved=\"" << boolstr(isSolved(RaceManager::RD_MEDIUM)) << "\"/>\n"
|
||||||
<< L" <hard solved=\"" << boolstr(isSolved(RaceManager::RD_HARD)) << L"\"/>\n"
|
<< " <hard solved=\"" << boolstr(isSolved(RaceManager::RD_HARD)) << "\"/>\n"
|
||||||
<< L" </" << core::stringw(m_data->getId().c_str()) << L">\n";
|
<< " </" << m_data->getId().c_str() << ">\n";
|
||||||
} // save
|
} // save
|
||||||
|
@ -62,7 +62,7 @@ public:
|
|||||||
}
|
}
|
||||||
virtual ~Challenge() {};
|
virtual ~Challenge() {};
|
||||||
void load(const XMLNode* config);
|
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; }
|
bool isSolved(RaceManager::Difficulty d) const {return m_state[d]==CH_SOLVED; }
|
||||||
|
@ -186,11 +186,11 @@ void GameSlot::grandPrixFinished()
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void GameSlot::save(XMLWriter& out)
|
void GameSlot::save(std::ofstream& out)
|
||||||
{
|
{
|
||||||
out << L" <gameslot playerID=\"" << m_player_unique_id.c_str() << L"\" kart=\""
|
out << " <gameslot playerID=\"" << m_player_unique_id.c_str() << "\" kart=\""
|
||||||
<< m_kart_ident.c_str() << L"\" firstTime=\"" << (m_first_time ? L"true" : L"false")
|
<< m_kart_ident.c_str() << "\" firstTime=\"" << (m_first_time ? "true" : "false")
|
||||||
<< L"\">\n";
|
<< "\">\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();
|
||||||
i != m_challenges_state.end(); i++)
|
i != m_challenges_state.end(); i++)
|
||||||
|
@ -96,7 +96,7 @@ public:
|
|||||||
void raceFinished ();
|
void raceFinished ();
|
||||||
void grandPrixFinished ();
|
void grandPrixFinished ();
|
||||||
|
|
||||||
void save (XMLWriter& file);
|
void save (std::ofstream& file);
|
||||||
|
|
||||||
int getPoints () const { return m_points; }
|
int getPoints () const { return m_points; }
|
||||||
|
|
||||||
|
@ -255,9 +255,10 @@ void UnlockManager::load()
|
|||||||
void UnlockManager::save()
|
void UnlockManager::save()
|
||||||
{
|
{
|
||||||
std::string filename = file_manager->getChallengeFile("challenges.xml");
|
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";
|
std::cerr << "Failed to open " << filename << " for writing, challenges won't be saved\n";
|
||||||
return;
|
return;
|
||||||
@ -266,7 +267,6 @@ void UnlockManager::save()
|
|||||||
challenge_file << "<?xml version=\"1.0\"?>\n";
|
challenge_file << "<?xml version=\"1.0\"?>\n";
|
||||||
challenge_file << "<challenges>\n";
|
challenge_file << "<challenges>\n";
|
||||||
|
|
||||||
|
|
||||||
std::map<std::string, GameSlot*>::iterator it;
|
std::map<std::string, GameSlot*>::iterator it;
|
||||||
for (it = m_game_slots.begin(); it != m_game_slots.end(); it++)
|
for (it = m_game_slots.begin(); it != m_game_slots.end(); it++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user