Correct crashes in overworld

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10749 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2012-01-29 21:28:31 +00:00
parent 9d4157de93
commit 91cdec00a6
2 changed files with 21 additions and 13 deletions

View File

@ -34,6 +34,8 @@ SelectChallengeDialog::SelectChallengeDialog(const float percentWidth,
loadFromFile("select_challenge.stkgui");
m_challenge_id = challenge_id;
World::getWorld()->schedulePause(WorldStatus::IN_GAME_MENU_PHASE);
// TODO: select the previously selected difficulty
}
SelectChallengeDialog::~SelectChallengeDialog()
@ -47,13 +49,6 @@ GUIEngine::EventPropagation SelectChallengeDialog::processEvent(const std::strin
if (eventSource == "novice" || eventSource == "intermediate" ||
eventSource == "expert")
{
ModalDialog::dismiss();
core::rect<s32> pos(15,
10,
15 + UserConfigParams::m_width/2,
10 + GUIEngine::getTitleFontHeight());
const ChallengeData* challenge = unlock_manager->getChallenge(m_challenge_id);
if (challenge == NULL)
@ -63,6 +58,13 @@ GUIEngine::EventPropagation SelectChallengeDialog::processEvent(const std::strin
return GUIEngine::EVENT_LET;
}
ModalDialog::dismiss();
core::rect<s32> pos(15,
10,
15 + UserConfigParams::m_width/2,
10 + GUIEngine::getTitleFontHeight());
race_manager->exitRace();
//StateManager::get()->resetActivePlayers();
@ -111,6 +113,7 @@ GUIEngine::EventPropagation SelectChallengeDialog::processEvent(const std::strin
// Sets up kart info, including random list of kart for AI
network_manager->setupPlayerKartInfo();
race_manager->startNew();
return GUIEngine::EVENT_BLOCK;
}
return GUIEngine::EVENT_LET;

View File

@ -883,6 +883,7 @@ bool Track::loadMainTrack(const XMLNode &root)
if (c == NULL)
{
fprintf(stderr, "[WARNING] Cannot find challenge named <%s>\n", challenge.c_str());
scene_node->remove();
continue;
}
@ -920,14 +921,18 @@ bool Track::loadMainTrack(const XMLNode &root)
}
}
LODNode* lod_node = new LODNode("challenge_orb", scene_node->getParent(),
LODNode* lod_node = new LODNode("challenge_orb",
irr_driver->getSceneManager()->getRootSceneNode(),
irr_driver->getSceneManager());
lod_node->add(50, scene_node, true /* reparent */);
scene_node = lod_node;
} // if (challenge.size() > 0)
m_all_nodes.push_back( scene_node );
m_all_nodes.push_back( lod_node );
}
else
{
m_all_nodes.push_back( scene_node );
}
}
} // for i