attempt to bugfix attackboost segfault discovered while playing vs Romans
This commit is contained in:
parent
ca45749cd8
commit
0f6e8ba928
|
@ -238,13 +238,16 @@ UnitAttackBoostEffect::~UnitAttackBoostEffect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ups != NULL) {
|
if(ups != NULL) {
|
||||||
ups->fade();
|
bool particleValid = Renderer::getInstance().validateParticleSystemStillExists(ups,rsGame);
|
||||||
|
if(particleValid == true) {
|
||||||
|
ups->fade();
|
||||||
|
|
||||||
vector<UnitParticleSystem *> particleSystemToRemove;
|
vector<UnitParticleSystem *> particleSystemToRemove;
|
||||||
particleSystemToRemove.push_back(ups);
|
particleSystemToRemove.push_back(ups);
|
||||||
|
|
||||||
Renderer::getInstance().cleanupUnitParticleSystems(particleSystemToRemove,rsGame);
|
Renderer::getInstance().cleanupUnitParticleSystems(particleSystemToRemove,rsGame);
|
||||||
ups = NULL;
|
ups = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete upst;
|
delete upst;
|
||||||
|
@ -955,12 +958,18 @@ void Unit::setVisible(const bool visible) {
|
||||||
for(unsigned int i = 0; i < currentAttackBoostEffects.size(); ++i) {
|
for(unsigned int i = 0; i < currentAttackBoostEffects.size(); ++i) {
|
||||||
UnitAttackBoostEffect *effect = currentAttackBoostEffects[i];
|
UnitAttackBoostEffect *effect = currentAttackBoostEffects[i];
|
||||||
if(effect != NULL && effect->ups != NULL) {
|
if(effect != NULL && effect->ups != NULL) {
|
||||||
effect->ups->setVisible(visible);
|
bool particleValid = Renderer::getInstance().validateParticleSystemStillExists(effect->ups,rsGame);
|
||||||
|
if(particleValid == true) {
|
||||||
|
effect->ups->setVisible(visible);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(currentAttackBoostOriginatorEffect.currentAppliedEffect != NULL) {
|
if(currentAttackBoostOriginatorEffect.currentAppliedEffect != NULL) {
|
||||||
if(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups != NULL) {
|
if(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups != NULL) {
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setVisible(visible);
|
bool particleValid = Renderer::getInstance().validateParticleSystemStillExists(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups,rsGame);
|
||||||
|
if(particleValid == true) {
|
||||||
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setVisible(visible);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1663,14 +1672,20 @@ bool Unit::update() {
|
||||||
for(unsigned int i = 0; i < currentAttackBoostEffects.size(); ++i) {
|
for(unsigned int i = 0; i < currentAttackBoostEffects.size(); ++i) {
|
||||||
UnitAttackBoostEffect *effect = currentAttackBoostEffects[i];
|
UnitAttackBoostEffect *effect = currentAttackBoostEffects[i];
|
||||||
if(effect != NULL && effect->ups != NULL) {
|
if(effect != NULL && effect->ups != NULL) {
|
||||||
effect->ups->setPos(getCurrVector());
|
bool particleValid = Renderer::getInstance().validateParticleSystemStillExists(effect->ups,rsGame);
|
||||||
effect->ups->setRotation(getRotation());
|
if(particleValid == true) {
|
||||||
|
effect->ups->setPos(getCurrVector());
|
||||||
|
effect->ups->setRotation(getRotation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(currentAttackBoostOriginatorEffect.currentAppliedEffect != NULL) {
|
if(currentAttackBoostOriginatorEffect.currentAppliedEffect != NULL) {
|
||||||
if(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups != NULL) {
|
if(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups != NULL) {
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(getCurrVector());
|
bool particleValid = Renderer::getInstance().validateParticleSystemStillExists(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups,rsGame);
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setRotation(getRotation());
|
if(particleValid == true) {
|
||||||
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(getCurrVector());
|
||||||
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setRotation(getRotation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user