]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATCDCL/commlist.cxx
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / ATCDCL / commlist.cxx
index baed76f373bea946e0e8d81858a2699dcf3dcd1a..ef5c8d7b8097dc87475ee1db282c9e46c3d1627c 100644 (file)
@@ -167,17 +167,18 @@ int FGCommList::FindByPos(const SGGeod& aPos, double range, comm_list_type* stat
      SGBucket buck(aPos);
  
      // get neigboring buckets
-     int bx = (int)( range*SG_NM_TO_METER / buck.get_width_m() / 2);
-     int by = (int)( range*SG_NM_TO_METER / buck.get_height_m() / 2 );
+     int bx = (int)( range*SG_NM_TO_METER / buck.get_width_m() / 2) + 1;
+     int by = (int)( range*SG_NM_TO_METER / buck.get_height_m() / 2 ) + 1;
      
      // loop over bucket range 
      for ( int i=-bx; i<=bx; i++) {
          for ( int j=-by; j<=by; j++) {
              buck = sgBucketOffset(aPos.getLongitudeDeg(), aPos.getLatitudeDeg(), i, j);
              long int bucket = buck.gen_index();
-             comm_list_type Fstations = commlist_bck[bucket];
-             comm_list_iterator current = Fstations.begin();
-             comm_list_iterator last = Fstations.end();
+             comm_map_const_iterator Fstations = commlist_bck.find(bucket);
+             if (Fstations == commlist_bck.end()) continue;
+             comm_list_const_iterator current = Fstations->second.begin();
+             comm_list_const_iterator last = Fstations->second.end();
              
              
              // double az1, az2, s;