number_pad (modified from <Someone>'s patch)

The number_pad option can now optionally hold a value
{0,1, 2 } for {off, on, DOS-mode} but plain number_pad and
!number_pad in config files still work as before.

When number_pad:2 is set, iflags.num_pad_mode is set to 1
which triggers the following behaviour:
> '5', M('5') and M('0') are mapped in rhack()
>in cmd.c, only when they are entered as a command. When used as a
>number, like in the 'n' command, no mapping takes place. '0' is
>already mapped to 'i' by the core. The
>only difference [<Someone>] left in (deliberately) is when you press Ctrl-0;
>this used to map to C('i'), which is an invalid command; now
>keep it '0' (which is interpreted as 'i' by the core.)
This commit is contained in:
nethack.allison
2003-06-06 03:49:56 +00:00
parent 3a31710a6c
commit a67ed775cb
8 changed files with 58 additions and 16 deletions

View File

@@ -1792,7 +1792,18 @@ register char *cmd;
flags.move = FALSE;
return; /* probably we just had an interrupt */
}
if (iflags.num_pad && iflags.num_pad_mode == 1) {
/* This handles very old inconsistent DOS/Windows behaviour
* in a new way: earlier, the keyboard handler mapped these,
* which caused counts to be strange when entered from the
* number pad. Now do not map them until here.
*/
switch (*cmd) {
case '5': *cmd = 'g'; break;
case M('5'): *cmd = 'G'; break;
case M('0'): *cmd = 'I'; break;
}
}
/* handle most movement commands */
do_walk = do_rush = prefix_seen = FALSE;
flags.travel = 0;