X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FATCDCL%2Fcommlist.cxx;h=ef5c8d7b8097dc87475ee1db282c9e46c3d1627c;hb=70a525d47c6a8d486e9ba71eeaad883f2dbf5a54;hp=baed76f373bea946e0e8d81858a2699dcf3dcd1a;hpb=0cdb9d4efb249dd85b7e56d1885d8183de231373;p=flightgear.git diff --git a/src/ATCDCL/commlist.cxx b/src/ATCDCL/commlist.cxx index baed76f37..ef5c8d7b8 100644 --- a/src/ATCDCL/commlist.cxx +++ b/src/ATCDCL/commlist.cxx @@ -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;