Kinda fixed crash I introduced in 3 strikes, but the current code leaks. Will need to ask Joerg how irrlicht memory management works...

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9704 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-09-01 23:47:15 +00:00
parent 3e7aeaf71f
commit 03178d9e75
4 changed files with 22 additions and 0 deletions

View File

@ -76,6 +76,13 @@ void ThreeStrikesBattle::init()
//-----------------------------------------------------------------------------
ThreeStrikesBattle::~ThreeStrikesBattle()
{
PhysicalObject* obj;
for_in(obj, m_tires)
{
m_track->getTrackObjectManager()->removeObject(obj);
}
m_tires.clearWithoutDeleting();
delete[] m_kart_display_info;
// TODO: need to drop the mesh? I got a crash when I added this line so
// not sure this is right
@ -210,6 +217,8 @@ void ThreeStrikesBattle::update(float dt)
// FIXME: orient the force relative to kart orientation
obj->getBody()->applyCentralForce(btVector3(60.0f, 0.0f, 0.0f));
m_insert_tire = false;
m_tires.push_back(obj);
}
} // update

View File

@ -52,6 +52,8 @@ private:
/** for tires that are blown away */
core::vector3df m_tire_position;
PtrVector<PhysicalObject, REF> m_tires;
public:
/** Used to show a nice graph when battle is over */

View File

@ -204,4 +204,13 @@ PhysicalObject* TrackObjectManager::insertObject(const std::string& model,
return object;
}
// ----------------------------------------------------------------------------
void TrackObjectManager::removeObject(PhysicalObject* who)
{
m_all_objects.remove(who);
// FIXME: need to do memory management
//delete who;
}

View File

@ -59,6 +59,8 @@ public:
const core::vector3df& hpr,
const core::vector3df& pos,
const core::vector3df& scale);
void removeObject(PhysicalObject* who);
}; // class TrackObjectManager
#endif