From 69144f8274e53b982a91db4f75958f7dd1a2e585 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Thu, 9 Sep 2010 12:26:36 +0000 Subject: [PATCH] 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 --- src/states_screens/feature_unlocked.cpp | 10 +++++++--- src/states_screens/feature_unlocked.hpp | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/states_screens/feature_unlocked.cpp b/src/states_screens/feature_unlocked.cpp index 1b144ce90..78f429500 100644 --- a/src/states_screens/feature_unlocked.cpp +++ b/src/states_screens/feature_unlocked.cpp @@ -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; ngetKartModel(); + 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 // ---------------------------------------------------------------------------- diff --git a/src/states_screens/feature_unlocked.hpp b/src/states_screens/feature_unlocked.hpp index f33f6385a..0012c7b21 100644 --- a/src/states_screens/feature_unlocked.hpp +++ b/src/states_screens/feature_unlocked.hpp @@ -57,9 +57,12 @@ class FeatureUnlockedCutScene : public GUIEngine::Screen, public GUIEngine::Scre ~UnlockedThing(); }; + + /** The list of all unlocked things. */ ptr_vector m_unlocked_stuff; - + /** To store the copy of the KartModel for each unlocked kart. */ + std::vector m_all_kart_models; /** sky angle, 0-360 */ float m_sky_angle;