@@ -2618,33 +2618,25 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye
26182618 Int collapsedZones[maxZones];
26192619 collapsedZones[0 ] = 0 ;
26202620
2621- i = 1 ;
2622- while ( i < totalZones ) {
2621+ for (i=1 ; i<totalZones; i++) {
26232622 Int zone = zoneEquivalency[ i ];
26242623 if (zone == i) {
26252624 collapsedZones[ i ] = m_maxZone;
26262625 ++m_maxZone;
26272626 }
26282627 else
26292628 collapsedZones[ i ] = collapsedZones[zone];
2630-
2631- ++i;
26322629 }
26332630
26342631 // Now map the zones in the map back into the collapsed zones.
2635- j=globalBounds.lo .y ;
2636- while ( j<=globalBounds.hi .y ) {
2637- i=globalBounds.lo .x ;
2638- while ( i<=globalBounds.hi .x ) {
2632+ for ( j=globalBounds.lo .y ; j<=globalBounds.hi .y ; j++ ) {
2633+ for ( i=globalBounds.lo .x ; i<=globalBounds.hi .x ; i++ ) {
26392634 PathfindCell &cell = map[i][j];
26402635 cell.setZone (collapsedZones[cell.getZone ()]);
2641- ++i;
26422636 }
2643- ++j;
26442637 }
2645-
2646- i = 0 ;
2647- while ( i <= LAYER_LAST ) {
2638+
2639+ for (i=0 ; i<=LAYER_LAST ; i++) {
26482640 PathfindLayer &r_thisLayer = layers[i];
26492641
26502642 Int zone = collapsedZones[r_thisLayer.getZone ()];
@@ -2663,8 +2655,6 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye
26632655 r_thisLayer.getEndCellIndex (&ndx);
26642656 setBridge (ndx.x , ndx.y , true );
26652657 }
2666-
2667- ++i;
26682658 }
26692659
26702660 allocateZones ();
@@ -2687,17 +2677,19 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye
26872677 }
26882678 }
26892679
2690- i = 0 ;
2691- while ( i < m_zonesAllocated ) {
2692- m_groundCliffZones[i] = m_groundWaterZones[i] = m_groundRubbleZones[i] = m_terrainZones[i] = m_crusherZones[i] = m_hierarchicalZones[i] = i;
2693- i++;
2680+ // Determine water/ground equivalent zones, and ground/cliff equivalent zones.
2681+ for (i=0 ; i<m_zonesAllocated; i++) {
2682+ m_groundCliffZones[i] = i;
2683+ m_groundWaterZones[i] = i;
2684+ m_groundRubbleZones[i] = i;
2685+ m_terrainZones[i] = i;
2686+ m_crusherZones[i] = i;
2687+ m_hierarchicalZones[i] = i;
26942688 }
26952689
26962690 REGISTER UnsignedInt maxZone = m_maxZone;
2697- j=globalBounds.lo .y ;
2698- while ( j <= globalBounds.hi .y ) {
2699- i=globalBounds.lo .x ;
2700- while ( i <= globalBounds.hi .x ) {
2691+ for ( j=globalBounds.lo .y ; j<=globalBounds.hi .y ; j++ ) {
2692+ for ( i=globalBounds.lo .x ; i<=globalBounds.hi .x ; i++ ) {
27012693 PathfindCell &r_thisCell = map[i][j];
27022694
27032695 if ( (r_thisCell.getConnectLayer () > LAYER_GROUND ) &&
@@ -2766,22 +2758,13 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye
27662758
27672759 }
27682760
2769- ++i;
27702761 }
2771-
2772- ++j;
27732762 }
27742763
27752764 // FLATTEN HIERARCHICAL ZONES
2776- {
2777- i = 1 ;
2778- REGISTER Int zone;
2779- while ( i < maxZone ) {
2780- // Flatten hierarchical zones.
2781- zone = m_hierarchicalZones[i];
2782- m_hierarchicalZones[i] = m_hierarchicalZones[ zone ];
2783- ++i;
2784- }
2765+ for (i=1 ; i<m_maxZone; i++) {
2766+ Int zone = m_hierarchicalZones[i];
2767+ m_hierarchicalZones[i] = m_hierarchicalZones[zone];
27852768 }
27862769
27872770 // THIS BLOCK IS 20%
0 commit comments