Fixed crash in new KartModel handling in unlocked features.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5949 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-09-09 12:26:36 +00:00
parent d1ba939b94
commit 69144f8274
2 changed files with 11 additions and 4 deletions

View File

@ -189,12 +189,15 @@ void FeatureUnlockedCutScene::init()
if (unlockedStuffCount == 0) std::cerr << "There is nothing in the unlock chest!!!\n";
m_all_kart_models.clear();
for (int n=0; n<unlockedStuffCount; n++)
{
if (m_unlocked_stuff[n].m_unlocked_kart != NULL)
{
KartModel* kart_model =
m_unlocked_stuff[n].m_unlocked_kart->getKartModel();
m_all_kart_models.push_back(
(*m_unlocked_stuff[n].m_unlocked_kart->getKartModel())
);
KartModel *kart_model = &(m_all_kart_models.back());
kart_model->attachModel(&(m_unlocked_stuff[n].m_root_gift_node));
#ifdef DEBUG
m_unlocked_stuff[n].m_root_gift_node->setName("unlocked kart");
@ -202,7 +205,7 @@ void FeatureUnlockedCutScene::init()
#ifdef USE_IRRLICHT_BUG_WORKAROUND
// If a mesh with this material is added, irrlicht will
// display the 'continue' text (otherwise the text is
// not visible). This is a terrible work around, but
// not visible). This is a terrible work around, but allows
// stk to be released without waiting for the next
// irrlicht version.
video::SMaterial m;
@ -268,6 +271,7 @@ void FeatureUnlockedCutScene::tearDown()
#endif
m_unlocked_stuff.clearAndDeleteAll();
m_all_kart_models.clear();
} // tearDown
// ----------------------------------------------------------------------------

View File

@ -57,9 +57,12 @@ class FeatureUnlockedCutScene : public GUIEngine::Screen, public GUIEngine::Scre
~UnlockedThing();
};
/** The list of all unlocked things. */
ptr_vector<UnlockedThing, HOLD> m_unlocked_stuff;
/** To store the copy of the KartModel for each unlocked kart. */
std::vector<KartModel> m_all_kart_models;
/** sky angle, 0-360 */
float m_sky_angle;