mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Optimizations based on MSVS profiler.
This commit is contained in:
		| @@ -47,12 +47,12 @@ Goals::TSubgoal FuzzyHelper::chooseSolution(Goals::TGoalVec vec) | ||||
|  | ||||
| 	for(auto goal : vec) | ||||
| 	{ | ||||
| 		logAi->debug("FuzzyHelper evaluated goal %s, priority=%i", goal->name(), goal->priority); | ||||
| 		logAi->trace("FuzzyHelper evaluated goal %s, priority=%.4f", goal->name(), goal->priority); | ||||
| 	} | ||||
|  | ||||
| 	Goals::TSubgoal result = *boost::max_element(vec, compareGoals); | ||||
|  | ||||
| 	logAi->debug("FuzzyHelper returned goal %s, priority=%i", result->name(), result->priority); | ||||
| 	logAi->debug("FuzzyHelper returned goal %s, priority=%.4f", result->name(), result->priority); | ||||
|  | ||||
| 	return result; | ||||
| } | ||||
|   | ||||
| @@ -106,6 +106,7 @@ std::vector<CGPathNode *> AINodeStorage::calculateNeighbours( | ||||
| 	const CPathfinderHelper * pathfinderHelper) | ||||
| { | ||||
| 	std::vector<CGPathNode *> neighbours; | ||||
| 	neighbours.reserve(16); | ||||
| 	const AIPathNode * srcNode = getAINode(source.node); | ||||
| 	auto accessibleNeighbourTiles = pathfinderHelper->getNeighbourTiles(source); | ||||
|  | ||||
|   | ||||
| @@ -31,6 +31,7 @@ std::vector<CGPathNode *> NodeStorage::calculateNeighbours( | ||||
| 	const CPathfinderHelper * pathfinderHelper) | ||||
| { | ||||
| 	std::vector<CGPathNode *> neighbours; | ||||
| 	neighbours.reserve(16); | ||||
| 	auto accessibleNeighbourTiles = pathfinderHelper->getNeighbourTiles(source); | ||||
|  | ||||
| 	for(auto & neighbour : accessibleNeighbourTiles) | ||||
| @@ -70,6 +71,7 @@ std::vector<CGPathNode *> NodeStorage::calculateTeleportations( | ||||
| std::vector<int3> CPathfinderHelper::getNeighbourTiles(const PathNodeInfo & source) const | ||||
| { | ||||
| 	std::vector<int3> neighbourTiles; | ||||
| 	neighbourTiles.reserve(16); | ||||
|  | ||||
| 	getNeighbours( | ||||
| 		*source.tile, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user