Browse Source

Remove excessive copies of large objects

Ivan Savenko 1 year ago
parent
commit
1468abb8a0
2 changed files with 2 additions and 2 deletions
  1. 1 1
      AI/Nullkiller/Pathfinding/GraphPaths.cpp
  2. 1 1
      lib/pathfinder/NodeStorage.cpp

+ 1 - 1
AI/Nullkiller/Pathfinding/GraphPaths.cpp

@@ -118,7 +118,7 @@ void GraphPaths::calculatePaths(const CGHeroInstance * targetHero, const Nullkil
 
 
 					targetNode.specialAction = compositeAction;
 					targetNode.specialAction = compositeAction;
 
 
-					auto targetGraphNode = graph.getNode(target);
+					const auto & targetGraphNode = graph.getNode(target);
 
 
 					if(targetGraphNode.objID.hasValue())
 					if(targetGraphNode.objID.hasValue())
 					{
 					{

+ 1 - 1
lib/pathfinder/NodeStorage.cpp

@@ -40,7 +40,7 @@ void NodeStorage::initialize(const PathfinderOptions & options, const CGameState
 		{
 		{
 			for(pos.y=0; pos.y < sizes.y; ++pos.y)
 			for(pos.y=0; pos.y < sizes.y; ++pos.y)
 			{
 			{
-				const TerrainTile tile = gs->map->getTile(pos);
+				const TerrainTile & tile = gs->map->getTile(pos);
 				if(tile.terType->isWater())
 				if(tile.terType->isWater())
 				{
 				{
 					resetTile(pos, ELayer::SAIL, PathfinderUtil::evaluateAccessibility<ELayer::SAIL>(pos, tile, fow, player, gs));
 					resetTile(pos, ELayer::SAIL, PathfinderUtil::evaluateAccessibility<ELayer::SAIL>(pos, tile, fow, player, gs));