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(); }