1
0
Fork 0

CLear the key bindings before assigning new ones

This commit is contained in:
ehofman 2003-09-25 12:07:42 +00:00
parent f9b85dc2fd
commit 52ebc9ae4b

View file

@ -415,7 +415,6 @@ FGInput::doMouseMotion (int x, int y)
void void
FGInput::_init_keyboard () FGInput::_init_keyboard ()
{ {
// TODO: zero the old bindings first.
SG_LOG(SG_INPUT, SG_DEBUG, "Initializing key bindings"); SG_LOG(SG_INPUT, SG_DEBUG, "Initializing key bindings");
SGPropertyNode * key_nodes = fgGetNode("/input/keyboard"); SGPropertyNode * key_nodes = fgGetNode("/input/keyboard");
if (key_nodes == 0) { if (key_nodes == 0) {
@ -427,6 +426,8 @@ FGInput::_init_keyboard ()
for (unsigned int i = 0; i < keys.size(); i++) { for (unsigned int i = 0; i < keys.size(); i++) {
int index = keys[i]->getIndex(); int index = keys[i]->getIndex();
SG_LOG(SG_INPUT, SG_DEBUG, "Binding key " << index); SG_LOG(SG_INPUT, SG_DEBUG, "Binding key " << index);
_key_bindings[index].bindings->clear();
_key_bindings[index].is_repeatable = keys[i]->getBoolValue("repeatable"); _key_bindings[index].is_repeatable = keys[i]->getBoolValue("repeatable");
_read_bindings(keys[i], _key_bindings[index].bindings, FG_MOD_NONE); _read_bindings(keys[i], _key_bindings[index].bindings, FG_MOD_NONE);
} }