- fixed some particle issues

This commit is contained in:
Mark Vejvoda 2012-03-13 23:18:09 +00:00
parent 0ea22572dd
commit d4ca1c36cb

View File

@ -318,7 +318,7 @@ void UnitAttackBoostEffect::saveGame(XmlNode *rootNode) {
unitAttackBoostEffectNode->addAttribute("source",intToStr(source->getId()), mapTagReplacements); unitAttackBoostEffectNode->addAttribute("source",intToStr(source->getId()), mapTagReplacements);
} }
// UnitParticleSystem *ups; // UnitParticleSystem *ups;
if(ups != NULL) { if(ups != NULL && Renderer::getInstance().validateParticleSystemStillExists(ups,rsGame) == true) {
ups->saveGame(unitAttackBoostEffectNode); ups->saveGame(unitAttackBoostEffectNode);
} }
@ -3530,7 +3530,7 @@ void Unit::saveGame(XmlNode *rootNode) {
unitNode->addAttribute("showUnitParticles",intToStr(showUnitParticles), mapTagReplacements); unitNode->addAttribute("showUnitParticles",intToStr(showUnitParticles), mapTagReplacements);
// Faction *faction; // Faction *faction;
// ParticleSystem *fire; // ParticleSystem *fire;
if(fire != NULL) { if(fire != NULL && Renderer::getInstance().validateParticleSystemStillExists(fire,rsGame) == true) {
fire->saveGame(unitNode); fire->saveGame(unitNode);
} }
// TotalUpgrade totalUpgrade; // TotalUpgrade totalUpgrade;
@ -3553,7 +3553,7 @@ void Unit::saveGame(XmlNode *rootNode) {
// vector<UnitParticleSystem*> unitParticleSystems; // vector<UnitParticleSystem*> unitParticleSystems;
for(unsigned int i = 0; i < unitParticleSystems.size(); ++i) { for(unsigned int i = 0; i < unitParticleSystems.size(); ++i) {
UnitParticleSystem *ups= unitParticleSystems[i]; UnitParticleSystem *ups= unitParticleSystems[i];
if(ups != NULL) { if(ups != NULL && Renderer::getInstance().validateParticleSystemStillExists(ups,rsGame) == true) {
ups->saveGame(unitNode); ups->saveGame(unitNode);
} }
} }
@ -3568,7 +3568,7 @@ void Unit::saveGame(XmlNode *rootNode) {
// UnitParticleSystems damageParticleSystems; // UnitParticleSystems damageParticleSystems;
for(unsigned int i = 0; i < damageParticleSystems.size(); ++i) { for(unsigned int i = 0; i < damageParticleSystems.size(); ++i) {
UnitParticleSystem *ups= damageParticleSystems[i]; UnitParticleSystem *ups= damageParticleSystems[i];
if(ups != NULL) { if(ups != NULL && Renderer::getInstance().validateParticleSystemStillExists(ups,rsGame) == true) {
ups->saveGame(unitNode); ups->saveGame(unitNode);
} }
} }
@ -3576,7 +3576,7 @@ void Unit::saveGame(XmlNode *rootNode) {
// std::map<int, UnitParticleSystem *> damageParticleSystemsInUse; // std::map<int, UnitParticleSystem *> damageParticleSystemsInUse;
for(std::map<int, UnitParticleSystem *>::const_iterator iterMap = damageParticleSystemsInUse.begin(); for(std::map<int, UnitParticleSystem *>::const_iterator iterMap = damageParticleSystemsInUse.begin();
iterMap != damageParticleSystemsInUse.end(); ++iterMap) { iterMap != damageParticleSystemsInUse.end(); ++iterMap) {
if(iterMap->second != NULL) { if(iterMap->second != NULL && Renderer::getInstance().validateParticleSystemStillExists(iterMap->second,rsGame) == true) {
XmlNode *damageParticleSystemsInUseNode = unitNode->addChild("damageParticleSystemsInUse"); XmlNode *damageParticleSystemsInUseNode = unitNode->addChild("damageParticleSystemsInUse");
damageParticleSystemsInUseNode->addAttribute("key",intToStr(iterMap->first), mapTagReplacements); damageParticleSystemsInUseNode->addAttribute("key",intToStr(iterMap->first), mapTagReplacements);
@ -3586,7 +3586,7 @@ void Unit::saveGame(XmlNode *rootNode) {
// vector<ParticleSystem*> fireParticleSystems; // vector<ParticleSystem*> fireParticleSystems;
for(unsigned int i = 0; i < fireParticleSystems.size(); ++i) { for(unsigned int i = 0; i < fireParticleSystems.size(); ++i) {
ParticleSystem *ps= fireParticleSystems[i]; ParticleSystem *ps= fireParticleSystems[i];
if(ps != NULL) { if(ps != NULL && Renderer::getInstance().validateParticleSystemStillExists(ps,rsGame) == true) {
ps->saveGame(unitNode); ps->saveGame(unitNode);
} }
} }
@ -3594,7 +3594,7 @@ void Unit::saveGame(XmlNode *rootNode) {
// vector<UnitParticleSystem*> smokeParticleSystems; // vector<UnitParticleSystem*> smokeParticleSystems;
for(unsigned int i = 0; i < smokeParticleSystems.size(); ++i) { for(unsigned int i = 0; i < smokeParticleSystems.size(); ++i) {
UnitParticleSystem *ups= smokeParticleSystems[i]; UnitParticleSystem *ups= smokeParticleSystems[i];
if(ups != NULL) { if(ups != NULL && Renderer::getInstance().validateParticleSystemStillExists(ups,rsGame) == true) {
ups->saveGame(unitNode); ups->saveGame(unitNode);
} }
} }