1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Minor tweaks/fixes

This commit is contained in:
Dydzio 2018-07-29 19:31:01 +02:00
parent f906d98fe5
commit 393b25eb7f
4 changed files with 7 additions and 7 deletions

View File

@ -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
{

View File

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

View File

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

View File

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