From 2c8b1739e58fda7f5b6bb4b95927e0b50b26d0e1 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 1 May 2012 05:12:38 +0000 Subject: [PATCH] - removed printf's as they slowed down pathfinding --- source/glest_game/ai/path_finder.cpp | 5 +++-- source/glest_game/ai/path_finder.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/glest_game/ai/path_finder.cpp b/source/glest_game/ai/path_finder.cpp index 1845f266..479fcec4 100644 --- a/source/glest_game/ai/path_finder.cpp +++ b/source/glest_game/ai/path_finder.cpp @@ -767,9 +767,10 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout //printf("AStar set maxNodeCount = %d\n",maxNodeCount); } - if(maxNodeCount >= 1 && unit->getPathfindFailedConsecutiveFrameCount() >= 10) { + if(maxNodeCount >= 1 && unit->getPathfindFailedConsecutiveFrameCount() >= 3) { + int orgmaxNodeCount = maxNodeCount; maxNodeCount = 200; - //printf("AStar maxpath cut for unit [%d - %s] to %d\n",unit->getId(),unit->getFullName().c_str(), maxNodeCount); + //printf("AStar maxpath cut for unit [%d - %s] to %d [orig: %d] [unit->getPathfindFailedConsecutiveFrameCount(): %d]\n",unit->getId(),unit->getFullName().c_str(), maxNodeCount,orgmaxNodeCount,unit->getPathfindFailedConsecutiveFrameCount()); } UnitPathInterface *path= unit->getPath(); diff --git a/source/glest_game/ai/path_finder.h b/source/glest_game/ai/path_finder.h index bd9d8fd9..0417cf61 100644 --- a/source/glest_game/ai/path_finder.h +++ b/source/glest_game/ai/path_finder.h @@ -390,7 +390,7 @@ private: //!!! //if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled == true && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld nodeLimitReached = %d whileLoopCount = %d nodePoolCount = %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis(),nodeLimitReached,whileLoopCount,factionState.nodePoolCount); if(chrono.getMillis() > 1) { - printf("AStar for unit [%d - %s] took msecs: %lld nodeLimitReached = %d whileLoopCount = %d nodePoolCount = %d curFrameIndex = %d travel distance = %f\n",unit->getId(),unit->getFullName().c_str(), (long long int)chrono.getMillis(),nodeLimitReached,whileLoopCount,factionState.nodePoolCount,curFrameIndex,unit->getPos().dist(finalPos)); + //printf("AStar for unit [%d - %s] took msecs: %lld nodeLimitReached = %d whileLoopCount = %d nodePoolCount = %d curFrameIndex = %d travel distance = %f\n",unit->getId(),unit->getFullName().c_str(), (long long int)chrono.getMillis(),nodeLimitReached,whileLoopCount,factionState.nodePoolCount,curFrameIndex,unit->getPos().dist(finalPos)); } }