Splash was broken and destructor needs to cleanup more

This commit is contained in:
titiger 2014-07-19 20:26:45 +02:00
parent 666333b4a1
commit 26bab8548c
3 changed files with 10 additions and 17 deletions

View File

@ -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<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader){

View File

@ -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<string,vector<pair<string, string> > > &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;}

View File

@ -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);