From 57aceb60fb0b83bc531b328e70a5ec9c730d9d1f Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Mon, 20 Sep 2021 17:57:16 +0100 Subject: [PATCH] QOC Code cleaning of unnecessary else' Remove unnecessary dynamic_casts --- Engine/source/T3D/fx/explosion.cpp | 2 +- Engine/source/T3D/fx/explosion.h | 4 ++-- Engine/source/T3D/fx/lightning.cpp | 2 ++ Engine/source/T3D/fx/lightning.h | 8 ++++---- Engine/source/T3D/fx/precipitation.h | 4 ++-- Engine/source/T3D/fx/splash.cpp | 4 +++- Engine/source/T3D/fx/splash.h | 4 ++-- Engine/source/T3D/projectile.h | 5 +++-- Engine/source/T3D/rigidShape.h | 8 ++++---- Engine/source/T3D/vehicles/flyingVehicle.h | 4 ++-- Engine/source/T3D/vehicles/hoverVehicle.h | 4 ++-- Engine/source/T3D/vehicles/vehicle.h | 8 ++++---- Engine/source/T3D/vehicles/wheeledVehicle.h | 4 ++-- 13 files changed, 33 insertions(+), 28 deletions(-) diff --git a/Engine/source/T3D/fx/explosion.cpp b/Engine/source/T3D/fx/explosion.cpp index e842f73e4..6fc59b825 100644 --- a/Engine/source/T3D/fx/explosion.cpp +++ b/Engine/source/T3D/fx/explosion.cpp @@ -1382,7 +1382,7 @@ bool Explosion::explode() resetWorldBox(); } - SFXProfile* sound_prof = dynamic_cast(mDataBlock->getSFXProfile()); + SFXProfile* sound_prof = mDataBlock->getSFXProfile(); if (sound_prof) { soundProfile_clone = sound_prof->cloneAndPerformSubstitutions(ss_object, ss_index); diff --git a/Engine/source/T3D/fx/explosion.h b/Engine/source/T3D/fx/explosion.h index 20eadcd88..37694dd1e 100644 --- a/Engine/source/T3D/fx/explosion.h +++ b/Engine/source/T3D/fx/explosion.h @@ -76,8 +76,8 @@ class ExplosionData : public GameBaseData { SFXProfile* getSFXProfile() { if (mSoundAsset.notNull()) return mSoundAsset->getSfxProfile(); - else - return NULL; + + return NULL; } ParticleEmitterData* particleEmitter; diff --git a/Engine/source/T3D/fx/lightning.cpp b/Engine/source/T3D/fx/lightning.cpp index 7586602d4..16e234818 100644 --- a/Engine/source/T3D/fx/lightning.cpp +++ b/Engine/source/T3D/fx/lightning.cpp @@ -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++) { diff --git a/Engine/source/T3D/fx/lightning.h b/Engine/source/T3D/fx/lightning.h index 7f706d9f8..f639db3b2 100644 --- a/Engine/source/T3D/fx/lightning.h +++ b/Engine/source/T3D/fx/lightning.h @@ -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; } }; diff --git a/Engine/source/T3D/fx/precipitation.h b/Engine/source/T3D/fx/precipitation.h index e8114b040..f9eb4bf02 100644 --- a/Engine/source/T3D/fx/precipitation.h +++ b/Engine/source/T3D/fx/precipitation.h @@ -75,8 +75,8 @@ class PrecipitationData : public GameBaseData SFXProfile* getSFXProfile() { if (mSoundAsset.notNull()) return mSoundAsset->getSfxProfile(); - else - return NULL; + + return NULL; } }; diff --git a/Engine/source/T3D/fx/splash.cpp b/Engine/source/T3D/fx/splash.cpp index 6af8a0c1a..c046ef1a0 100644 --- a/Engine/source/T3D/fx/splash.cpp +++ b/Engine/source/T3D/fx/splash.cpp @@ -97,7 +97,9 @@ SplashData::SplashData() U32 i; for (i = 0; i < NUM_TEX; i++) + { INIT_IMAGEASSET_ARRAY(Texture, i); + } for( i=0; i(mDataBlock->getSFXProfile()); + SFXProfile* sound_prof = mDataBlock->getSFXProfile(); if (sound_prof) { SFX->playOnce(sound_prof, &getTransform()); diff --git a/Engine/source/T3D/fx/splash.h b/Engine/source/T3D/fx/splash.h index 40c6838fc..fec9f601e 100644 --- a/Engine/source/T3D/fx/splash.h +++ b/Engine/source/T3D/fx/splash.h @@ -102,8 +102,8 @@ public: SFXProfile* getSFXProfile() { if (mSoundAsset.notNull()) return mSoundAsset->getSfxProfile(); - else - return NULL; + + return NULL; } ParticleEmitterData* emitterList[NUM_EMITTERS]; diff --git a/Engine/source/T3D/projectile.h b/Engine/source/T3D/projectile.h index f340d54a7..69bb84001 100644 --- a/Engine/source/T3D/projectile.h +++ b/Engine/source/T3D/projectile.h @@ -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; diff --git a/Engine/source/T3D/rigidShape.h b/Engine/source/T3D/rigidShape.h index 5fc6ee786..49e8c1fd6 100644 --- a/Engine/source/T3D/rigidShape.h +++ b/Engine/source/T3D/rigidShape.h @@ -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; diff --git a/Engine/source/T3D/vehicles/flyingVehicle.h b/Engine/source/T3D/vehicles/flyingVehicle.h index 18c3379e1..573d10ccc 100644 --- a/Engine/source/T3D/vehicles/flyingVehicle.h +++ b/Engine/source/T3D/vehicles/flyingVehicle.h @@ -51,8 +51,8 @@ struct FlyingVehicleData: public VehicleData { { if (mFlyingSoundsAsset[id] != NULL) return mFlyingSoundsAsset[id]->getSfxProfile(); - else - return NULL; + + return NULL; } enum Jets { diff --git a/Engine/source/T3D/vehicles/hoverVehicle.h b/Engine/source/T3D/vehicles/hoverVehicle.h index 63ff65977..da22da280 100644 --- a/Engine/source/T3D/vehicles/hoverVehicle.h +++ b/Engine/source/T3D/vehicles/hoverVehicle.h @@ -52,8 +52,8 @@ class HoverVehicleData : public VehicleData { if (mHoverSoundsAsset[id] != NULL) return mHoverSoundsAsset[id]->getSfxProfile(); - else - return NULL; + + return NULL; } enum Jets { diff --git a/Engine/source/T3D/vehicles/vehicle.h b/Engine/source/T3D/vehicles/vehicle.h index 1c26f6cba..3e9636027 100644 --- a/Engine/source/T3D/vehicles/vehicle.h +++ b/Engine/source/T3D/vehicles/vehicle.h @@ -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; diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.h b/Engine/source/T3D/vehicles/wheeledVehicle.h index f5fe52fef..2f37b6c13 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.h +++ b/Engine/source/T3D/vehicles/wheeledVehicle.h @@ -125,8 +125,8 @@ struct WheeledVehicleData: public VehicleData { if (mWheeledVehicleSoundsAsset[id] != NULL) return mWheeledVehicleSoundsAsset[id]->getSfxProfile(); - else - return NULL; + + return NULL; }