Browse Source

improve iterating over EPathfindingLayer

Andrey Filipenkov 2 years ago
parent
commit
3602645a30

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

@@ -285,7 +285,7 @@ std::vector<CGPathNode *> AINodeStorage::calculateNeighbours(
 
 
 	for(auto & neighbour : accessibleNeighbourTiles)
 	for(auto & neighbour : accessibleNeighbourTiles)
 	{
 	{
-		for(EPathfindingLayer i = EPathfindingLayer::LAND; i <= EPathfindingLayer::AIR; i.advance(1))
+		for(EPathfindingLayer i = EPathfindingLayer::LAND; i < EPathfindingLayer::NUM_LAYERS; i.advance(1))
 		{
 		{
 			auto nextNode = getOrCreateNode(neighbour, i, srcNode->actor);
 			auto nextNode = getOrCreateNode(neighbour, i, srcNode->actor);
 
 

+ 1 - 1
AI/VCAI/Pathfinding/AINodeStorage.cpp

@@ -167,7 +167,7 @@ std::vector<CGPathNode *> AINodeStorage::calculateNeighbours(
 
 
 	for(auto & neighbour : accessibleNeighbourTiles)
 	for(auto & neighbour : accessibleNeighbourTiles)
 	{
 	{
-		for(EPathfindingLayer i = EPathfindingLayer::LAND; i <= EPathfindingLayer::AIR; i.advance(1))
+		for(EPathfindingLayer i = EPathfindingLayer::LAND; i < EPathfindingLayer::NUM_LAYERS; i.advance(1))
 		{
 		{
 			auto nextNode = getOrCreateNode(neighbour, i, srcNode->chainMask);
 			auto nextNode = getOrCreateNode(neighbour, i, srcNode->chainMask);
 
 

+ 1 - 1
lib/CPathfinder.cpp

@@ -78,7 +78,7 @@ std::vector<CGPathNode *> NodeStorage::calculateNeighbours(
 
 
 	for(auto & neighbour : accessibleNeighbourTiles)
 	for(auto & neighbour : accessibleNeighbourTiles)
 	{
 	{
-		for(EPathfindingLayer i = EPathfindingLayer::LAND; i <= EPathfindingLayer::AIR; i.advance(1))
+		for(EPathfindingLayer i = EPathfindingLayer::LAND; i < EPathfindingLayer::NUM_LAYERS; i.advance(1))
 		{
 		{
 			auto * node = getNode(neighbour, i);
 			auto * node = getNode(neighbour, i);