context-sensitive inventory item-action split
When picking an item from inventory and then picking 'I - adjust
inventory by splitting this stack' in the item-action menu,
yn_function("Split off how many?") is used to start getting the
count without needing to wait for <return>. It includes the response
in message history (so review of history will see that first digit).
The code then uses get_count() to obtain any additional digits. Tell
the latter to store "Count: N" in message history if N is different
from the first digit.
That's not as good as updating message history to replace the entry
showing the prompt with the first digit with one that shows the full
count but at least it's accurate when the count is 10 or more.
This commit is contained in:
13
src/invent.c
13
src/invent.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 invent.c $NHDT-Date: 1652831520 2022/05/17 23:52:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.388 $ */
|
||||
/* NetHack 3.7 invent.c $NHDT-Date: 1652861830 2022/05/18 08:17:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.389 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -4831,7 +4831,16 @@ adjust_split(void)
|
||||
/* got first digit, get more until next non-digit (except for
|
||||
backspace/delete which will take away most recent digit and
|
||||
keep going; we expect one of ' ', '\n', or '\r') */
|
||||
let = get_count(NULL, dig, LARGEST_INT, &splitamount, GC_ECHOFIRST);
|
||||
let = get_count(NULL, dig, 0L, &splitamount,
|
||||
/* yn_function() added the first digit to the
|
||||
prompt when recording message history; have
|
||||
get_count() display "Count: N" when waiting
|
||||
for additional digits (ordinarily that won't be
|
||||
shown until a second digit is entered) and also
|
||||
add "Count: N" to message history if more than
|
||||
one digit gets entered or the original N is
|
||||
deleted and replaced with different digit */
|
||||
GC_ECHOFIRST | GC_CONDHIST);
|
||||
/* \033 is in quitchars[] so we need to check for it separately
|
||||
in order to treat it as cancel rather than as accept */
|
||||
if (!let || let == '\033' || !index(quitchars, let)) {
|
||||
|
||||
Reference in New Issue
Block a user