AlexVinS 6 năm trước cách đây
mục cha
commit
f0492ffa53

+ 1 - 1
AI/VCAI/Pathfinding/AIPathfinder.h

@@ -23,11 +23,11 @@ private:
 	CPlayerSpecificInfoCallback * cb;
 	VCAI * ai;
 
+	std::shared_ptr<AINodeStorage> getOrCreateStorage(HeroPtr hero);
 public:
 	AIPathfinder(CPlayerSpecificInfoCallback * cb, VCAI * ai);
 	std::vector<AIPath> getPathInfo(HeroPtr hero, int3 tile);
 	bool isTileAccessible(HeroPtr hero, int3 tile);
-	std::shared_ptr<AINodeStorage> getOrCreateStorage(HeroPtr hero);
 	void clear();
 	void init();
 };

+ 4 - 2
AI/VCAI/Pathfinding/PathfindingManager.cpp

@@ -37,6 +37,7 @@ Goals::TGoalVec PathfindingManager::howToVisitTile(int3 tile)
 	Goals::TGoalVec result;
 
 	auto heroes = cb->getHeroesInfo();
+	result.reserve(heroes.size());
 
 	for(auto hero : heroes)
 	{
@@ -51,6 +52,7 @@ Goals::TGoalVec PathfindingManager::howToVisitObj(ObjectIdRef obj)
 	Goals::TGoalVec result;
 
 	auto heroes = cb->getHeroesInfo();
+	result.reserve(heroes.size());
 
 	for(auto hero : heroes)
 	{
@@ -154,7 +156,7 @@ Goals::TGoalVec PathfindingManager::findPath(
 
 				if(solution->evaluationContext.danger < danger)
 					solution->evaluationContext.danger = danger;
-				
+
 				solution->evaluationContext.movementCost += path.movementCost();
 
 				logAi->trace("It's safe for %s to visit tile %s with danger %s, goal %s", hero->name, dest.toString(), std::to_string(danger), solution->name());
@@ -219,7 +221,7 @@ Goals::TSubgoal PathfindingManager::clearWayTo(HeroPtr hero, int3 firstTileToGet
 			}
 
 			auto questObj = dynamic_cast<const IQuestObject*>(topObj);
-			
+
 			if(questObj)
 			{
 				auto questInfo = QuestInfo(questObj->quest, topObj, topObj->visitablePos());