| 7 | : self ( &BWAPI::BWAPIClient.data->regions[index] ) |
| 8 | { } |
| 9 | void RegionImpl::setNeighbors() |
| 10 | { |
| 11 | int accessibleBestDist = 99999; |
| 12 | int inaccessibleBestDist = 99999; |
| 13 | for ( int i = 0; i < self->neighborCount; ++i ) |
| 14 | { |
| 15 | BWAPI::Region neighbor = Broodwar->getRegion(self->neighbors[i]); |
| 16 | this->neighbors.insert(neighbor); |
| 17 | |
| 18 | // Obtain the closest accessible and inaccessible Regions from their Region center |
| 19 | int dst = this->getCenter().getApproxDistance(neighbor->getCenter()); |
| 20 | if ( this->getRegionGroupID() == neighbor->getRegionGroupID() ) |
| 21 | { |
| 22 | if ( dst < accessibleBestDist ) |
| 23 | { |
| 24 | accessibleBestDist = dst; |
| 25 | this->closestAccessibleRgn = neighbor; |
| 26 | } |
| 27 | } |
| 28 | else if ( dst < inaccessibleBestDist ) |
| 29 | { |
| 30 | inaccessibleBestDist = dst; |
| 31 | this->closestInaccessibleRgn = neighbor; |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | }; |
no test coverage detected