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
This commit is contained in:
auria 2011-12-06 01:16:16 +00:00
parent f3c9338908
commit b384f71c7e
2 changed files with 10 additions and 3 deletions

View File

@ -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

View File

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