From 26bab8548cdebaf2f629ccff9dea7e6812f10001 Mon Sep 17 00:00:00 2001 From: titiger Date: Sat, 19 Jul 2014 20:26:45 +0200 Subject: [PATCH] Splash was broken and destructor needs to cleanup more --- source/glest_game/types/projectile_type.cpp | 12 +++++++----- source/glest_game/types/projectile_type.h | 11 +---------- source/glest_game/world/unit_updater.cpp | 4 ++-- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/source/glest_game/types/projectile_type.cpp b/source/glest_game/types/projectile_type.cpp index 3b80c054..3e1607c3 100644 --- a/source/glest_game/types/projectile_type.cpp +++ b/source/glest_game/types/projectile_type.cpp @@ -24,11 +24,6 @@ ProjectileType::ProjectileType() { projectileParticleSystemType=NULL; attackStartTime=0.0f; - splash=false; - splashRadius=0; - splashDamageAll=true; - splashParticleSystemType=NULL; - shake=false; shakeIntensity=0; shakeDuration=0; @@ -39,6 +34,13 @@ ProjectileType::ProjectileType() { } +ProjectileType::~ProjectileType() { + deleteValues(hitSounds.getSounds().begin(), hitSounds.getSounds().end()); + if(projectileParticleSystemType!=NULL){ + delete projectileParticleSystemType; + projectileParticleSystemType = NULL; + } +} void ProjectileType::load(const XmlNode *projectileNode, const string &dir, const string &techtreepath, std::map > > &loadedFileList, string parentLoader){ diff --git a/source/glest_game/types/projectile_type.h b/source/glest_game/types/projectile_type.h index 3a3b6ec6..113ae607 100644 --- a/source/glest_game/types/projectile_type.h +++ b/source/glest_game/types/projectile_type.h @@ -41,11 +41,6 @@ protected: SoundContainer hitSounds; float attackStartTime; - bool splash; - int splashRadius; - bool splashDamageAll; - ParticleSystemTypeSplash* splashParticleSystemType; - bool shake; int shakeIntensity; int shakeDuration; @@ -56,7 +51,7 @@ protected: public: ProjectileType(); - virtual ~ProjectileType(){}; + virtual ~ProjectileType(); void load(const XmlNode *projectileNode, const string &dir, const string &techtreepath, std::map > > &loadedFileList, @@ -67,10 +62,6 @@ public: ParticleSystemTypeProjectile* getProjectileParticleSystemType() const { return projectileParticleSystemType;} float getAttackStartTime() const {return attackStartTime;} void setAttackStartTime(float value) {attackStartTime=value;} - bool isSplash() const { return splash;} - bool isSplashDamageAll() const { return splashDamageAll;} - ParticleSystemTypeSplash* getSplashParticleSystemType() const { return splashParticleSystemType;} - int getSplashRadius() const { return splashRadius;} bool isShake() const{return shake;} bool isShakeCameraDistanceAffected() const{return shakeCameraDistanceAffected;} diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 062cff84..dbfda944 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -2639,8 +2639,8 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit, float lastAnimProgress, } renderer.manageParticleSystem(psProj, rsGame); unit->addAttackParticleSystem(psProj); - ParticleSystemTypeSplash *splashType=(*pt)->getSplashParticleSystemType(); - if(splashType!=NULL){ + + if(pstSplash!=NULL){ SplashParticleSystem *psSplash= pstSplash->create(unit); psSplash->setPos(endPos); psSplash->setVisible(visible);