mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Tweaks
This commit is contained in:
parent
21c1f47a78
commit
1a78ea15bb
@ -12,7 +12,7 @@ MapObjectsEvaluator & MapObjectsEvaluator::getInstance()
|
||||
return *(singletonInstance.get());
|
||||
}
|
||||
|
||||
MapObjectsEvaluator::MapObjectsEvaluator() : objectDatabase(std::map<CompoundMapObjectID, int>())
|
||||
MapObjectsEvaluator::MapObjectsEvaluator()
|
||||
{
|
||||
for(auto primaryID : VLC->objtypeh->knownObjects())
|
||||
{
|
||||
@ -21,9 +21,7 @@ MapObjectsEvaluator::MapObjectsEvaluator() : objectDatabase(std::map<CompoundMap
|
||||
auto handler = VLC->objtypeh->getHandlerFor(primaryID, secondaryID);
|
||||
if(!handler->isStaticObject() && handler->getRMGInfo().value)
|
||||
{
|
||||
CompoundMapObjectID newObjectType = CompoundMapObjectID(primaryID, secondaryID);
|
||||
std::pair<CompoundMapObjectID, int> newObject = { newObjectType, handler->getRMGInfo().value };
|
||||
objectDatabase.insert(newObject);
|
||||
objectDatabase[CompoundMapObjectID(primaryID, secondaryID)] = handler->getRMGInfo().value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -46,7 +44,7 @@ void MapObjectsEvaluator::addObjectData(int primaryID, int secondaryID, int valu
|
||||
objectDatabase.insert_or_assign(internalIdentifier, value);
|
||||
}
|
||||
|
||||
void MapObjectsEvaluator::removeObjectData(int primaryID, int secondaryID, int value)
|
||||
void MapObjectsEvaluator::removeObjectData(int primaryID, int secondaryID)
|
||||
{
|
||||
CompoundMapObjectID internalIdentifier = CompoundMapObjectID(primaryID, secondaryID);
|
||||
vstd::erase_if_present(objectDatabase, internalIdentifier);
|
||||
|
@ -20,6 +20,6 @@ public:
|
||||
static MapObjectsEvaluator & getInstance();
|
||||
boost::optional<int> getObjectValue(int primaryID, int secondaryID) const;
|
||||
void addObjectData(int primaryID, int secondaryID, int value);
|
||||
void removeObjectData(int primaryID, int secondaryID, int value);
|
||||
void removeObjectData(int primaryID, int secondaryID);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user