- updated techree validation output

This commit is contained in:
Mark Vejvoda 2010-08-26 04:31:48 +00:00
parent 58b23f8b91
commit 6fcf4295f1

View File

@ -753,6 +753,7 @@ int glestMain(int argc, char** argv){
} }
} }
printf("\n----------------------------------------------------------------");
printf("\nChecking techPath [%s] techName [%s] total faction count = %d\n",techPath.c_str(), techName.c_str(),factionsList.size()); printf("\nChecking techPath [%s] techName [%s] total faction count = %d\n",techPath.c_str(), techName.c_str(),factionsList.size());
for(int j = 0; j < factionsList.size(); ++j) { for(int j = 0; j < factionsList.size(); ++j) {
if( filteredFactionList.size() == 0 || if( filteredFactionList.size() == 0 ||
@ -761,54 +762,57 @@ int glestMain(int argc, char** argv){
} }
} }
bool techtree_errors = false; if(factions.size() > 0) {
world.loadTech(config.getPathListForType(ptTechs,""), techName, factions, &checksum); bool techtree_errors = false;
// Validate the faction setup to ensure we don't have any bad associations world.loadTech(config.getPathListForType(ptTechs,""), techName, factions, &checksum);
std::vector<std::string> resultErrors = world.validateFactionTypes(); // Validate the faction setup to ensure we don't have any bad associations
if(resultErrors.size() > 0) { std::vector<std::string> resultErrors = world.validateFactionTypes();
techtree_errors = true; if(resultErrors.size() > 0) {
// Display the validation errors techtree_errors = true;
string errorText = "\nErrors were detected:\n=====================\n"; // Display the validation errors
for(int i = 0; i < resultErrors.size(); ++i) { string errorText = "\nErrors were detected:\n=====================\n";
if(i > 0) { for(int i = 0; i < resultErrors.size(); ++i) {
errorText += "\n"; if(i > 0) {
errorText += "\n";
}
errorText += resultErrors[i];
} }
errorText += resultErrors[i]; errorText += "\n=====================\n";
//throw runtime_error(errorText);
printf("%s",errorText.c_str());
} }
errorText += "\n=====================\n";
//throw runtime_error(errorText);
printf("%s",errorText.c_str());
}
// Validate the faction resource setup to ensure we don't have any bad associations // Validate the faction resource setup to ensure we don't have any bad associations
printf("\nChecking resources, count = %d\n",world.getTechTree()->getResourceTypeCount()); printf("\nChecking resources, count = %d\n",world.getTechTree()->getResourceTypeCount());
for(int i = 0; i < world.getTechTree()->getResourceTypeCount(); ++i) { for(int i = 0; i < world.getTechTree()->getResourceTypeCount(); ++i) {
printf("Found techtree resource [%s]\n",world.getTechTree()->getResourceType(i)->getName().c_str()); printf("Found techtree resource [%s]\n",world.getTechTree()->getResourceType(i)->getName().c_str());
} }
resultErrors = world.validateResourceTypes(); resultErrors = world.validateResourceTypes();
if(resultErrors.size() > 0) { if(resultErrors.size() > 0) {
techtree_errors = true; techtree_errors = true;
// Display the validation errors // Display the validation errors
string errorText = "\nErrors were detected:\n=====================\n"; string errorText = "\nErrors were detected:\n=====================\n";
for(int i = 0; i < resultErrors.size(); ++i) { for(int i = 0; i < resultErrors.size(); ++i) {
if(i > 0) { if(i > 0) {
errorText += "\n"; errorText += "\n";
}
errorText += resultErrors[i];
} }
errorText += resultErrors[i]; errorText += "\n=====================\n";
//throw runtime_error(errorText);
printf("%s",errorText.c_str());
} }
errorText += "\n=====================\n";
//throw runtime_error(errorText);
printf("%s",errorText.c_str());
}
if(techtree_errors == false) { if(techtree_errors == false) {
printf("\nValidation found NO ERRORS for techPath [%s] techName [%s] factions checked (count = %d):\n",techPath.c_str(), techName.c_str(),factions.size()); printf("\nValidation found NO ERRORS for techPath [%s] techName [%s] factions checked (count = %d):\n",techPath.c_str(), techName.c_str(),factions.size());
for ( set<string>::iterator it = factions.begin(); it != factions.end(); ++it ) { for ( set<string>::iterator it = factions.begin(); it != factions.end(); ++it ) {
printf("Faction [%s]\n",(*it).c_str()); printf("Faction [%s]\n",(*it).c_str());
}
} }
} }
printf("----------------------------------------------------------------");
} }
} }
} }