Code cleaning of unnecessary else'
Remove unnecessary dynamic_casts
This commit is contained in:
marauder2k7 2021-09-20 17:57:16 +01:00
parent e9d0f68b55
commit 57aceb60fb
13 changed files with 33 additions and 28 deletions

View file

@ -1382,7 +1382,7 @@ bool Explosion::explode()
resetWorldBox();
}
SFXProfile* sound_prof = dynamic_cast<SFXProfile*>(mDataBlock->getSFXProfile());
SFXProfile* sound_prof = mDataBlock->getSFXProfile();
if (sound_prof)
{
soundProfile_clone = sound_prof->cloneAndPerformSubstitutions(ss_object, ss_index);

View file

@ -76,8 +76,8 @@ class ExplosionData : public GameBaseData {
SFXProfile* getSFXProfile() {
if (mSoundAsset.notNull())
return mSoundAsset->getSfxProfile();
else
return NULL;
return NULL;
}
ParticleEmitterData* particleEmitter;

View file

@ -241,7 +241,9 @@ LightningData::LightningData()
INIT_SOUNDASSET(StrikeSound);
for (S32 i = 0; i < MaxThunders; i++)
{
INIT_SOUNDASSET_ARRAY(ThunderSound, MaxThunders);
}
for (S32 i = 0; i < MaxTextures; i++)
{

View file

@ -97,15 +97,15 @@ class LightningData : public GameBaseData
{
if (mThunderSoundAsset[id] != NULL)
return mThunderSoundAsset[id]->getSfxProfile();
else
return NULL;
return NULL;
}
SFXProfile* getSFXProfile() {
if (mStrikeSoundAsset.notNull())
return mStrikeSoundAsset->getSfxProfile();
else
return NULL;
return NULL;
}
};

View file

@ -75,8 +75,8 @@ class PrecipitationData : public GameBaseData
SFXProfile* getSFXProfile() {
if (mSoundAsset.notNull())
return mSoundAsset->getSfxProfile();
else
return NULL;
return NULL;
}
};

View file

@ -97,7 +97,9 @@ SplashData::SplashData()
U32 i;
for (i = 0; i < NUM_TEX; i++)
{
INIT_IMAGEASSET_ARRAY(Texture, i);
}
for( i=0; i<NUM_TIME_KEYS; i++ )
times[i] = 1.0;
@ -679,7 +681,7 @@ void Splash::spawnExplosion()
/// could just play the explosion one, but explosion could be weapon specific,
/// splash sound could be liquid specific. food for thought.
SFXProfile* sound_prof = dynamic_cast<SFXProfile*>(mDataBlock->getSFXProfile());
SFXProfile* sound_prof = mDataBlock->getSFXProfile();
if (sound_prof)
{
SFX->playOnce(sound_prof, &getTransform());

View file

@ -102,8 +102,8 @@ public:
SFXProfile* getSFXProfile() {
if (mSoundAsset.notNull())
return mSoundAsset->getSfxProfile();
else
return NULL;
return NULL;
}
ParticleEmitterData* emitterList[NUM_EMITTERS];

View file

@ -118,11 +118,12 @@ public:
DECLARE_SOUNDASSET(ProjectileData, ProjectileSound);
DECLARE_SOUNDASSET_SETGET(ProjectileData, ProjectileSound);
SFXProfile* getSFXProfile() {
if (mProjectileSoundAsset.notNull())
return mProjectileSoundAsset->getSfxProfile();
else
return NULL;
return NULL;
}
LightDescription *lightDesc;

View file

@ -70,8 +70,8 @@ class RigidShapeData : public ShapeBaseData
{
if (mBodySoundsAsset[id] != NULL)
return mBodySoundsAsset[id]->getSfxProfile();
else
return NULL;
return NULL;
}
enum RigidShapeConsts
@ -98,8 +98,8 @@ class RigidShapeData : public ShapeBaseData
{
if (mWaterSoundsAsset[id] != NULL)
return mWaterSoundsAsset[id]->getSfxProfile();
else
return NULL;
return NULL;
}
F32 exitSplashSoundVel;

View file

@ -51,8 +51,8 @@ struct FlyingVehicleData: public VehicleData {
{
if (mFlyingSoundsAsset[id] != NULL)
return mFlyingSoundsAsset[id]->getSfxProfile();
else
return NULL;
return NULL;
}
enum Jets {

View file

@ -52,8 +52,8 @@ class HoverVehicleData : public VehicleData
{
if (mHoverSoundsAsset[id] != NULL)
return mHoverSoundsAsset[id]->getSfxProfile();
else
return NULL;
return NULL;
}
enum Jets {

View file

@ -56,8 +56,8 @@ struct VehicleData : public RigidShapeData
{
if (mVehicleBodySoundsAsset[id] != NULL)
return mVehicleBodySoundsAsset[id]->getSfxProfile();
else
return NULL;
return NULL;
}
@ -88,8 +88,8 @@ struct VehicleData : public RigidShapeData
{
if (mVehicleWaterSoundsAsset[id] != NULL)
return mVehicleWaterSoundsAsset[id]->getSfxProfile();
else
return NULL;
return NULL;
}
F32 exitSplashSoundVel;

View file

@ -125,8 +125,8 @@ struct WheeledVehicleData: public VehicleData
{
if (mWheeledVehicleSoundsAsset[id] != NULL)
return mWheeledVehicleSoundsAsset[id]->getSfxProfile();
else
return NULL;
return NULL;
}