1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Optimizations based on MSVS profiler.

This commit is contained in:
DJWarmonger 2018-12-16 15:46:48 +01:00
parent 34cc5dbec1
commit f4a8a1294e
3 changed files with 5 additions and 2 deletions

View File

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

View File

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

View File

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