From b384f71c7ea18308ef4de182b39d649ddf22afd3 Mon Sep 17 00:00:00 2001 From: auria Date: Tue, 6 Dec 2011 01:16:16 +0000 Subject: [PATCH] Fixed bug when loading challenges.xml git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10356 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/challenges/challenge.cpp | 8 +++++++- src/challenges/unlock_manager.cpp | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/challenges/challenge.cpp b/src/challenges/challenge.cpp index 2d1b9591d..08d80881a 100644 --- a/src/challenges/challenge.cpp +++ b/src/challenges/challenge.cpp @@ -39,12 +39,18 @@ void Challenge::load(const XMLNode* challengesNode) { const XMLNode* node = challengesNode->getNode( m_data->getId() ); - if(node == NULL) return; + if(node == NULL) + { + fprintf(stderr, "[Challenge] WARNING: Couldn't find node <%s> in XML file\n", + m_data->getId().c_str()); + return; + } // See if the challenge is solved (it's activated later from the // unlock_manager). bool finished=false; node->get("solved", &finished); + m_state = finished ? CH_SOLVED : CH_INACTIVE; } // load diff --git a/src/challenges/unlock_manager.cpp b/src/challenges/unlock_manager.cpp index 64274c3cf..430ef6882 100644 --- a/src/challenges/unlock_manager.cpp +++ b/src/challenges/unlock_manager.cpp @@ -209,7 +209,7 @@ void UnlockManager::load() { core::stringw player_name; xml_game_slots[n]->get("player", &player_name); - + GameSlot* slot = new GameSlot(player_name); std::string kart_id; @@ -223,8 +223,9 @@ void UnlockManager::load() { ChallengeData* curr = i->second; Challenge* state = new Challenge(curr); + slot->m_challenges_state[curr->getId()] = state; - state->load(root); + state->load(xml_game_slots[n]); } slot->computeActive(); }