diff --git a/Global.h b/Global.h index f9e25f3ff..3d777350e 100644 --- a/Global.h +++ b/Global.h @@ -676,6 +676,18 @@ namespace vstd return v3; } + template + bool containsMapping(const std::multimap & map, const std::pair & mapping) + { + auto range = map.equal_range(mapping.first); + for(auto contained = range.first; contained != range.second; contained++) + { + if(mapping.second == contained->second) + return true; + } + return false; + } + using boost::math::round; } using vstd::operator-=; diff --git a/config/skills.json b/config/skills.json index d62bb0a0f..8107c6537 100644 --- a/config/skills.json +++ b/config/skills.json @@ -4,7 +4,7 @@ "description" : "Hero generates 250 gold each day.", "effects" : [ { - "subtype" : 13, + "subtype" : "skill.estates", "type" : "SECONDARY_SKILL_PREMY", "val" : 250, "valueType" : "BASE_NUMBER" @@ -15,7 +15,7 @@ "description" : "Hero generates 500 gold each day.", "effects" : [ { - "subtype" : 13, + "subtype" : "skill.estates", "type" : "SECONDARY_SKILL_PREMY", "val" : 500, "valueType" : "BASE_NUMBER" @@ -26,7 +26,7 @@ "description" : "Hero generates 1000 gold each day.", "effects" : [ { - "subtype" : 13, + "subtype" : "skill.estates", "type" : "SECONDARY_SKILL_PREMY", "val" : 1000, "valueType" : "BASE_NUMBER" diff --git a/lib/CModHandler.cpp b/lib/CModHandler.cpp index 3020235e1..bddf5ee23 100644 --- a/lib/CModHandler.cpp +++ b/lib/CModHandler.cpp @@ -204,8 +204,8 @@ void CIdentifierStorage::registerObject(std::string scope, std::string type, std std::string fullID = type + '.' + name; checkIdentifier(fullID); - auto mapping = std::make_pair(fullID, data); - if(!registeredObjects.contains(mapping)) + std::pair mapping = std::make_pair(fullID, data); + if(!vstd::containsMapping(registeredObjects, mapping)) { CLogger::getLogger(CLoggerDomain("identifier"))->traceStream() << "registered " << fullID << " as " << scope << ":" << identifier; registeredObjects.insert(mapping); diff --git a/lib/CModHandler.h b/lib/CModHandler.h index 2655909cc..a3ed87b50 100644 --- a/lib/CModHandler.h +++ b/lib/CModHandler.h @@ -63,22 +63,7 @@ class CIdentifierStorage } }; - class ObjectMap: public std::multimap - { - public: - bool contains(const value_type & value) const - { - auto range = equal_range(value.first); - for(auto contained = range.first; contained != range.second; contained++) - { - if(value.second == contained->second) - return true; - } - return false; - } - }; - - ObjectMap registeredObjects; + std::multimap registeredObjects; std::vector scheduledRequests; ELoadingState state;