浏览代码

Minor tweaks/fixes

Dydzio 7 年之前
父节点
当前提交
393b25eb7f
共有 4 个文件被更改,包括 7 次插入7 次删除
  1. 2 2
      AI/VCAI/Fuzzy.cpp
  2. 2 2
      AI/VCAI/VCAI.cpp
  3. 2 2
      lib/mapObjects/CObjectClassesHandler.h
  4. 1 1
      lib/serializer/CSerializer.h

+ 2 - 2
AI/VCAI/Fuzzy.cpp

@@ -295,9 +295,9 @@ float FuzzyHelper::getWanderTargetObjectValue(const CGHeroInstance & h, const Ob
 	boost::optional<int> objValueKnownByAI = MapObjectsEvaluator::getInstance().getObjectValue(obj->ID, obj->subID);
 	int objValue = 0;
 
-	if(objValueKnownByAI.is_initialized())
+	if(objValueKnownByAI.is_initialized()) //consider adding value manipulation based on object instances on map
 	{
-		objValue = objValueKnownByAI.value();
+		objValue = std::min(std::max(objValueKnownByAI.value(), 0), 20000);
 	}
 	else
 	{

+ 2 - 2
AI/VCAI/VCAI.cpp

@@ -1540,12 +1540,12 @@ void VCAI::wander(HeroPtr h)
 
 		if(dests.size()) //performance improvement
 		{
-			auto fuzzyLogicSorter = [h](const ObjectIdRef & l, const ObjectIdRef & r) -> bool
+			auto fuzzyLogicSorter = [h](const ObjectIdRef & l, const ObjectIdRef & r) -> bool //TODO: create elementar GetObj goal usable for goal decomposition and Wander based on VisitTile logic and object value on top of it
 			{
 				return fh->getWanderTargetObjectValue( *h.get(), l) < fh->getWanderTargetObjectValue(*h.get(), r);
 			};
 
-			const ObjectIdRef & dest = *boost::max_element(dests, fuzzyLogicSorter); //find best object to visit based on fuzzy logic evaluation
+			const ObjectIdRef & dest = *boost::max_element(dests, fuzzyLogicSorter); //find best object to visit based on fuzzy logic evaluation, TODO: use elementar version of GetObj here in future
 
 			//wander should not cause heroes to be reserved - they are always considered free
 			logAi->debug("Of all %d destinations, object oid=%d seems nice", dests.size(), dest.id.getNum());

+ 2 - 2
lib/mapObjects/CObjectClassesHandler.h

@@ -219,7 +219,7 @@ public:
 		{
 			h & sounds;
 		}
-		if(version >= 788)
+		if(version >= 789)
 		{
 			h & aiValue;
 		}
@@ -262,7 +262,7 @@ class DLL_LINKAGE CObjectClassesHandler : public IHandlerBase
 			{
 				h & sounds;
 			}
-			if(version >= 788)
+			if(version >= 789)
 			{
 				h & groupDefaultAiValue;
 			}

+ 1 - 1
lib/serializer/CSerializer.h

@@ -12,7 +12,7 @@
 #include "../ConstTransitivePtr.h"
 #include "../GameConstants.h"
 
-const ui32 SERIALIZATION_VERSION = 788;
+const ui32 SERIALIZATION_VERSION = 789;
 const ui32 MINIMAL_SERIALIZATION_VERSION = 753;
 const std::string SAVEGAME_MAGIC = "VCMISVG";