Added assertions to catch the bug reported on the forum earlier (when doing the resolution switch, not when plasying afterwards). Seems it has to deal with the material manager and the handling of 'permanent' materials (but I can't make any sense of your code there Joerg, so please help -.-)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5401 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2010-05-07 15:28:05 +00:00
parent 77c3995b5f
commit c9ddf98f3d
4 changed files with 18 additions and 3 deletions

View File

@@ -311,7 +311,7 @@ void IrrDriver::doApplyResSettings()
projectile_manager -> removeTextures();
item_manager -> removeTextures();
kart_properties_manager -> unloadAllKarts();
powerup_manager -> removeTextures();
powerup_manager -> unloadPowerups();
GUIEngine::clear();
GUIEngine::cleanUp(); //FIXME: cleanUp is not called when exiting normally, only when changing resolution!

View File

@@ -62,8 +62,16 @@ PowerupManager::~PowerupManager()
//-----------------------------------------------------------------------------
/** Removes any textures so that they can be reloaded. FIXME: missing atm.
*/
void PowerupManager::removeTextures()
void PowerupManager::unloadPowerups()
{
for(unsigned int i=POWERUP_FIRST; i<=POWERUP_LAST; i++)
{
if(m_all_meshes[(PowerupType)i])
m_all_meshes[(PowerupType)i]->drop();
//FIXME: I'm not sure if this is OK or if I need to ->drop(), or delete them, or...
m_all_icons[i] = (Material*)NULL;
}
} // removeTextures
//-----------------------------------------------------------------------------
@@ -110,6 +118,7 @@ void PowerupManager::loadAllPowerups()
loadWeights(*root, "end33", POSITION_END33 );
loadWeights(*root, "last" , POSITION_LAST );
loadWeights(*root, "battle" , POSITION_BATTLE_MODE);
} // loadAllPowerups
//-----------------------------------------------------------------------------
@@ -128,6 +137,9 @@ void PowerupManager::LoadPowerup(PowerupType type, const XMLNode &node)
/*make_permanent */ true);
assert(m_all_icons[type] != NULL);
assert(m_all_icons[type]->getTexture() != NULL);
std::string model("");
node.get("model", &model);
if(model.size()>0)

View File

@@ -140,7 +140,7 @@ public:
PowerupManager ();
~PowerupManager ();
void loadAllPowerups ();
void removeTextures ();
void unloadPowerups ();
void LoadPowerup (PowerupType type, const XMLNode &node);
void updateWeightsForRace(unsigned int num_karts);
Material* getIcon (int type) const {return m_all_icons [type];}

View File

@@ -449,7 +449,10 @@ void RaceGUI::drawPowerupIcons(const Kart* kart,
int y1 = viewport.UpperLeftCorner.Y
+ (int)(20 * scaling.Y);
assert(powerup != NULL);
assert(powerup->getIcon() != NULL);
video::ITexture *t=powerup->getIcon()->getTexture();
assert(t != NULL);
core::rect<s32> rect(core::position2di(0, 0), t->getOriginalSize());
for ( int i = 0 ; i < n ; i++ )