diff --git a/source/glest_game/types/skill_type.cpp b/source/glest_game/types/skill_type.cpp index 935346cb7..ef13f41e2 100644 --- a/source/glest_game/types/skill_type.cpp +++ b/source/glest_game/types/skill_type.cpp @@ -373,7 +373,7 @@ void SkillType::loadAttackBoost(const XmlNode *attackBoostsNode, const XmlNode * else { char szBuf[8096] = ""; snprintf(szBuf, 8096,"Unsupported target [%s] specified for attack boost for skill [%s] in [%s]", targetType.c_str(), name.c_str(), parentLoader.c_str()); - throw megaglest_runtime_error(szBuf); + throw megaglest_runtime_error(szBuf,true); } // Load the regular targets @@ -488,7 +488,7 @@ void SkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, if(animations.empty() == true) { char szBuf[8096]=""; snprintf(szBuf,8096,"Error no animations found for skill [%s] for parentLoader [%s]",name.c_str(),parentLoader.c_str()); - throw megaglest_runtime_error(szBuf); + throw megaglest_runtime_error(szBuf,true); } } @@ -889,7 +889,7 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, if(attackVar < 0) { char szBuf[8096]=""; snprintf(szBuf,8096,"The attack skill has an INVALID attack var value which is < 0 [%d] in file [%s]!",attackVar,dir.c_str()); - throw megaglest_runtime_error(szBuf); + throw megaglest_runtime_error(szBuf,true); } attackRange= sn->getChild("attack-range")->getAttribute("value")->getIntValue(); @@ -922,7 +922,7 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, attackFields[fAir]= true; } else{ - throw megaglest_runtime_error("Not a valid field: "+fieldName+": "+ dir); + throw megaglest_runtime_error("Not a valid field: "+fieldName+": "+ dir,true); } } @@ -990,7 +990,7 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, } if(totalDamagePercentage!=100){ - throw megaglest_runtime_error("Damages percentages of projectiles don't sum up to 100 %"); + throw megaglest_runtime_error("Damages percentages of projectiles don't sum up to 100 %",true); } if(sn->hasChild("hitsound")==true){ diff --git a/source/glest_game/types/tech_tree.cpp b/source/glest_game/types/tech_tree.cpp index 5db23f1fd..a5dba17b1 100644 --- a/source/glest_game/types/tech_tree.cpp +++ b/source/glest_game/types/tech_tree.cpp @@ -246,9 +246,13 @@ void TechTree::load(const string &dir, set &factions, Checksum* checksum resourceTypes[i].deletePixels(); } } - catch(const exception &e){ - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); - throw megaglest_runtime_error("Error loading Resource Types in: [" + currentPath + "]\n" + e.what(),isValidationModeEnabled); + catch(megaglest_runtime_error& ex) { + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what()); + throw megaglest_runtime_error("Error loading Resource Types in: "+ currentPath + "\nMessage: " + ex.what(),!ex.wantStackTrace() || isValidationModeEnabled); + } + catch(const exception &e){ + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); + throw megaglest_runtime_error("Error loading Resource Types in: "+ currentPath + "\nMessage: " + e.what(),isValidationModeEnabled); } // give CPU time to update other things to avoid apperance of hanging @@ -318,9 +322,13 @@ void TechTree::load(const string &dir, set &factions, Checksum* checksum SDL_PumpEvents(); } } - catch(const exception &e){ - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); - throw megaglest_runtime_error("Error loading Tech Tree: "+ currentPath + "\n" + e.what(),isValidationModeEnabled); + catch(megaglest_runtime_error& ex) { + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what()); + throw megaglest_runtime_error("Error loading Tech Tree: "+ currentPath + "\nMessage: " + ex.what(),!ex.wantStackTrace() || isValidationModeEnabled); + } + catch(const exception &e){ + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); + throw megaglest_runtime_error("Error loading Tech Tree: "+ currentPath + "\nMessage: " + e.what(),isValidationModeEnabled); } // give CPU time to update other things to avoid apperance of hanging @@ -446,7 +454,7 @@ FactionType *TechTree::getTypeByName(const string &name) { } } if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - throw megaglest_runtime_error("Faction not found: " + name,isValidationModeEnabled); + throw megaglest_runtime_error("Faction not found: " + name,true); } const FactionType *TechTree::getType(const string &name) const { @@ -456,7 +464,7 @@ const FactionType *TechTree::getType(const string &name) const { } } if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - throw megaglest_runtime_error("Faction not found: " + name,isValidationModeEnabled); + throw megaglest_runtime_error("Faction not found: " + name,true); } const ResourceType *TechTree::getTechResourceType(int i) const{ @@ -483,7 +491,7 @@ const ResourceType *TechTree::getFirstTechResourceType() const{ char szBuf[8096]=""; snprintf(szBuf,8096,"The referenced tech tree [%s] is either missing or has no resources defined but at least one resource is required.",this->name.c_str()); - throw megaglest_runtime_error(szBuf,isValidationModeEnabled); + throw megaglest_runtime_error(szBuf,true); } const ResourceType *TechTree::getResourceType(const string &name) const{ @@ -494,7 +502,7 @@ const ResourceType *TechTree::getResourceType(const string &name) const{ } } - throw megaglest_runtime_error("Resource Type not found: " + name,isValidationModeEnabled); + throw megaglest_runtime_error("Resource Type not found: " + name,true); } const ArmorType *TechTree::getArmorType(const string &name) const{ @@ -504,7 +512,7 @@ const ArmorType *TechTree::getArmorType(const string &name) const{ } } - throw megaglest_runtime_error("Armor Type not found: " + name,isValidationModeEnabled); + throw megaglest_runtime_error("Armor Type not found: " + name,true); } const AttackType *TechTree::getAttackType(const string &name) const{ @@ -514,7 +522,7 @@ const AttackType *TechTree::getAttackType(const string &name) const{ } } - throw megaglest_runtime_error("Attack Type not found: " + name,isValidationModeEnabled); + throw megaglest_runtime_error("Attack Type not found: " + name,true); } double TechTree::getDamageMultiplier(const AttackType *att, const ArmorType *art) const { diff --git a/source/glest_game/types/unit_type.cpp b/source/glest_game/types/unit_type.cpp index e2babacb5..cde886bb3 100644 --- a/source/glest_game/types/unit_type.cpp +++ b/source/glest_game/types/unit_type.cpp @@ -282,7 +282,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, if(parametersNode->getChild("max-hp")->hasAttribute("start-value") && parametersNode->getChild("max-hp")->hasAttribute("start-percentage")) { throw megaglest_runtime_error("Unit " + name + - " has both start-value and start-percentage for HP", validationMode); + " has both start-value and start-percentage for HP", true); } //startHpValue -- the *absolute* value to use for starting HP @@ -312,7 +312,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, if(parametersNode->getChild("max-ep")->hasAttribute("start-value") && parametersNode->getChild("max-ep")->hasAttribute("start-percentage")) { throw megaglest_runtime_error("Unit " + name + - " has both start-value and start-percentage for EP", validationMode); + " has both start-value and start-percentage for EP", true); } //startEpValue -- the *absolute* value to use for starting EP @@ -380,7 +380,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const XmlNode *rowNode= cellMapNode->getChild("row", i); string row= rowNode->getAttribute("value")->getRestrictedValue(); if((int)row.size() != size){ - throw megaglest_runtime_error("Cellmap row has not the same length as unit size",validationMode); + throw megaglest_runtime_error("Cellmap row has not the same length as unit size",true); } for(int j=0; j < (int)row.size(); ++j){ cellMap[i*size+j]= row[j]=='0'? false: true; @@ -411,7 +411,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, fields[fAir]= true; } else{ - throw megaglest_runtime_error("Not a valid field: "+fieldName+": "+ path, validationMode); + throw megaglest_runtime_error("Not a valid field: "+fieldName+": "+ path, true); } } @@ -422,7 +422,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, field = fAir; } else { - throw megaglest_runtime_error("Unit has no field: " + path, validationMode); + throw megaglest_runtime_error("Unit has no field: " + path, true); } //properties @@ -439,7 +439,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, } } if(!found) { - throw megaglest_runtime_error("Unknown property: " + propertyName, validationMode); + throw megaglest_runtime_error("Unknown property: " + propertyName, true); } } //damage-particles @@ -497,7 +497,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, } else if(current=="off") { healthbarVisible=healthbarVisible|hbvOff; } else { - throw megaglest_runtime_error("Unknown Healthbar Visible Option: " + current, validationMode); + throw megaglest_runtime_error("Unknown Healthbar Visible Option: " + current, true); } } } @@ -880,10 +880,10 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, computeFirstCtOfClass(); if(getFirstStOfClass(scStop)==NULL){ - throw megaglest_runtime_error("Every unit must have at least one stop skill: "+ path,validationMode); + throw megaglest_runtime_error("Every unit must have at least one stop skill: "+ path,true); } if(getFirstStOfClass(scDie)==NULL){ - throw megaglest_runtime_error("Every unit must have at least one die skill: "+ path,validationMode); + throw megaglest_runtime_error("Every unit must have at least one die skill: "+ path,true); } }