]> git.mxchange.org Git - flightgear.git/commitdiff
always make some property string values upper case
authormfranz <mfranz>
Fri, 10 Mar 2006 11:46:03 +0000 (11:46 +0000)
committermfranz <mfranz>
Fri, 10 Mar 2006 11:46:03 +0000 (11:46 +0000)
src/Main/fg_props.hxx
src/Main/main.cxx

index a6faf0b1e5d422918ecc53bfda772b487531739a..b20f102922b88488d2383351e3f9c8b1c2665750 100644 (file)
@@ -532,5 +532,18 @@ fgTie (const char * name, T * obj, int index,
 }
 
 
+class FGMakeUpperCase : public SGPropertyChangeListener {
+public:
+    void valueChanged(SGPropertyNode *node) {
+        if (node->getType() != SGPropertyNode::STRING)
+            return;
+
+        char *s = (char *)node->getStringValue();
+        for (; *s; s++)
+            *s = toupper(*s);
+    }
+};
+
+
 #endif // __FG_PROPS_HXX
 
index ff0318ea470836914999eff392312238884b8dc4..9a22c48a91eae9c799658f46220396982cd26eb2 100644 (file)
@@ -912,6 +912,23 @@ static void fgIdleFunction ( void ) {
 }
 
 
+static void upper_case_property(const char *name)
+{
+    SGPropertyNode *p = fgGetNode(name, false);
+    if (!p) {
+        p = fgGetNode(name, true);
+        p->setStringValue("");
+    } else {
+        SGPropertyNode::Type t = p->getType();
+        if (t == SGPropertyNode::NONE || t == SGPropertyNode::UNSPECIFIED)
+            p->setStringValue("");
+        else
+            assert(t == SGPropertyNode::STRING);
+    }
+    p->addChangeListener(new FGMakeUpperCase);
+}
+
+
 // Main top level initialization
 bool fgMainInit( int argc, char **argv ) {
 
@@ -948,6 +965,10 @@ bool fgMainInit( int argc, char **argv ) {
     string_list *col = new string_list;
     globals->set_channel_options_list( col );
 
+    upper_case_property("/sim/presets/airport-id");
+    upper_case_property("/sim/presets/runway");
+    upper_case_property("/sim/tower/airport-id");
+
     // Scan the config file(s) and command line options to see if
     // fg_root was specified (ignore all other options for now)
     fgInitFGRoot(argc, argv);