mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +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)
|
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);
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,7 @@ std::vector<CGPathNode *> AINodeStorage::calculateNeighbours(
|
|||||||
const CPathfinderHelper * pathfinderHelper)
|
const CPathfinderHelper * pathfinderHelper)
|
||||||
{
|
{
|
||||||
std::vector<CGPathNode *> neighbours;
|
std::vector<CGPathNode *> neighbours;
|
||||||
|
neighbours.reserve(16);
|
||||||
const AIPathNode * srcNode = getAINode(source.node);
|
const AIPathNode * srcNode = getAINode(source.node);
|
||||||
auto accessibleNeighbourTiles = pathfinderHelper->getNeighbourTiles(source);
|
auto accessibleNeighbourTiles = pathfinderHelper->getNeighbourTiles(source);
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ std::vector<CGPathNode *> NodeStorage::calculateNeighbours(
|
|||||||
const CPathfinderHelper * pathfinderHelper)
|
const CPathfinderHelper * pathfinderHelper)
|
||||||
{
|
{
|
||||||
std::vector<CGPathNode *> neighbours;
|
std::vector<CGPathNode *> neighbours;
|
||||||
|
neighbours.reserve(16);
|
||||||
auto accessibleNeighbourTiles = pathfinderHelper->getNeighbourTiles(source);
|
auto accessibleNeighbourTiles = pathfinderHelper->getNeighbourTiles(source);
|
||||||
|
|
||||||
for(auto & neighbour : accessibleNeighbourTiles)
|
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> CPathfinderHelper::getNeighbourTiles(const PathNodeInfo & source) const
|
||||||
{
|
{
|
||||||
std::vector<int3> neighbourTiles;
|
std::vector<int3> neighbourTiles;
|
||||||
|
neighbourTiles.reserve(16);
|
||||||
|
|
||||||
getNeighbours(
|
getNeighbours(
|
||||||
*source.tile,
|
*source.tile,
|
||||||
|
Reference in New Issue
Block a user