Skip to content

Commit ab2c835

Browse files
Maullerxezon
authored andcommitted
refactor(pathfinder): Extract functionality Pathfinder::checkCellOutsideExtents (#1619)
1 parent 824e3f8 commit ab2c835

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,8 @@ class Pathfinder : PathfindServicesInterface, public Snapshot
825825

826826
void checkChangeLayers(PathfindCell *parentCell);
827827

828+
bool checkCellOutsideExtents(ICoord2D& cell);
829+
828830
#if defined(RTS_DEBUG)
829831
void doDebugIcons(void) ;
830832
#endif

Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5362,6 +5362,13 @@ void Pathfinder::checkChangeLayers(PathfindCell *parentCell)
53625362
m_openList = newCell->putOnSortedOpenList( m_openList );
53635363
}
53645364

5365+
bool Pathfinder::checkCellOutsideExtents(ICoord2D& cell) {
5366+
return cell.x < m_logicalExtent.lo.x ||
5367+
cell.x > m_logicalExtent.hi.x ||
5368+
cell.y < m_logicalExtent.lo.y ||
5369+
cell.y > m_logicalExtent.hi.y;
5370+
}
5371+
53655372

53665373
struct ExamineCellsStruct
53675374
{

GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,8 @@ class Pathfinder : PathfindServicesInterface, public Snapshot
833833

834834
void checkChangeLayers(PathfindCell *parentCell);
835835

836+
bool checkCellOutsideExtents(ICoord2D& cell);
837+
836838
#if defined(RTS_DEBUG)
837839
void doDebugIcons(void) ;
838840
#endif

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5662,6 +5662,13 @@ void Pathfinder::checkChangeLayers(PathfindCell *parentCell)
56625662
m_openList = newCell->putOnSortedOpenList( m_openList );
56635663
}
56645664

5665+
bool Pathfinder::checkCellOutsideExtents(ICoord2D& cell) {
5666+
return cell.x < m_logicalExtent.lo.x ||
5667+
cell.x > m_logicalExtent.hi.x ||
5668+
cell.y < m_logicalExtent.lo.y ||
5669+
cell.y > m_logicalExtent.hi.y;
5670+
}
5671+
56655672

56665673
struct ExamineCellsStruct
56675674
{

0 commit comments

Comments
 (0)