From 78de2af130f45ada78ecf38eb7f97893f940bed7 Mon Sep 17 00:00:00 2001 From: Richard Senior Date: Thu, 7 Apr 2016 00:58:34 +0100 Subject: [PATCH] Allow ATIS format specifications to compare tokens against text values Prior to this change, it was only possible to compare the values of tokens to each other for use in conditionals, e.g. landing and departing runway. This change allows comparison of a token to a text value, e.g. to compare wind speed to zero. --- src/ATC/ATISEncoder.cxx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/ATC/ATISEncoder.cxx b/src/ATC/ATISEncoder.cxx index dc41d27ed..45675207b 100644 --- a/src/ATC/ATISEncoder.cxx +++ b/src/ATC/ATISEncoder.cxx @@ -295,13 +295,24 @@ bool ATISEncoder::checkEqualsCondition( SGPropertyNode_ptr node, bool isEqual ) { SGPropertyNode_ptr n1 = node->getNode( "token", 0, false ); SGPropertyNode_ptr n2 = node->getNode( "token", 1, false ); - if( false == n1.valid() || false == n2.valid()) { - SG_LOG(SG_ATC, SG_WARN, "missing node for (not)-equals" ); + + if( n1.valid() && n2.valid() ) { + bool comp = processToken( n1 ).compare( processToken( n2 ) ) == 0; + return comp == isEqual; + } + + if( n1.valid() && !n2.valid() ) { + SGPropertyNode_ptr t = node->getNode( "text", 0, false ); + if( t.valid() ) { + bool comp = processToken( n1 ).compare( processTextToken( t ) ) == 0; + return comp == isEqual; + } + SG_LOG(SG_ATC, SG_WARN, "missing or node for (not)-equals"); return false; } - bool comp = processToken( n1 ).compare( processToken( n2 ) ) == 0; - return comp == isEqual; + SG_LOG(SG_ATC, SG_WARN, "missing node for (not)-equals"); + return false; } string ATISEncoder::getAtisId( SGPropertyNode_ptr ) -- 2.39.2