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