From 4a1eadbf35e1d2ec46adf7abb78c82f52cc38aa4 Mon Sep 17 00:00:00 2001 From: mfranz Date: Sat, 11 Jun 2005 15:26:32 +0000 Subject: [PATCH] throw an exception if not even a default joystick could be found; This can only happen if $FG_ROOT is corrupted or some developer has broken the default js config. Better not keep that under the rug. --- src/Input/input.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Input/input.cxx b/src/Input/input.cxx index dcbb376f9..4ff9c9890 100644 --- a/src/Input/input.cxx +++ b/src/Input/input.cxx @@ -438,7 +438,7 @@ FGInput::_init_joystick () int js_named_index = 1000; _scan_joystick_dir(&path, js_nodes, &js_named_index); - // build name->node map for each (reverse order) + // build name->node map with each (reverse order) map jsmap; vector js_named = js_nodes->getChildren("js-named"); @@ -469,20 +469,16 @@ FGInput::_init_joystick () SGPropertyNode_ptr named; if ((named = jsmap[name])) { - string source = named->getStringValue("source", ""); - if (source.empty()) - SG_LOG(SG_INPUT, SG_INFO, "... found joystick (user defined)"); - else - SG_LOG(SG_INPUT, SG_INFO, "... found joystick: \"" << source << '"'); + string source = named->getStringValue("source", "user defined"); + SG_LOG(SG_INPUT, SG_INFO, "... found joystick: \"" << source << '"'); } else if ((named = jsmap["default"])) { - string source = named->getStringValue("source", ""); + string source = named->getStringValue("source", "user defined"); SG_LOG(SG_INPUT, SG_INFO, "No config found for joystick \"" << name << "\"\nUsing default: \"" << source << '"'); } else { - SG_LOG(SG_INPUT, SG_ALERT, "No default joystick found! (default)"); - continue; + throw sg_throwable(string("No default joystick found! (default)")); } js_node = js_nodes->getChild("js", i, true);