From 1347ca930f4e936d8645e3a78f60ae3449f81b40 Mon Sep 17 00:00:00 2001 From: daveluff Date: Mon, 15 Mar 2004 11:14:03 +0000 Subject: [PATCH] Work around for the AI-traffic due to precision issues generated by the radio frequency dialog --- src/ATC/AIPlane.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ATC/AIPlane.cxx b/src/ATC/AIPlane.cxx index 867bdcd05..1faef8678 100644 --- a/src/ATC/AIPlane.cxx +++ b/src/ATC/AIPlane.cxx @@ -92,7 +92,12 @@ void FGAIPlane::Update(double dt) { _max_count = 5.0; // FIXME - hardwired length of message - need to calculate it! //cout << "Transmission = " << pending_transmission << '\n'; - if(freq == user_freq0 || freq == user_freq1) { + + // The radios dialog seems to set slightly imprecise freqs, eg 118.099998 + // The eplison stuff below is a work-around + double eps0 = fabs(freq - user_freq0); + double eps1 = fabs(freq - user_freq1); + if(eps0 < 0.002 || eps1 < 0.002) { //cout << "Transmitting..." << endl; // we are on the same frequency, so check distance to the user plane if(1) { -- 2.39.5