Skip to content

Commit ea390c4

Browse files
Maullerxezon
authored andcommitted
chore(pathfinder): Remove register variable and use member variable directly in PathfindZoneManager::calculateZones() (TheSuperHackers#2360)
1 parent 08def43 commit ea390c4

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,42 +2687,41 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye
26872687
m_hierarchicalZones[i] = i;
26882688
}
26892689

2690-
REGISTER UnsignedInt maxZone = m_maxZone;
26912690
for( j=globalBounds.lo.y; j<=globalBounds.hi.y; j++ ) {
26922691
for( i=globalBounds.lo.x; i<=globalBounds.hi.x; i++ ) {
26932692
PathfindCell &r_thisCell = map[i][j];
26942693

26952694
if ( (r_thisCell.getConnectLayer() > LAYER_GROUND) &&
26962695
(r_thisCell.getType() == PathfindCell::CELL_CLEAR) ) {
26972696
PathfindLayer *layer = layers + r_thisCell.getConnectLayer();
2698-
resolveZones(r_thisCell.getZone(), layer->getZone(), m_hierarchicalZones, maxZone);
2697+
resolveZones(r_thisCell.getZone(), layer->getZone(), m_hierarchicalZones, m_maxZone);
26992698
}
27002699

27012700
if ( i > globalBounds.lo.x && r_thisCell.getZone() != map[i-1][j].getZone() ) {
27022701
const PathfindCell &r_leftCell = map[i-1][j];
27032702

27042703
if (r_thisCell.getType() == r_leftCell.getType())
2705-
applyZone(r_thisCell, r_leftCell, m_hierarchicalZones, maxZone);//if this is true, skip all the ones below
2704+
applyZone(r_thisCell, r_leftCell, m_hierarchicalZones, m_maxZone);//if this is true, skip all the ones below
27062705
else {
27072706
Bool notTerrainOrCrusher = TRUE; // if this is false, skip the if-else-ladder below
27082707

27092708
if (terrain(r_thisCell, r_leftCell)) {
2710-
applyZone(r_thisCell, r_leftCell, m_terrainZones, maxZone);
2709+
applyZone(r_thisCell, r_leftCell, m_terrainZones, m_maxZone);
27112710
notTerrainOrCrusher = FALSE;
27122711
}
27132712

27142713
if (crusherGround(r_thisCell, r_leftCell)) {
2715-
applyZone(r_thisCell, r_leftCell, m_crusherZones, maxZone);
2714+
applyZone(r_thisCell, r_leftCell, m_crusherZones, m_maxZone);
27162715
notTerrainOrCrusher = FALSE;
27172716
}
27182717

27192718
if ( notTerrainOrCrusher ) {
27202719
if (waterGround(r_thisCell, r_leftCell))
2721-
applyZone(r_thisCell, r_leftCell, m_groundWaterZones, maxZone);
2720+
applyZone(r_thisCell, r_leftCell, m_groundWaterZones, m_maxZone);
27222721
else if (groundRubble(r_thisCell, r_leftCell))
2723-
applyZone(r_thisCell, r_leftCell, m_groundRubbleZones, maxZone);
2722+
applyZone(r_thisCell, r_leftCell, m_groundRubbleZones, m_maxZone);
27242723
else if (groundCliff(r_thisCell, r_leftCell))
2725-
applyZone(r_thisCell, r_leftCell, m_groundCliffZones, maxZone);
2724+
applyZone(r_thisCell, r_leftCell, m_groundCliffZones, m_maxZone);
27262725
}
27272726

27282727
}
@@ -2733,26 +2732,26 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye
27332732
const PathfindCell &r_topCell = map[i][j-1];
27342733

27352734
if (r_thisCell.getType() == r_topCell.getType())
2736-
applyZone(r_thisCell, r_topCell, m_hierarchicalZones, maxZone);
2735+
applyZone(r_thisCell, r_topCell, m_hierarchicalZones, m_maxZone);
27372736
else {
27382737
Bool notTerrainOrCrusher = TRUE; // if this is false, skip the if-else-ladder below
27392738

27402739
if (terrain(r_thisCell, r_topCell)) {
2741-
applyZone(r_thisCell, r_topCell, m_terrainZones, maxZone);
2740+
applyZone(r_thisCell, r_topCell, m_terrainZones, m_maxZone);
27422741
notTerrainOrCrusher = FALSE;
27432742
}
27442743

27452744
if (crusherGround(r_thisCell, r_topCell)) {
2746-
applyZone(r_thisCell, r_topCell, m_crusherZones, maxZone);
2745+
applyZone(r_thisCell, r_topCell, m_crusherZones, m_maxZone);
27472746
notTerrainOrCrusher = FALSE;
27482747
}
27492748

27502749
if (waterGround(r_thisCell,r_topCell))
2751-
applyZone(r_thisCell, r_topCell, m_groundWaterZones, maxZone);
2750+
applyZone(r_thisCell, r_topCell, m_groundWaterZones, m_maxZone);
27522751
else if (groundRubble(r_thisCell, r_topCell))
2753-
applyZone(r_thisCell, r_topCell, m_groundRubbleZones, maxZone);
2752+
applyZone(r_thisCell, r_topCell, m_groundRubbleZones, m_maxZone);
27542753
else if (groundCliff(r_thisCell,r_topCell))
2755-
applyZone(r_thisCell, r_topCell, m_groundCliffZones, maxZone);
2754+
applyZone(r_thisCell, r_topCell, m_groundCliffZones, m_maxZone);
27562755

27572756
}
27582757

0 commit comments

Comments
 (0)