]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/dclgps.cxx
GPS: improve reliability (at the expense of some in-development features) for pending...
[flightgear.git] / src / Instrumentation / dclgps.cxx
index 35141c9dc4e683d72bca7e92f58ad2cf3229766f..a20189cd973a54f05e4a41ab3ab34cb3accabcab 100644 (file)
@@ -257,9 +257,8 @@ void GPSPage::OBSPressed() {}
 void GPSPage::MsgPressed() {}
 
 string GPSPage::GPSitoa(int n) {
-       char buf[4];
-       // TODO - sanity check n!
-       sprintf(buf, "%i", n);
+       char buf[6];
+       snprintf(buf, 6, "%i", n);
        string s = buf;
        return(s);
 }
@@ -357,9 +356,8 @@ DCLGPS::~DCLGPS() {
        // TODO - may need to delete the approach database!!
 }
 
-void DCLGPS::draw() {
-       //cout << "draw called!\n";
-       _instrument->draw();
+void DCLGPS::draw(osg::State& state) {
+       _instrument->draw(state);
 }
 
 void DCLGPS::init() {
@@ -1029,61 +1027,15 @@ void DCLGPS::CreateFlightPlan(GPSFlightPlan* fp, vector<string> ids, vector<GPSW
                case GPS_WP_USR:
                        // TODO
                        break;
+               case GPS_WP_VIRT:
+                       // TODO
+                       break;
                }
        }
 }
 
 /***************************************/
 
-/**
- * STL functor for use with algorithms. This comapres strings according to
- * the KLN-89's notion of ordering, with digits after letters.
- * Also implements FGIdentOrdering so it can be passed into the various list
- * find helpers.
- */
-class stringOrderKLN89 : public FGIdentOrdering
-{
-public:
-  bool operator()(const gps_waypoint_map::value_type& aA, const std::string& aB) const
-  {
-    return compare(aA.first, aB);
-  }
-  
-  bool operator()(const std::string& aS1, const std::string& aS2) const
-  {
-    return compare(aS1, aS2);
-  }
-  
-  virtual bool compare(const std::string& aS1, const std::string& aS2) const
-  {
-    if (aS1.empty()) return true;
-    if (aS2.empty()) return false;
-    
-    char* a = (char*) aS1.c_str();
-    char* b = (char*) aS2.c_str();
-    
-    for ( ; *a && *b; ++a, ++b) {
-      if (*a == *b) continue;
-      
-      bool aDigit = isdigit(*a);
-      bool bDigit = isdigit(*b);
-      
-      if (aDigit == bDigit) {
-        return (*a < *b); // we already know they're not equal
-      }
-      
-      // digit-ness differs
-      if (aDigit) return false; // s1 = KS9 goes *after* s2 = KSA
-      assert(bDigit);
-      return true; // s1 = KSF, s2 = KS5, s1 is indeed < s2
-    }
-    
-    if (*b) return true; // *a == 0, s2 is longer
-    return false; // s1 is longer, or strings are equal
-  }
-};
-
 class DCLGPSFilter : public FGPositioned::Filter
 {
 public: