]> git.mxchange.org Git - flightgear.git/commitdiff
ATIS: evaluate airport abbreviations case-insensitively
authorDave Luff <daveluff@ntlworld.com>
Thu, 30 Dec 2010 16:20:40 +0000 (16:20 +0000)
committerDave Luff <daveluff@ntlworld.com>
Thu, 30 Dec 2010 16:24:43 +0000 (16:24 +0000)
The apt.dat file contains inconsistent case for many airport name abbreviations,
e.g. MUNI/Muni and intl/Intl.  Evaluate the abbreviations in lower-case when
expanding them in order to avoid missing any.

src/ATCDCL/atis.cxx

index 357ff18a2b941598602d92d87e8ca608f803b0a0..9181b3e0121a0799ce8683438fb5ed50f5b2ed06 100644 (file)
@@ -42,6 +42,8 @@
 
 #include <boost/tuple/tuple.hpp>
 #include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/case_conv.hpp>
+
 
 #include <simgear/misc/sg_path.hxx>
 
@@ -256,7 +258,12 @@ int FGATIS::GenTransmission(const int regen, const int special) {
 // make things nicer for the text-to-speech system:
     for (MSS::const_iterator replace = _remap.begin();
           replace != _remap.end(); replace++) {
-      if (word == replace->first) {
+      // Due to inconsistent capitalisation in the apt.dat file, we need
+      // to do a case-insensitive comparison here.
+      string tmp1 = word, tmp2 = replace->first;
+      boost::algorithm::to_lower(tmp1);
+      boost::algorithm::to_lower(tmp2);
+      if (tmp1 == tmp2) {
         word = replace->second;
         break;
       }