always make some property string values upper case
This commit is contained in:
parent
dc958d6e8e
commit
1dae811546
2 changed files with 34 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue