const SGPropertyNode * num_node = axis_node->getChild("number");
size_t n_axis = axis_node->getIndex();
if (num_node != 0) {
- n_axis = num_node->getIntValue(TGT_PLATFORM,n_axis);
+ n_axis = num_node->getIntValue(TGT_PLATFORM, -1);
+
+ // Silently ignore platforms that are not specified within the
+ // <number></number> section
+ if (n_axis < 0)
+ continue;
}
+ if (n_axis >= (size_t)naxes) {
+ SG_LOG(SG_INPUT, SG_DEBUG, "Dropping bindings for axis " << n_axis);
+ continue;
+ }
axis &a = _joystick_bindings[i].axes[n_axis];
js->setDeadBand(n_axis, axis_node->getDoubleValue("dead-band", 0.0));
if (num_node != 0) {
n_but = num_node->getIntValue(TGT_PLATFORM,n_but);
}
+
+ if (n_but >= (size_t)nbuttons) {
+ SG_LOG(SG_INPUT, SG_DEBUG, "Dropping bindings for button " << n_but);
+ continue;
+ }
+
sprintf(buf, "%d", n_but);
SG_LOG(SG_INPUT, SG_DEBUG, "Initializing button " << n_but);
_init_button(button_node,
// cursors defined as textures referenced in the property tree. This
// list could then be eliminated. -Andy
//
-struct {
+static struct {
const char * name;
int cursor;
} mouse_cursor_map[] = {