- updated commandline param to allow validation on filtered techtrees and factions

This commit is contained in:
Mark Vejvoda 2010-08-21 02:13:50 +00:00
parent 25a7097066
commit 5537a37b35

View File

@ -436,11 +436,16 @@ int glestMain(int argc, char** argv){
printf("\n--help\t\t\t\tdisplays this help text.");
printf("\n--version\t\t\tdisplays the version string of this program.");
printf("\n--opengl-info\t\t\tdisplays your video driver's OpenGL information.");
printf("\n--validate-techtrees\t\tdisplays a report detailing any known problems related");
printf("\n \t\tto your game techtree data.");
printf("\n--validate-techtrees=x\t\tdisplays a report detailing any known problems related");
printf("\n \t\tto your selected techtrees game data.");
printf("\n \t\tWhere x is a comma-delimited list of techtrees to validate.");
printf("\n \t\texample: %s --validate-techtrees=megapack,vbros_pack_5",argv[0]);
printf("\n--validate-factions=x\t\tdisplays a report detailing any known problems related");
printf("\n \t\tto your selected factions game data.");
printf("\n \t\tWhere x is a comma-delimited list of factions to validate.");
printf("\n \t\t*NOTE: leaving the list empty is the same as running");
printf("\n \t\t--validate-techtrees");
printf("\n \t\texample: %s --validate-factions=tech,egypt",argv[0]);
printf("\n\n");
return -1;
}
@ -650,6 +655,28 @@ int glestMain(int argc, char** argv){
vector<string> results;
findDirs(config.getPathListForType(ptTechs), results);
vector<string> techTreeFiles = results;
// Did the user pass a specific list of techtrees to validate?
std::vector<string> filteredTechTreeList;
if(hasCommandArgument(argc, argv,"--validate-techtrees=") == true) {
int foundParamIndIndex = -1;
hasCommandArgument(argc, argv,"--validate-techtrees=",&foundParamIndIndex);
string filterList = argv[foundParamIndIndex];
vector<string> paramPartTokens;
Tokenize(filterList,paramPartTokens,"=");
if(paramPartTokens.size() >= 2) {
string techtreeList = paramPartTokens[1];
Tokenize(techtreeList,filteredTechTreeList,",");
if(filteredTechTreeList.size() > 0) {
printf("Filtering techtrees and only looking for the following:\n");
for(int idx = 0; idx < filteredTechTreeList.size(); ++idx) {
filteredTechTreeList[idx] = trim(filteredTechTreeList[idx]);
printf("%s\n",filteredTechTreeList[idx].c_str());
}
}
}
}
{
World world;
@ -660,6 +687,9 @@ int glestMain(int argc, char** argv){
for(int idx2 = 0; idx2 < techTreeFiles.size(); idx2++) {
string &techName = techTreeFiles[idx2];
if( filteredTechTreeList.size() == 0 ||
std::find(filteredTechTreeList.begin(),filteredTechTreeList.end(),techName) != filteredTechTreeList.end()) {
vector<string> factionsList;
findAll(techPath + "/" + techName + "/factions/*.", factionsList, false, false);
@ -722,6 +752,7 @@ int glestMain(int argc, char** argv){
}
}
}
}
printf("\n====== Finished Validation ======\n");
}