Dydzio 7 年之前
父節點
當前提交
1a78ea15bb
共有 2 個文件被更改,包括 4 次插入6 次删除
  1. 3 5
      AI/VCAI/MapObjectsEvaluator.cpp
  2. 1 1
      AI/VCAI/MapObjectsEvaluator.h

+ 3 - 5
AI/VCAI/MapObjectsEvaluator.cpp

@@ -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);

+ 1 - 1
AI/VCAI/MapObjectsEvaluator.h

@@ -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);
 };