Fix crash when changing kart from overworld

This commit is contained in:
Marianne Gagnon 2014-07-08 20:10:54 -04:00
parent 6d7178aff5
commit 7a0afd9321
3 changed files with 16 additions and 3 deletions

View File

@ -149,12 +149,12 @@ void OverWorld::update(float dt)
if (m_return_to_garage)
{
m_return_to_garage = false;
delayedSelfDestruct();
race_manager->exitRace(false);
race_manager->exitRace();
KartSelectionScreen* s = OfflineKartSelectionScreen::getInstance();
s->setMultiplayer(false);
s->setFromOverworld(true);
StateManager::get()->resetAndGoToScreen(s);
throw AbortWorldUpdateException();
}
} // update

View File

@ -793,7 +793,14 @@ void World::updateWorld(float dt)
getPhase() == IN_GAME_MENU_PHASE )
return;
update(dt);
try
{
update(dt);
}
catch (AbortWorldUpdateException& e)
{
return;
}
#ifdef DEBUG
assert(m_magic_number == 0xB01D6543);

View File

@ -47,6 +47,12 @@ namespace irr
namespace scene { class ISceneNode; }
}
class AbortWorldUpdateException : public std::runtime_error
{
public:
AbortWorldUpdateException() : std::runtime_error("race abort") { };
};
/**
* \brief base class for all game modes
* This class is responsible for running the actual race. A world is created