Skip to content
Permalink
Browse files

Don't convert lua do_commands to keys and back (11095)

An actual command_type should be handled ok by anything on the other end
of this, so converting to keys immediately is overkill. This was causing
problems with keybindings in targeting mode that remapped numbers to the
direction commands in unusual ways: the first call converted the
commands to keys, and the keys got converted (incorrectly) to vikeys by
`unmangle_direction_keys`; they then got converted back to commands,
preserving the incorrect mapping. So the exact bug in 11095 is really
that unmangle shouldn't be called on the output of command_to_key, since
it isn't aware of keybindings.

The bug required a somewhat unusual key mapping to surface; in this
particular report 6 and 8 were (maybe by accident) swapped relative to
their normal position on a keypad, and this is why unmangling went
wrong.

Only autofight even uses this lua call, so hopefully there are no
other consequences to this simplification, but if tab starts acting
weirdly, this commit was probably why.
  • Loading branch information...
rawlins committed May 3, 2018
1 parent 7f50228 commit d5c8bedc332191fa7734e83a4d3992850e07c947
Showing with 1 addition and 1 deletion.
  1. +1 −1 crawl-ref/source/l-crawl.cc
@@ -458,7 +458,7 @@ static int crawl_do_commands(lua_State *ls)
first = false;
}
else
macro_sendkeys_end_add_expanded(command_to_key(cmd));
macro_buf_add_cmd(cmd);
}

process_command(firstcmd);

0 comments on commit d5c8bed

Please sign in to comment.
You can’t perform that action at this time.