CloudSystem::clear() does not empty vector

harkathmaker

26-11-2011 01:37:50

First of all, I'm not sure whether I'm using the system correctly... what I want to do is tear out the default cloud layer and make a different one. Thought it would be easier to call clear() than muck with the existing layer.

However, the program ends up hitting assert(mLayers != NULL) in update(). Even though the layers get deleted in clear(), the vector itself is never reset

Here's a suggested fix to clear, which will empty the vector:

void CloudSystem::clearLayers()
{
for (unsigned i = 0; i < mLayers.size(); i++)
{
delete mLayers[i];
mLayers[i] = 0;
}
mLayers.clear();
}