diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 7b4fb5f3..d1eb8a81 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -728,6 +728,7 @@ int glestMain(int argc, char** argv){ { + printf("\n---------------- Loading factions inside world ----------------"); World world; vector techPaths = config.getPathListForType(ptTechs); @@ -752,18 +753,20 @@ int glestMain(int argc, char** argv){ } } - printf("\nChecking techPath [%s] techName [%s] factionsList.size() = %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) { if( filteredFactionList.size() == 0 || std::find(filteredFactionList.begin(),filteredFactionList.end(),factionsList[j]) != filteredFactionList.end()) { - printf("Found faction [%s]\n",factionsList[j].c_str()); + printf("Using faction [%s]\n",factionsList[j].c_str()); } } + bool techtree_errors = false; world.loadTech(config.getPathListForType(ptTechs,""), techName, factions, &checksum); // Validate the faction setup to ensure we don't have any bad associations std::vector resultErrors = world.validateFactionTypes(); if(resultErrors.size() > 0) { + techtree_errors = true; // Display the validation errors string errorText = "\nErrors were detected:\n=====================\n"; for(int i = 0; i < resultErrors.size(); ++i) { @@ -786,6 +789,7 @@ int glestMain(int argc, char** argv){ resultErrors = world.validateResourceTypes(); if(resultErrors.size() > 0) { + techtree_errors = true; // Display the validation errors string errorText = "\nErrors were detected:\n=====================\n"; for(int i = 0; i < resultErrors.size(); ++i) { @@ -798,6 +802,13 @@ int glestMain(int argc, char** argv){ //throw runtime_error(errorText); printf("%s",errorText.c_str()); } + + 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()); + for ( set::iterator it = factions.begin(); it != factions.end(); ++it ) { + printf("Faction [%s]\n",(*it).c_str()); + } + } } } } diff --git a/source/glest_game/types/faction_type.cpp b/source/glest_game/types/faction_type.cpp index 41d73d74..139c7aa9 100644 --- a/source/glest_game/types/faction_type.cpp +++ b/source/glest_game/types/faction_type.cpp @@ -193,8 +193,17 @@ std::vector FactionType::validateFactionType() { for(int l=0; lgetName()) { - foundUnit = true; - break; + foundUnit = true; + + // Now also validate the the unit to be built + // has a be_built_skill + if(buildUnit->hasSkillClass(scBeBuilt) == false) { + char szBuf[4096]=""; + sprintf(szBuf,"The Unit [%s] in Faction [%s] has the command [%s]\nwhich can build the Unit [%s] but the Unit to be built\ndoes not have the skill class [be_built_skill] in this faction!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),buildUnit->getName().c_str()); + results.push_back(szBuf); + } + + break; } }