mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-01 23:12:49 +02:00
NKAI: namespace
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
#include "../Engine/Nullkiller.h"
|
||||
#include "lib/mapping/CMap.h" //for victory conditions
|
||||
|
||||
namespace NKAI
|
||||
{
|
||||
|
||||
void ObjectCluster::addObject(const CGObjectInstance * obj, const AIPath & path, float priority)
|
||||
{
|
||||
ClusterObjects::accessor info;
|
||||
@@ -228,7 +231,7 @@ void ObjectClusterizer::clusterize()
|
||||
if(!shouldVisitObject(obj))
|
||||
return;
|
||||
|
||||
#if AI_TRACE_LEVEL >= 2
|
||||
#if NKAI_TRACE_LEVEL >= 2
|
||||
logAi->trace("Check object %s%s.", obj->getObjectName(), obj->visitablePos().toString());
|
||||
#endif
|
||||
|
||||
@@ -236,7 +239,7 @@ void ObjectClusterizer::clusterize()
|
||||
|
||||
if(paths.empty())
|
||||
{
|
||||
#if AI_TRACE_LEVEL >= 2
|
||||
#if NKAI_TRACE_LEVEL >= 2
|
||||
logAi->trace("No paths found.");
|
||||
#endif
|
||||
continue;
|
||||
@@ -251,7 +254,7 @@ void ObjectClusterizer::clusterize()
|
||||
{
|
||||
farObjects.addObject(obj, paths.front(), 0);
|
||||
|
||||
#if AI_TRACE_LEVEL >= 2
|
||||
#if NKAI_TRACE_LEVEL >= 2
|
||||
logAi->trace("Object ignored. Moved to far objects with path %s", paths.front().toString());
|
||||
#endif
|
||||
|
||||
@@ -262,13 +265,13 @@ void ObjectClusterizer::clusterize()
|
||||
|
||||
for(auto & path : paths)
|
||||
{
|
||||
#if AI_TRACE_LEVEL >= 2
|
||||
#if NKAI_TRACE_LEVEL >= 2
|
||||
logAi->trace("Checking path %s", path.toString());
|
||||
#endif
|
||||
|
||||
if(!shouldVisit(ai, path.targetHero, obj))
|
||||
{
|
||||
#if AI_TRACE_LEVEL >= 2
|
||||
#if NKAI_TRACE_LEVEL >= 2
|
||||
logAi->trace("Hero %s does not need to visit %s", path.targetHero->name, obj->getObjectName());
|
||||
#endif
|
||||
continue;
|
||||
@@ -282,7 +285,7 @@ void ObjectClusterizer::clusterize()
|
||||
{
|
||||
if(vstd::contains(heroesProcessed, path.targetHero))
|
||||
{
|
||||
#if AI_TRACE_LEVEL >= 2
|
||||
#if NKAI_TRACE_LEVEL >= 2
|
||||
logAi->trace("Hero %s is already processed.", path.targetHero->name);
|
||||
#endif
|
||||
continue;
|
||||
@@ -302,7 +305,7 @@ void ObjectClusterizer::clusterize()
|
||||
|
||||
cluster->second->addObject(obj, path, priority);
|
||||
|
||||
#if AI_TRACE_LEVEL >= 2
|
||||
#if NKAI_TRACE_LEVEL >= 2
|
||||
logAi->trace("Path added to cluster %s%s", blocker->getObjectName(), blocker->visitablePos().toString());
|
||||
#endif
|
||||
continue;
|
||||
@@ -327,7 +330,7 @@ void ObjectClusterizer::clusterize()
|
||||
farObjects.addObject(obj, path, priority);
|
||||
}
|
||||
|
||||
#if AI_TRACE_LEVEL >= 2
|
||||
#if NKAI_TRACE_LEVEL >= 2
|
||||
logAi->trace("Path %s added to %s objects. Turn: %d, priority: %f",
|
||||
path.toString(),
|
||||
interestingObject ? "near" : "far",
|
||||
@@ -345,7 +348,7 @@ void ObjectClusterizer::clusterize()
|
||||
{
|
||||
logAi->trace("Cluster %s %s count: %i", pair.first->getObjectName(), pair.first->visitablePos().toString(), pair.second->objects.size());
|
||||
|
||||
#if AI_TRACE_LEVEL >= 1
|
||||
#if NKAI_TRACE_LEVEL >= 1
|
||||
for(auto obj : pair.second->getObjects())
|
||||
{
|
||||
logAi->trace("Object %s %s", obj->getObjectName(), obj->visitablePos().toString());
|
||||
@@ -355,3 +358,5 @@ void ObjectClusterizer::clusterize()
|
||||
|
||||
logAi->trace("Clusterization complete in %ld", timeElapsed(start));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user