From 1a78ea15bb517f29e3f48256be68f00a576d8621 Mon Sep 17 00:00:00 2001 From: Dydzio Date: Sun, 22 Jul 2018 19:53:06 +0200 Subject: [PATCH] Tweaks --- AI/VCAI/MapObjectsEvaluator.cpp | 8 +++----- AI/VCAI/MapObjectsEvaluator.h | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/AI/VCAI/MapObjectsEvaluator.cpp b/AI/VCAI/MapObjectsEvaluator.cpp index c82c890d8..740174a6a 100644 --- a/AI/VCAI/MapObjectsEvaluator.cpp +++ b/AI/VCAI/MapObjectsEvaluator.cpp @@ -12,7 +12,7 @@ MapObjectsEvaluator & MapObjectsEvaluator::getInstance() return *(singletonInstance.get()); } -MapObjectsEvaluator::MapObjectsEvaluator() : objectDatabase(std::map()) +MapObjectsEvaluator::MapObjectsEvaluator() { for(auto primaryID : VLC->objtypeh->knownObjects()) { @@ -21,9 +21,7 @@ MapObjectsEvaluator::MapObjectsEvaluator() : objectDatabase(std::mapobjtypeh->getHandlerFor(primaryID, secondaryID); if(!handler->isStaticObject() && handler->getRMGInfo().value) { - CompoundMapObjectID newObjectType = CompoundMapObjectID(primaryID, secondaryID); - std::pair 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); diff --git a/AI/VCAI/MapObjectsEvaluator.h b/AI/VCAI/MapObjectsEvaluator.h index a7d625244..bdee725b6 100644 --- a/AI/VCAI/MapObjectsEvaluator.h +++ b/AI/VCAI/MapObjectsEvaluator.h @@ -20,6 +20,6 @@ public: static MapObjectsEvaluator & getInstance(); boost::optional 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); };