- bugfix for validation techtree (resources with particles caused crash on validate)
This commit is contained in:
parent
b6a4e33e7d
commit
48b3a81cbd
|
@ -192,6 +192,16 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
|
|||
}
|
||||
}
|
||||
|
||||
ObjectParticleSystemType::ObjectParticleSystemType() : UnitParticleSystemType() {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s Line: %d] NEW [%p]\n",__FUNCTION__,__LINE__,this);
|
||||
}
|
||||
ObjectParticleSystemType::~ObjectParticleSystemType() {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) {
|
||||
printf("In [%s Line: %d] NEW [%p]\n",__FUNCTION__,__LINE__,this);
|
||||
printf("%s\n",PlatformExceptionHandler::getStackTrace().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
const void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
|
||||
// whilst we extend ParticleSystemType we don't use ParticleSystemType::setValues()
|
||||
// add instances of all children; some settings will cascade to all children
|
||||
|
|
|
@ -72,6 +72,7 @@ protected:
|
|||
|
||||
public:
|
||||
UnitParticleSystemType();
|
||||
virtual ~UnitParticleSystemType() {};
|
||||
|
||||
void load(const XmlNode *particleSystemNode, const string &dir,
|
||||
RendererInterface *newTexture, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
||||
|
@ -90,7 +91,10 @@ public:
|
|||
virtual void saveGame(XmlNode *rootNode);
|
||||
};
|
||||
|
||||
class ObjectParticleSystemType: public UnitParticleSystemType{
|
||||
class ObjectParticleSystemType: public UnitParticleSystemType {
|
||||
public:
|
||||
ObjectParticleSystemType();
|
||||
virtual ~ObjectParticleSystemType();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
|
|
@ -39,13 +39,16 @@ ResourceType::ResourceType() {
|
|||
recoup_cost = false;
|
||||
model = NULL;
|
||||
displayInHud = false;
|
||||
cleanupMemory = true;
|
||||
}
|
||||
|
||||
ResourceType::~ResourceType(){
|
||||
while(!(particleTypes.empty())){
|
||||
ResourceType::~ResourceType() {
|
||||
if(cleanupMemory == true) {
|
||||
while(particleTypes.empty() == false) {
|
||||
delete particleTypes.back();
|
||||
particleTypes.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtreeChecksum,
|
||||
|
|
|
@ -55,6 +55,7 @@ private:
|
|||
|
||||
Model *model;
|
||||
ObjectParticleSystemTypes particleTypes;
|
||||
bool cleanupMemory;
|
||||
|
||||
public:
|
||||
ResourceType();
|
||||
|
@ -77,6 +78,7 @@ public:
|
|||
bool hasParticles() const {return !particleTypes.empty();}
|
||||
const ObjectParticleSystemTypes *getObjectParticleSystemTypes() const {return &particleTypes;}
|
||||
|
||||
void setCleanupMemory(bool value) { cleanupMemory = value; }
|
||||
|
||||
static ResourceClass strToRc(const string &s);
|
||||
void deletePixels();
|
||||
|
|
|
@ -234,6 +234,10 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||
TechTree::~TechTree() {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
Logger::getInstance().add(Lang::getInstance().get("LogScreenGameUnLoadingTechtree","",true), true);
|
||||
resourceTypes.clear();
|
||||
factionTypes.clear();
|
||||
armorTypes.clear();
|
||||
attackTypes.clear();
|
||||
}
|
||||
|
||||
std::vector<std::string> TechTree::validateFactionTypes() {
|
||||
|
@ -256,6 +260,10 @@ std::vector<std::string> TechTree::validateFactionTypes() {
|
|||
std::vector<std::string> TechTree::validateResourceTypes() {
|
||||
std::vector<std::string> results;
|
||||
ResourceTypes resourceTypesNotUsed = resourceTypes;
|
||||
for (unsigned int i = 0; i < resourceTypesNotUsed.size(); ++i) {
|
||||
ResourceType &rt = resourceTypesNotUsed[i];
|
||||
rt.setCleanupMemory(false);
|
||||
}
|
||||
for (unsigned int i = 0; i < factionTypes.size(); ++i) {
|
||||
//printf("Validating [%d / %d] faction [%s]\n",i,(int)factionTypes.size(),factionTypes[i].getName().c_str());
|
||||
|
||||
|
|
Loading…
Reference in New Issue