diff --git a/src/ATCDCL/ATCDialog.cxx b/src/ATCDCL/ATCDialog.cxx index f094b1170..f5f5ec935 100644 --- a/src/ATCDCL/ATCDialog.cxx +++ b/src/ATCDCL/ATCDialog.cxx @@ -382,7 +382,6 @@ void FGATCDialog::FreqDisplay(string& ident) { comm_list_type stations; int found = current_commlist->FindByPos(a->geod(), 20.0, &stations); if(found) { - ostringstream ostr; comm_list_iterator itr = stations.begin(); for (n = 0; itr != stations.end(); ++itr) { if(itr->ident != ident) @@ -396,8 +395,9 @@ void FGATCDialog::FreqDisplay(string& ident) { copyProperties(freq_group->getNode("group-template", true), entry); entry->removeChildren("enabled", true); + ostringstream ostr; ostr << itr->type; - entry->setStringValue("text[0]/label", ostr.str().c_str()); + entry->setStringValue("text[0]/label", ostr.str()); char buf[8]; snprintf(buf, 8, "%.2f", (itr->freq / 100.0)); // Convert from KHz to MHz @@ -406,8 +406,6 @@ void FGATCDialog::FreqDisplay(string& ident) { buf[7] = '\0'; entry->setStringValue("text[1]/label", buf); - - ostr.seekp(0); n++; } } 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; diff --git a/src/Instrumentation/heading_indicator_fg.cxx b/src/Instrumentation/heading_indicator_fg.cxx index 23d49da74..960bd98ab 100644 --- a/src/Instrumentation/heading_indicator_fg.cxx +++ b/src/Instrumentation/heading_indicator_fg.cxx @@ -117,7 +117,7 @@ HeadingIndicatorFG::update (double dt) // Next, calculate the indicated heading, // introducing errors. - double factor = 0.1 / (spin * spin * spin * spin * spin * spin); + double factor = 100 * (spin * spin * spin * spin * spin * spin); double heading = _heading_in_node->getDoubleValue(); // Now, we have to get the current @@ -128,7 +128,7 @@ HeadingIndicatorFG::update (double dt) if ((heading - _last_heading_deg) < -180) _last_heading_deg -= 360; - heading = fgGetLowPass(_last_heading_deg, heading, dt / factor); + heading = fgGetLowPass(_last_heading_deg, heading, dt * factor); _last_heading_deg = heading; heading += offset;