- added a more graceful way to handle more serious errors during data validation commands in order to offer more detailed error analysis

This commit is contained in:
Mark Vejvoda 2013-11-04 07:21:04 +00:00
parent 7c4c7a142b
commit 1134ad399d
13 changed files with 703 additions and 593 deletions

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,9 @@ FactionType::FactionType() {
//load a faction, given a directory //load a faction, given a directory
void FactionType::load(const string &factionName, const TechTree *techTree, Checksum* checksum, void FactionType::load(const string &factionName, const TechTree *techTree, Checksum* checksum,
Checksum *techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList) { Checksum *techtreeChecksum,
std::map<string,vector<pair<string, string> > > &loadedFileList,
bool validationMode) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
@ -162,29 +164,49 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
int progressBaseValue=logger.getProgress(); int progressBaseValue=logger.getProgress();
for(int i = 0; i < unitTypes.size(); ++i) { for(int i = 0; i < unitTypes.size(); ++i) {
string str= currentPath + "units/" + unitTypes[i].getName(); string str= currentPath + "units/" + unitTypes[i].getName();
unitTypes[i].loaddd(i, str, techTree,techTreePath, this, checksum,techtreeChecksum,
loadedFileList); try {
logger.setProgress(progressBaseValue+(int)((((double)i + 1.0) / (double)unitTypes.size()) * 100.0/techTree->getTypeCount())); unitTypes[i].loaddd(i, str, techTree,techTreePath, this, checksum,techtreeChecksum,
SDL_PumpEvents(); loadedFileList,validationMode);
logger.setProgress(progressBaseValue+(int)((((double)i + 1.0) / (double)unitTypes.size()) * 100.0/techTree->getTypeCount()));
SDL_PumpEvents();
}
catch(megaglest_runtime_error& ex) {
if(validationMode == false) {
throw ex;
}
else {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
}
}
} }
} }
catch(megaglest_runtime_error& ex) { catch(megaglest_runtime_error& ex) {
//printf("1111111b ex.wantStackTrace() = %d\n",ex.wantStackTrace());
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
//printf("222222b\n"); throw megaglest_runtime_error("Error loading units: "+ currentPath + "\nMessage: " + ex.what(),!ex.wantStackTrace());
throw megaglest_runtime_error("Error loading units: "+ currentPath + "\n" + ex.what(),!ex.wantStackTrace());
} }
catch(const exception &e) { catch(const exception &e) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); 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 units: "+ currentPath + "\n" + e.what()); throw megaglest_runtime_error("Error loading units: "+ currentPath + "\nMessage: " + e.what());
} }
// b2) load upgrades // b2) load upgrades
try{ try{
for(int i = 0; i < upgradeTypes.size(); ++i) { for(int i = 0; i < upgradeTypes.size(); ++i) {
string str= currentPath + "upgrades/" + upgradeTypes[i].getName(); string str= currentPath + "upgrades/" + upgradeTypes[i].getName();
upgradeTypes[i].load(str, techTree, this, checksum,techtreeChecksum,
loadedFileList); try {
upgradeTypes[i].load(str, techTree, this, checksum,
techtreeChecksum,loadedFileList,validationMode);
}
catch(megaglest_runtime_error& ex) {
if(validationMode == false) {
throw ex;
}
else {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
}
}
SDL_PumpEvents(); SDL_PumpEvents();
} }
@ -214,7 +236,18 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
const XmlNode *resourceNode= startingResourcesNode->getChild("resource", i); const XmlNode *resourceNode= startingResourcesNode->getChild("resource", i);
string name= resourceNode->getAttribute("name")->getRestrictedValue(); string name= resourceNode->getAttribute("name")->getRestrictedValue();
int amount= resourceNode->getAttribute("amount")->getIntValue(); int amount= resourceNode->getAttribute("amount")->getIntValue();
startingResources[i].init(techTree->getResourceType(name), amount);
try {
startingResources[i].init(techTree->getResourceType(name), amount);
}
catch(megaglest_runtime_error& ex) {
if(validationMode == false) {
throw ex;
}
else {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\nFor FactionType: %s for StartResource: %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what(),this->name.c_str(),name.c_str());
}
}
SDL_PumpEvents(); SDL_PumpEvents();
} }
@ -858,29 +891,32 @@ void FactionType::deletePixels() {
bool FactionType::factionUsesResourceType(const ResourceType *rt) const { bool FactionType::factionUsesResourceType(const ResourceType *rt) const {
bool factionUsesResourceType = false; bool factionUsesResourceType = false;
for(unsigned int j = 0; factionUsesResourceType == false && j < this->getUnitTypeCount(); ++j) { if(rt != NULL) {
const UnitType *ut= this->getUnitType(j); for(unsigned int j = 0; factionUsesResourceType == false && j < this->getUnitTypeCount(); ++j) {
for(int k = 0; factionUsesResourceType == false && k < ut->getCostCount(); ++k) { const UnitType *ut= this->getUnitType(j);
const Resource *costResource = ut->getCost(k); for(int k = 0; factionUsesResourceType == false && k < ut->getCostCount(); ++k) {
//printf("#1 factionUsesResourceType, unit [%s] resource [%s] cost [%s]\n",ut->getName().c_str(),rt->getName().c_str(),costResource->getType()->getName().c_str()); const Resource *costResource = ut->getCost(k);
//printf("#1 factionUsesResourceType, unit [%s] resource [%s] cost [%s]\n",ut->getName().c_str(),rt->getName().c_str(),costResource->getType()->getName().c_str());
if(costResource != NULL && costResource->getType()->getName() == rt->getName()) { if(costResource != NULL && costResource->getType() != NULL &&
factionUsesResourceType = true; costResource->getType()->getName() == rt->getName()) {
break; factionUsesResourceType = true;
break;
}
} }
} if(factionUsesResourceType == false) {
if(factionUsesResourceType == false) { for(unsigned int k = 0; factionUsesResourceType == false && k < ut->getCommandTypeCount(); ++k) {
for(unsigned int k = 0; factionUsesResourceType == false && k < ut->getCommandTypeCount(); ++k) { const CommandType *commandType = ut->getCommandType(k);
const CommandType *commandType = ut->getCommandType(k); if(commandType != NULL && commandType->getClass() == ccHarvest) {
if(commandType != NULL && commandType->getClass() == ccHarvest) { const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType *>(commandType);
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType *>(commandType); if(hct != NULL && hct->getHarvestedResourceCount() > 0) {
if(hct != NULL && hct->getHarvestedResourceCount() > 0) { for(unsigned int l = 0; factionUsesResourceType == false && l < hct->getHarvestedResourceCount(); ++l) {
for(unsigned int l = 0; factionUsesResourceType == false && l < hct->getHarvestedResourceCount(); ++l) { //printf("#2 factionUsesResourceType, unit [%s] resource [%s] harvest [%s]\n",ut->getName().c_str(),rt->getName().c_str(),hct->getHarvestedResource(l)->getName().c_str());
//printf("#2 factionUsesResourceType, unit [%s] resource [%s] harvest [%s]\n",ut->getName().c_str(),rt->getName().c_str(),hct->getHarvestedResource(l)->getName().c_str());
if(hct->getHarvestedResource(l)->getName() == rt->getName()) { if(hct->getHarvestedResource(l)->getName() == rt->getName()) {
factionUsesResourceType = true; factionUsesResourceType = true;
break; break;
}
} }
} }
} }
@ -888,7 +924,6 @@ bool FactionType::factionUsesResourceType(const ResourceType *rt) const {
} }
} }
} }
return factionUsesResourceType; return factionUsesResourceType;
} }

View File

@ -100,7 +100,9 @@ public:
//init //init
FactionType(); FactionType();
void load(const string &factionName, const TechTree *techTree, Checksum* checksum, void load(const string &factionName, const TechTree *techTree, Checksum* checksum,
Checksum *techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList); Checksum *techtreeChecksum,
std::map<string,vector<pair<string, string> > > &loadedFileList,
bool validationMode=false);
virtual ~FactionType(); virtual ~FactionType();
const std::vector<FactionType::PairPUnitTypeInt> getAIBehaviorUnits(AIBehaviorUnitCategory category) const; const std::vector<FactionType::PairPUnitTypeInt> getAIBehaviorUnits(AIBehaviorUnitCategory category) const;

View File

@ -46,6 +46,7 @@ TechTree::TechTree(const vector<string> pathList) {
translatedTechNames.clear(); translatedTechNames.clear();
translatedTechFactionNames.clear(); translatedTechFactionNames.clear();
languageUsedForCache = ""; languageUsedForCache = "";
isValidationModeEnabled = false;
} }
string TechTree::getNameUntranslated() const { string TechTree::getNameUntranslated() const {
@ -155,13 +156,17 @@ string TechTree::getTranslatedFactionName(string techName, string factionName) {
} }
Checksum TechTree::loadTech(const string &techName, Checksum TechTree::loadTech(const string &techName,
set<string> &factions, Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList) { set<string> &factions, Checksum* checksum,
std::map<string,vector<pair<string, string> > > &loadedFileList,
bool validationMode) {
name = ""; name = "";
isValidationModeEnabled = validationMode;
Checksum techtreeChecksum; Checksum techtreeChecksum;
string path=findPath(techName); string path=findPath(techName);
if(path!="") { if(path!="") {
//printf(">>> path=%s\n",path.c_str()); //printf(">>> path=%s\n",path.c_str());
load(path, factions, checksum, &techtreeChecksum, loadedFileList); load(path, factions, checksum, &techtreeChecksum, loadedFileList,
validationMode);
} }
else { else {
printf(">>> techtree [%s] path not found.\n",techName.c_str()); printf(">>> techtree [%s] path not found.\n",techName.c_str());
@ -191,7 +196,9 @@ string TechTree::findPath(const string &techName, const vector<string> &pathTech
void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum, void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum,
Checksum *techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList) { Checksum *techtreeChecksum,
std::map<string,vector<pair<string, string> > > &loadedFileList,
bool validationMode) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
string currentPath = dir; string currentPath = dir;
@ -230,7 +237,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); 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()); throw megaglest_runtime_error("Error loading Resource Types in: [" + currentPath + "]\n" + e.what(),isValidationModeEnabled);
} }
// give CPU time to update other things to avoid apperance of hanging // give CPU time to update other things to avoid apperance of hanging
@ -302,7 +309,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); 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()); throw megaglest_runtime_error("Error loading Tech Tree: "+ currentPath + "\n" + e.what(),isValidationModeEnabled);
} }
// give CPU time to update other things to avoid apperance of hanging // give CPU time to update other things to avoid apperance of hanging
@ -327,7 +334,8 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
logger.setState(szBuf); logger.setState(szBuf);
logger.setProgress((int)((((double)i) / (double)factions.size()) * 100.0)); logger.setProgress((int)((((double)i) / (double)factions.size()) * 100.0));
factionTypes[i++].load(factionName, this, checksum,&checksumValue,loadedFileList); factionTypes[i++].load(factionName, this, checksum,&checksumValue,
loadedFileList,validationMode);
// give CPU time to update other things to avoid apperance of hanging // give CPU time to update other things to avoid apperance of hanging
sleep(0); sleep(0);
@ -336,14 +344,12 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
} }
} }
catch(megaglest_runtime_error& ex) { catch(megaglest_runtime_error& ex) {
//printf("1111111b ex.wantStackTrace() = %d\n",ex.wantStackTrace());
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
//printf("222222b\n"); throw megaglest_runtime_error("Error loading Faction Types: "+ currentPath + "\nMessage: " + ex.what(),!ex.wantStackTrace() || isValidationModeEnabled);
throw megaglest_runtime_error("Error loading Faction Types: "+ currentPath + "\n" + ex.what(),!ex.wantStackTrace());
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); 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 Faction Types: "+ currentPath + "\n" + e.what()); throw megaglest_runtime_error("Error loading Faction Types: "+ currentPath + "\nMessage: " + e.what(),isValidationModeEnabled);
} }
if(techtreeChecksum != NULL) { if(techtreeChecksum != NULL) {
@ -429,7 +435,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__); 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); throw megaglest_runtime_error("Faction not found: " + name,isValidationModeEnabled);
} }
const FactionType *TechTree::getType(const string &name) const { const FactionType *TechTree::getType(const string &name) const {
@ -439,7 +445,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__); 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); throw megaglest_runtime_error("Faction not found: " + name,isValidationModeEnabled);
} }
const ResourceType *TechTree::getTechResourceType(int i) const{ const ResourceType *TechTree::getTechResourceType(int i) const{
@ -466,8 +472,7 @@ const ResourceType *TechTree::getFirstTechResourceType() const{
char szBuf[8096]=""; 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()); 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("This tech tree has no resources defined, at least one is required"); throw megaglest_runtime_error(szBuf,isValidationModeEnabled);
throw megaglest_runtime_error(szBuf);
} }
const ResourceType *TechTree::getResourceType(const string &name) const{ const ResourceType *TechTree::getResourceType(const string &name) const{
@ -478,7 +483,7 @@ const ResourceType *TechTree::getResourceType(const string &name) const{
} }
} }
throw megaglest_runtime_error("Resource Type not found: "+name); throw megaglest_runtime_error("Resource Type not found: " + name,isValidationModeEnabled);
} }
const ArmorType *TechTree::getArmorType(const string &name) const{ const ArmorType *TechTree::getArmorType(const string &name) const{
@ -488,7 +493,7 @@ const ArmorType *TechTree::getArmorType(const string &name) const{
} }
} }
throw megaglest_runtime_error("Armor Type not found: "+name); throw megaglest_runtime_error("Armor Type not found: " + name,isValidationModeEnabled);
} }
const AttackType *TechTree::getAttackType(const string &name) const{ const AttackType *TechTree::getAttackType(const string &name) const{
@ -498,7 +503,7 @@ const AttackType *TechTree::getAttackType(const string &name) const{
} }
} }
throw megaglest_runtime_error("Attack Type not found: "+name); throw megaglest_runtime_error("Attack Type not found: " + name,isValidationModeEnabled);
} }
double TechTree::getDamageMultiplier(const AttackType *att, const ArmorType *art) const { double TechTree::getDamageMultiplier(const AttackType *att, const ArmorType *art) const {

View File

@ -56,12 +56,17 @@ private:
string languageUsedForCache; string languageUsedForCache;
std::map<string,string> translatedTechNames; std::map<string,string> translatedTechNames;
std::map<string,std::map<string,string> > translatedTechFactionNames; std::map<string,std::map<string,string> > translatedTechFactionNames;
bool isValidationModeEnabled;
public: public:
Checksum loadTech(const string &techName, Checksum loadTech(const string &techName,
set<string> &factions, Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList); set<string> &factions, Checksum* checksum,
std::map<string,vector<pair<string, string> > > &loadedFileList,
bool validationMode=false);
void load(const string &dir, set<string> &factions, Checksum* checksum, void load(const string &dir, set<string> &factions, Checksum* checksum,
Checksum *techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList); Checksum *techtreeChecksum,
std::map<string,vector<pair<string, string> > > &loadedFileList,
bool validationMode=false);
string findPath(const string &techName) const; string findPath(const string &techName) const;
static string findPath(const string &techName, const vector<string> &pathTechList); static string findPath(const string &techName, const vector<string> &pathTechList);

View File

@ -164,9 +164,11 @@ void UnitType::preLoad(const string &dir) {
name= lastDir(dir); name= lastDir(dir);
} }
void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const string &techTreePath, void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
const FactionType *factionType, Checksum* checksum, const string &techTreePath, const FactionType *factionType,
Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList) { Checksum* checksum, Checksum* techtreeChecksum,
std::map<string,vector<pair<string, string> > > &loadedFileList,
bool validationMode) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
@ -281,7 +283,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
const XmlNode *rowNode= cellMapNode->getChild("row", i); const XmlNode *rowNode= cellMapNode->getChild("row", i);
string row= rowNode->getAttribute("value")->getRestrictedValue(); string row= rowNode->getAttribute("value")->getRestrictedValue();
if(row.size()!=size){ if(row.size()!=size){
throw megaglest_runtime_error("Cellmap row has not the same length as unit size"); throw megaglest_runtime_error("Cellmap row has not the same length as unit size",validationMode);
} }
for(int j=0; j<row.size(); ++j){ for(int j=0; j<row.size(); ++j){
cellMap[i*size+j]= row[j]=='0'? false: true; cellMap[i*size+j]= row[j]=='0'? false: true;
@ -294,6 +296,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
levels.resize(levelsNode->getChildCount()); levels.resize(levelsNode->getChildCount());
for(int i=0; i<levels.size(); ++i){ for(int i=0; i<levels.size(); ++i){
const XmlNode *levelNode= levelsNode->getChild("level", i); const XmlNode *levelNode= levelsNode->getChild("level", i);
levels[i].init( levels[i].init(
levelNode->getAttribute("name")->getRestrictedValue(), levelNode->getAttribute("name")->getRestrictedValue(),
levelNode->getAttribute("kills")->getIntValue()); levelNode->getAttribute("kills")->getIntValue());
@ -311,7 +314,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
fields[fAir]= true; fields[fAir]= true;
} }
else{ else{
throw megaglest_runtime_error("Not a valid field: "+fieldName+": "+ path); throw megaglest_runtime_error("Not a valid field: "+fieldName+": "+ path, validationMode);
} }
} }
@ -322,7 +325,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
field = fAir; field = fAir;
} }
else { else {
throw megaglest_runtime_error("Unit has no field: " + path); throw megaglest_runtime_error("Unit has no field: " + path, validationMode);
} }
//properties //properties
@ -339,7 +342,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
} }
} }
if(!found) { if(!found) {
throw megaglest_runtime_error("Unknown property: " + propertyName); throw megaglest_runtime_error("Unknown property: " + propertyName, validationMode);
} }
} }
//damage-particles //damage-particles
@ -353,18 +356,11 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
string path= particleFileNode->getAttribute("path")->getRestrictedValue(); string path= particleFileNode->getAttribute("path")->getRestrictedValue();
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType(); UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
//Texture2D *newTexture = Renderer::getInstance().newTexture2D(rsGame);
//Texture2D *newTexture = NULL;
unitParticleSystemType->load(particleFileNode, dir, currentPath + path, unitParticleSystemType->load(particleFileNode, dir, currentPath + path,
&Renderer::getInstance(),loadedFileList, sourceXMLFile, &Renderer::getInstance(),loadedFileList, sourceXMLFile,
techTree->getPath()); techTree->getPath());
loadedFileList[currentPath + path].push_back(make_pair(sourceXMLFile,particleFileNode->getAttribute("path")->getRestrictedValue())); loadedFileList[currentPath + path].push_back(make_pair(sourceXMLFile,particleFileNode->getAttribute("path")->getRestrictedValue()));
//if(unitParticleSystemType->hasTexture() == false) {
//Renderer::getInstance().endLastTexture(rsGame,true);
//}
if(particleFileNode->getAttribute("minHp",false) != NULL && particleFileNode->getAttribute("maxHp",false) != NULL) { if(particleFileNode->getAttribute("minHp",false) != NULL && particleFileNode->getAttribute("maxHp",false) != NULL) {
unitParticleSystemType->setMinmaxEnabled(true); unitParticleSystemType->setMinmaxEnabled(true);
unitParticleSystemType->setMinHp(particleFileNode->getAttribute("minHp")->getIntValue()); unitParticleSystemType->setMinHp(particleFileNode->getAttribute("minHp")->getIntValue());
@ -374,7 +370,6 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
unitParticleSystemType->setMinmaxIsPercent(particleFileNode->getAttribute("ispercentbased")->getBoolValue()); unitParticleSystemType->setMinmaxIsPercent(particleFileNode->getAttribute("ispercentbased")->getBoolValue());
} }
//printf("Found customized particle trigger by HP [%d to %d]\n",unitParticleSystemType->getMinHp(),unitParticleSystemType->getMaxHp());
} }
damageParticleSystemTypes.push_back(unitParticleSystemType); damageParticleSystemTypes.push_back(unitParticleSystemType);
@ -476,8 +471,18 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
int index = 0; int index = 0;
for(std::map<string,int>::iterator iterMap = sortedItems.begin(); for(std::map<string,int>::iterator iterMap = sortedItems.begin();
iterMap != sortedItems.end(); ++iterMap) { iterMap != sortedItems.end(); ++iterMap) {
costs[index].init(techTree->getResourceType(iterMap->first), iterMap->second); try {
index++; costs[index].init(techTree->getResourceType(iterMap->first), iterMap->second);
index++;
}
catch(megaglest_runtime_error& ex) {
if(validationMode == false) {
throw ex;
}
else {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\nFor UnitType: %s Cost: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what(),name.c_str(),iterMap->second);
}
}
} }
sortedItems.clear(); sortedItems.clear();
hasDup = false; hasDup = false;
@ -508,8 +513,18 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
index = 0; index = 0;
for(std::map<string,int>::iterator iterMap = sortedItems.begin(); for(std::map<string,int>::iterator iterMap = sortedItems.begin();
iterMap != sortedItems.end(); ++iterMap) { iterMap != sortedItems.end(); ++iterMap) {
storedResources[index].init(techTree->getResourceType(iterMap->first), iterMap->second); try {
index++; storedResources[index].init(techTree->getResourceType(iterMap->first), iterMap->second);
index++;
}
catch(megaglest_runtime_error& ex) {
if(validationMode == false) {
throw ex;
}
else {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\nFor UnitType: %s Store: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what(),name.c_str(),iterMap->second);
}
}
} }
sortedItems.clear(); sortedItems.clear();
@ -544,21 +559,24 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
if(parametersNode->hasChild("count-unit-death-in-stats")){ if(parametersNode->hasChild("count-unit-death-in-stats")){
const XmlNode *countUnitDeathInStatsNode= parametersNode->getChild("count-unit-death-in-stats"); const XmlNode *countUnitDeathInStatsNode= parametersNode->getChild("count-unit-death-in-stats");
countUnitDeathInStats= countUnitDeathInStatsNode->getAttribute("value")->getBoolValue(); countUnitDeathInStats= countUnitDeathInStatsNode->getAttribute("value")->getBoolValue();
} else { }
else {
countUnitDeathInStats=true; countUnitDeathInStats=true;
} }
//countUnitProductionInStats //countUnitProductionInStats
if(parametersNode->hasChild("count-unit-production-in-stats")){ if(parametersNode->hasChild("count-unit-production-in-stats")){
const XmlNode *countUnitProductionInStatsNode= parametersNode->getChild("count-unit-production-in-stats"); const XmlNode *countUnitProductionInStatsNode= parametersNode->getChild("count-unit-production-in-stats");
countUnitProductionInStats= countUnitProductionInStatsNode->getAttribute("value")->getBoolValue(); countUnitProductionInStats= countUnitProductionInStatsNode->getAttribute("value")->getBoolValue();
} else { }
else {
countUnitProductionInStats=true; countUnitProductionInStats=true;
} }
//countUnitKillInStats //countUnitKillInStats
if(parametersNode->hasChild("count-unit-kill-in-stats")){ if(parametersNode->hasChild("count-unit-kill-in-stats")){
const XmlNode *countUnitKillInStatsNode= parametersNode->getChild("count-unit-kill-in-stats"); const XmlNode *countUnitKillInStatsNode= parametersNode->getChild("count-unit-kill-in-stats");
countUnitKillInStats= countUnitKillInStatsNode->getAttribute("value")->getBoolValue(); countUnitKillInStats= countUnitKillInStatsNode->getAttribute("value")->getBoolValue();
} else { }
else {
countUnitKillInStats=true; countUnitKillInStats=true;
} }
@ -622,9 +640,19 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
string classId= typeNode->getAttribute("value")->getRestrictedValue(); string classId= typeNode->getAttribute("value")->getRestrictedValue();
SkillType *skillType= SkillTypeFactory::getInstance().newInstance(classId); SkillType *skillType= SkillTypeFactory::getInstance().newInstance(classId);
skillType->load(sn, attackBoostsNode, dir, techTree, factionType, loadedFileList,sourceXMLFile); skillTypes[i]=NULL;
skillTypes[i]= skillType; try {
skillType->load(sn, attackBoostsNode, dir, techTree, factionType, loadedFileList,sourceXMLFile);
skillTypes[i]= skillType;
}
catch(megaglest_runtime_error& ex) {
if(validationMode == false) {
throw ex;
}
else {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\nFor UnitType: %s SkillType: %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what(),name.c_str(),classId.c_str());
}
}
} }
//commands //commands
@ -635,32 +663,42 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
const XmlNode *typeNode= commandNode->getChild("type"); const XmlNode *typeNode= commandNode->getChild("type");
string classId= typeNode->getAttribute("value")->getRestrictedValue(); string classId= typeNode->getAttribute("value")->getRestrictedValue();
CommandType *commandType= CommandTypeFactory::getInstance().newInstance(classId); CommandType *commandType= CommandTypeFactory::getInstance().newInstance(classId);
commandType->load(i, commandNode, dir, techTree, factionType, *this,
loadedFileList,sourceXMLFile); commandTypes[i]=NULL;
commandTypes[i]= commandType; try {
commandType->load(i, commandNode, dir, techTree, factionType, *this,
loadedFileList,sourceXMLFile);
commandTypes[i]= commandType;
}
catch(megaglest_runtime_error& ex) {
if(validationMode == false) {
throw ex;
}
else {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\nFor UnitType: %s CommandType:%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what(),name.c_str(),classId.c_str());
}
}
} }
computeFirstStOfClass(); computeFirstStOfClass();
computeFirstCtOfClass(); computeFirstCtOfClass();
if(getFirstStOfClass(scStop)==NULL){ if(getFirstStOfClass(scStop)==NULL){
throw megaglest_runtime_error("Every unit must have at least one stop skill: "+ path); throw megaglest_runtime_error("Every unit must have at least one stop skill: "+ path,validationMode);
} }
if(getFirstStOfClass(scDie)==NULL){ if(getFirstStOfClass(scDie)==NULL){
throw megaglest_runtime_error("Every unit must have at least one die skill: "+ path); throw megaglest_runtime_error("Every unit must have at least one die skill: "+ path,validationMode);
} }
} }
//Exception handling (conversions and so on); //Exception handling (conversions and so on);
catch(megaglest_runtime_error& ex) { catch(megaglest_runtime_error& ex) {
//printf("1111111a ex.wantStackTrace() = %d\n",ex.wantStackTrace());
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
//printf("222222a\n"); throw megaglest_runtime_error("Error loading UnitType: " + path + "\nMessage: " + ex.what(),!ex.wantStackTrace());
throw megaglest_runtime_error("Error loading UnitType: " + path + "\n" + ex.what(),!ex.wantStackTrace());
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); 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 UnitType: " + path + "\n" + e.what()); throw megaglest_runtime_error("Error loading UnitType: " + path + "\nMessage: " + e.what());
} }
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
@ -976,7 +1014,7 @@ void UnitType::computeFirstStOfClass() {
for(int j= 0; j < scCount; ++j) { for(int j= 0; j < scCount; ++j) {
firstSkillTypeOfClass[j]= NULL; firstSkillTypeOfClass[j]= NULL;
for(int i= 0; i < skillTypes.size(); ++i) { for(int i= 0; i < skillTypes.size(); ++i) {
if(skillTypes[i]->getClass()== SkillClass(j)) { if(skillTypes[i] != NULL && skillTypes[i]->getClass()== SkillClass(j)) {
firstSkillTypeOfClass[j]= skillTypes[i]; firstSkillTypeOfClass[j]= skillTypes[i];
break; break;
} }
@ -988,7 +1026,7 @@ void UnitType::computeFirstCtOfClass() {
for(int j = 0; j < ccCount; ++j) { for(int j = 0; j < ccCount; ++j) {
firstCommandTypeOfClass[j]= NULL; firstCommandTypeOfClass[j]= NULL;
for(int i = 0; i < commandTypes.size(); ++i) { for(int i = 0; i < commandTypes.size(); ++i) {
if(commandTypes[i]->getClass() == CommandClass(j)) { if(commandTypes[i] != NULL && commandTypes[i]->getClass() == CommandClass(j)) {
firstCommandTypeOfClass[j] = commandTypes[i]; firstCommandTypeOfClass[j] = commandTypes[i];
break; break;
} }

View File

@ -163,9 +163,12 @@ public:
UnitType(); UnitType();
virtual ~UnitType(); virtual ~UnitType();
void preLoad(const string &dir); void preLoad(const string &dir);
void loaddd(int id, const string &dir, const TechTree *techTree,const string &techTreePath, void loaddd(int id, const string &dir, const TechTree *techTree,
const string &techTreePath,
const FactionType *factionType, Checksum* checksum, const FactionType *factionType, Checksum* checksum,
Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList); Checksum* techtreeChecksum,
std::map<string,vector<pair<string, string> > > &loadedFileList,
bool validationMode=false);
virtual string getName(bool translatedValue=false) const; virtual string getName(bool translatedValue=false) const;

View File

@ -585,7 +585,9 @@ void UpgradeType::preLoad(const string &dir){
void UpgradeType::load(const string &dir, const TechTree *techTree, void UpgradeType::load(const string &dir, const TechTree *techTree,
const FactionType *factionType, Checksum* checksum, const FactionType *factionType, Checksum* checksum,
Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList) { Checksum* techtreeChecksum, std::map<string,
vector<pair<string, string> > > &loadedFileList,
bool validationMode) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
char szBuf[8096]=""; char szBuf[8096]="";
@ -610,29 +612,9 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
//image //image
image = NULL; // Not used for upgrade types image = NULL; // Not used for upgrade types
// const XmlNode *imageNode= upgradeNode->getChild("image");
// image= Renderer::getInstance().newTexture2D(rsGame);
// if(image) {
// image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath,true));
// }
// loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(make_pair(sourceXMLFile,imageNode->getAttribute("path")->getRestrictedValue()));
//if(fileExists(imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)) == false) {
// printf("\n***ERROR MISSING FILE [%s]\n",imageNode->getAttribute("path")->getRestrictedValue(currentPath,true).c_str());
//}
//image cancel //image cancel
cancelImage = NULL; // Not used for upgrade types cancelImage = NULL; // Not used for upgrade types
// const XmlNode *imageCancelNode= upgradeNode->getChild("image-cancel");
// cancelImage= Renderer::getInstance().newTexture2D(rsGame);
// if(cancelImage) {
// cancelImage->load(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true));
// }
// loadedFileList[imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(make_pair(sourceXMLFile,imageCancelNode->getAttribute("path")->getRestrictedValue()));
//if(fileExists(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)) == false) {
// printf("\n***ERROR MISSING FILE [%s]\n",imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true).c_str());
//}
//upgrade time //upgrade time
const XmlNode *upgradeTimeNode= upgradeNode->getChild("time"); const XmlNode *upgradeTimeNode= upgradeNode->getChild("time");
@ -719,8 +701,19 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
index = 0; index = 0;
for(std::map<string,int>::iterator iterMap = sortedItems.begin(); for(std::map<string,int>::iterator iterMap = sortedItems.begin();
iterMap != sortedItems.end(); ++iterMap) { iterMap != sortedItems.end(); ++iterMap) {
costs[index].init(techTree->getResourceType(iterMap->first), iterMap->second); try {
index++; costs[index].init(techTree->getResourceType(iterMap->first), iterMap->second);
index++;
}
catch(megaglest_runtime_error& ex) {
if(validationMode == false) {
throw ex;
}
else {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\nFor UpgradeType: %s Cost: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what(),name.c_str(),iterMap->second);
}
}
} }
sortedItems.clear(); sortedItems.clear();
hasDup = false; hasDup = false;

View File

@ -204,7 +204,9 @@ public:
void preLoad(const string &dir); void preLoad(const string &dir);
void load(const string &dir, const TechTree *techTree, void load(const string &dir, const TechTree *techTree,
const FactionType *factionType, Checksum* checksum, const FactionType *factionType, Checksum* checksum,
Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList); Checksum* techtreeChecksum,
std::map<string,vector<pair<string, string> > > &loadedFileList,
bool validationMode=false);
virtual string getName(bool translatedValue=false) const; virtual string getName(bool translatedValue=false) const;

View File

@ -454,14 +454,16 @@ Checksum World::loadTileset(const string &dir, Checksum *checksum, std::map<stri
//load tech //load tech
Checksum World::loadTech(const vector<string> pathList, const string &techName, Checksum World::loadTech(const vector<string> pathList, const string &techName,
set<string> &factions, Checksum *checksum, std::map<string,vector<pair<string, string> > > &loadedFileList) { set<string> &factions, Checksum *checksum,
std::map<string,vector<pair<string, string> > > &loadedFileList,
bool validationMode) {
Checksum techtreeChecksum; Checksum techtreeChecksum;
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
techTree = new TechTree(pathList); techTree = new TechTree(pathList);
techtreeChecksum = techTree->loadTech( techName, factions, techtreeChecksum = techTree->loadTech( techName, factions,
checksum,loadedFileList); checksum,loadedFileList,validationMode);
return techtreeChecksum; return techtreeChecksum;
} }

View File

@ -205,7 +205,9 @@ public:
std::map<string,vector<pair<string, string> > > &loadedFileList); std::map<string,vector<pair<string, string> > > &loadedFileList);
void clearTileset(); void clearTileset();
Checksum loadTech(const vector<string> pathList, const string &techName, Checksum loadTech(const vector<string> pathList, const string &techName,
set<string> &factions, Checksum* checksum,std::map<string,vector<pair<string, string> > > &loadedFileList); set<string> &factions, Checksum* checksum,
std::map<string,vector<pair<string, string> > > &loadedFileList,
bool validationMode=false);
Checksum loadMap(const string &path, Checksum* checksum); Checksum loadMap(const string &path, Checksum* checksum);
Checksum loadScenario(const string &path, Checksum* checksum,bool resetCurrentScenario=false,const XmlNode *rootNode=NULL); Checksum loadScenario(const string &path, Checksum* checksum,bool resetCurrentScenario=false,const XmlNode *rootNode=NULL);
void setQueuedScenario(string scenarioName,bool keepFactions); void setQueuedScenario(string scenarioName,bool keepFactions);

View File

@ -70,6 +70,7 @@ inline T truncateDecimal(const T &value, int precision=6) {
if((T)value * (T)precNum <= MAX_INT_VALUE) { if((T)value * (T)precNum <= MAX_INT_VALUE) {
int resultInt = (T)value * (T)precNum; int resultInt = (T)value * (T)precNum;
T result = (T)resultInt / precNum; T result = (T)resultInt / precNum;
//printf("=======================\nvalue = %.10f\nresultInt: %d\nprecision: %d\nbecame: %.10f\n----------\n",value,resultInt,precision,result);
return result; return result;
} }

View File

@ -60,12 +60,12 @@ const char * getDialogCommand() {
return NULL; return NULL;
} }
bool showMessage(const std::string & warning) { bool showMessage(std::string warning) {
bool guiMessage = false; bool guiMessage = false;
const char * dialogCommand = getDialogCommand(); const char * dialogCommand = getDialogCommand();
if (dialogCommand) { if (dialogCommand) {
std::string command = dialogCommand; std::string command = dialogCommand;
command += " --title \"Error\" --msgbox \"`printf \"" + warning + "\"`\""; command += " --title \"Error\" --msgbox \"`printf \"" + warning.erase(4096,std::string::npos) + "\"`\"";
//printf("\n\n\nzenity command [%s]\n\n\n",command.c_str()); //printf("\n\n\nzenity command [%s]\n\n\n",command.c_str());
@ -79,9 +79,11 @@ bool showMessage(const std::string & warning) {
} }
void message(string message, bool isNonGraphicalModeEnabled) { void message(string message, bool isNonGraphicalModeEnabled) {
std::cerr << "\n\n\n";
std::cerr << "******************************************************\n"; std::cerr << "******************************************************\n";
std::cerr << " " << message << "\n"; std::cerr << " " << message << "\n";
std::cerr << "******************************************************\n"; std::cerr << "******************************************************\n";
std::cerr << "\n\n\n";
if(isNonGraphicalModeEnabled == false) { if(isNonGraphicalModeEnabled == false) {
showMessage(message); showMessage(message);