Lootable resources now checks for dups

This commit is contained in:
Mike Hoffert 2014-07-19 16:52:53 -06:00
parent 3cae2559c7
commit 75eb5c8ddf
1 changed files with 8 additions and 3 deletions

View File

@ -591,8 +591,9 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
}
}
sortedItems.clear();
hasDup = false;
// Lootable resources
// Lootable resources (resources given/lost on death)
if(parametersNode->hasChild("resources-death")) {
const XmlNode *deathResourcesNode= parametersNode->getChild("resources-death");
@ -640,9 +641,13 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
resource.setNegativeAllowed(false);
}
lootableResources.push_back(resource);
// Figure out if there are duplicate resources. The value stored in the map is arbitrary,
// and exists solely because
if(std::find(lootableResources.begin(), lootableResources.end(), resource) != lootableResources.end()) {
printf("WARNING, unit type [%s] has one or more duplicate lootable resources\n", this->getName(false).c_str());
}
// TODO: Add checks for duplicate resources
lootableResources.push_back(resource);
}
}