diff --git a/src/Main/fg_props.hxx b/src/Main/fg_props.hxx index a6faf0b1e..b20f10292 100644 --- a/src/Main/fg_props.hxx +++ b/src/Main/fg_props.hxx @@ -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 diff --git a/src/Main/main.cxx b/src/Main/main.cxx index ff0318ea4..9a22c48a9 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -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);