@@ -2986,11 +2986,12 @@ void ParticleSystemManager::init( void )
2986
2986
// ------------------------------------------------------------------------------------------------
2987
2987
void ParticleSystemManager::reset ( void )
2988
2988
{
2989
- while (getParticleSystemCount ()) {
2990
- if (m_allParticleSystemList. front ()) {
2991
- deleteInstance (m_allParticleSystemList.front ());
2992
- }
2989
+ while (!m_allParticleSystemList. empty ())
2990
+ {
2991
+ DEBUG_ASSERTCRASH (m_allParticleSystemList.front () != NULL , ( " ParticleSystemManager::reset: ParticleSystem is null " ));
2992
+ deleteInstance (m_allParticleSystemList. front ());
2993
2993
}
2994
+ DEBUG_ASSERTCRASH (m_particleSystemCount == 0 , (" ParticleSystemManager::reset: m_particleSystemCount is %u, not 0" , m_particleSystemCount));
2994
2995
2995
2996
// sanity, our lists must be empty!!
2996
2997
for ( Int i = 0 ; i < NUM_PARTICLE_PRIORITIES; ++i )
@@ -3035,10 +3036,7 @@ void ParticleSystemManager::update( void )
3035
3036
{
3036
3037
// TheSuperHackers @info Must increment the list iterator before potential element erasure from the list.
3037
3038
ParticleSystem* sys = *it++;
3038
-
3039
- if (!sys) {
3040
- continue ;
3041
- }
3039
+ DEBUG_ASSERTCRASH (sys != NULL , (" ParticleSystemManager::update: ParticleSystem is null" ));
3042
3040
3043
3041
if (sys->update (m_localPlayerIndex) == false )
3044
3042
{
@@ -3095,9 +3093,7 @@ ParticleSystem *ParticleSystemManager::findParticleSystem( ParticleSystemID id )
3095
3093
3096
3094
for ( ParticleSystemListIt it = m_allParticleSystemList.begin (); it != m_allParticleSystemList.end (); ++it ) {
3097
3095
system = *it;
3098
- if (!system) {
3099
- continue ;
3100
- }
3096
+ DEBUG_ASSERTCRASH (system != NULL , (" ParticleSystemManager::findParticleSystem: ParticleSystem is null" ));
3101
3097
3102
3098
if ( system->getSystemID () == id ) {
3103
3099
return system;
@@ -3185,16 +3181,13 @@ void ParticleSystemManager::destroyAttachedSystems( Object *obj )
3185
3181
return ;
3186
3182
3187
3183
// iterate through all systems
3188
- ParticleSystem *system = NULL ;
3189
-
3190
3184
for ( ParticleSystemListIt it = m_allParticleSystemList.begin ();
3191
3185
it != m_allParticleSystemList.end ();
3192
3186
++it )
3193
3187
{
3194
3188
3195
- system = *it;
3196
- if ( system == NULL )
3197
- continue ;
3189
+ ParticleSystem *system = *it;
3190
+ DEBUG_ASSERTCRASH (system != NULL , (" ParticleSystemManager::destroyAttachedSystems: ParticleSystem is null" ));
3198
3191
3199
3192
if ( system->getAttachedObject () == obj->getID () )
3200
3193
system->destroy ();
@@ -3270,6 +3263,7 @@ void ParticleSystemManager::removeParticle( Particle *particleToRemove)
3270
3263
// ------------------------------------------------------------------------------------------------
3271
3264
void ParticleSystemManager::friend_addParticleSystem ( ParticleSystem *particleSystemToAdd )
3272
3265
{
3266
+ DEBUG_ASSERTCRASH (particleSystemToAdd != NULL , (" ParticleSystemManager::friend_addParticleSystem: ParticleSystem is null" ));
3273
3267
m_allParticleSystemList.push_back (particleSystemToAdd);
3274
3268
++m_particleSystemCount;
3275
3269
}
@@ -3283,8 +3277,9 @@ void ParticleSystemManager::friend_removeParticleSystem( ParticleSystem *particl
3283
3277
if (it != m_allParticleSystemList.end ()) {
3284
3278
m_allParticleSystemList.erase (it);
3285
3279
--m_particleSystemCount;
3280
+ } else {
3281
+ DEBUG_CRASH ((" ParticleSystemManager::friend_removeParticleSystem: ParticleSystem to remove was not recognized" ));
3286
3282
}
3287
-
3288
3283
}
3289
3284
3290
3285
// ------------------------------------------------------------------------------------------------
0 commit comments