- added more techtree validations to indicate things that may make a problem for the AI and invalid xml configurations (like harvest skill but no move skill)

This commit is contained in:
Mark Vejvoda 2011-04-06 18:03:22 +00:00
parent d8c337ae7b
commit a6ccf539e6
2 changed files with 25 additions and 2 deletions

View File

@ -387,6 +387,25 @@ std::vector<std::string> FactionType::validateFactionType() {
}
}
// end
// Check if the unit has both be_built and harvest skills, this may cause issues
// with the AI
if(unitType.hasSkillClass(scBeBuilt) == true && unitType.hasSkillClass(scHarvest) == true) {
char szBuf[4096]="";
sprintf(szBuf,"The Unit [%s] in Faction [%s] has both a bebuilt and harvest skill which will cause AI problems for CPU players!",unitType.getName().c_str(),this->getName().c_str());
results.push_back(szBuf);
}
// end
// Check if the unit has harvest skills but not move, meaning they cannot
// harvest the resource
if(unitType.hasSkillClass(scHarvest) == true && unitType.hasSkillClass(scMove) == false) {
char szBuf[4096]="";
sprintf(szBuf,"The Unit [%s] in Faction [%s] has a harvest skill but no move skill so it cannot harvest!",unitType.getName().c_str(),this->getName().c_str());
results.push_back(szBuf);
}
// end
}
return results;

View File

@ -204,10 +204,14 @@ std::vector<std::string> TechTree::validateFactionTypes() {
std::vector<std::string> results;
for (int i = 0; i < factionTypes.size(); ++i) {
std::vector<std::string> factionResults = factionTypes[i].validateFactionType();
results.insert(results.end(), factionResults.begin(), factionResults.end());
if(factionResults.size() > 0) {
results.insert(results.end(), factionResults.begin(), factionResults.end());
}
factionResults = factionTypes[i].validateFactionTypeUpgradeTypes();
results.insert(results.end(), factionResults.begin(), factionResults.end());
if(factionResults.size() > 0) {
results.insert(results.end(), factionResults.begin(), factionResults.end());
}
}
return results;