fix wiz identify bugs
Fixes #124 Fix github pull request #124 which was also reported directly (but not through the contact form so #Hxxx number). Using ^I or #wizidentify displays inventory with everything ID'd for that command only and adds a menu entry "_ - use '^I' to identify" that can be chosen to make those ID's persistent. Picking underscore would work but picking the alternate '^I' wouldn't work if the platform had unsigned characters for plain 'char'. Switch the return value from magic number -1 to magic number ^I which isn't a valid inventory letter and isn't subject to sign conversion. Casting -1 to '(char) -1' would have worked too despite some confusion expressed in discussion of the pull request. If ^I has been bound to some other command and #wizidentify hasn't been bound to any keystroke, temporary ID didn't disclose any extra information (ie, acted like ordinary inventory display) and the extra menu entry to make temporary ID become persistent wasn't available. This fixes that too.
This commit is contained in:
@@ -100,6 +100,10 @@ parchment and vellum are made from animal skin so change material composition
|
||||
and color for spellbooks with those descriptions from paper to leather;
|
||||
eating those books now breaks vegetarian conduct
|
||||
fix monsters not wielding digging implements
|
||||
wizard mode ^I^I didn't make temporary identifications become persistent if
|
||||
the build configuration makes plain 'char' unsigned
|
||||
wizard mode #wizidentify didn't disclose extra information for unID'd items if
|
||||
key bindings took away ^I and didn't bind #wizidentify to another key
|
||||
|
||||
|
||||
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
|
||||
|
||||
44
src/cmd.c
44
src/cmd.c
@@ -7,6 +7,22 @@
|
||||
#include "lev.h"
|
||||
#include "func_tab.h"
|
||||
|
||||
/* Macros for meta and ctrl modifiers:
|
||||
* M and C return the meta/ctrl code for the given character;
|
||||
* e.g., (C('c') is ctrl-c
|
||||
*/
|
||||
#ifndef M
|
||||
#ifndef NHSTDC
|
||||
#define M(c) (0x80 | (c))
|
||||
#else
|
||||
#define M(c) ((c) - 128)
|
||||
#endif /* NHSTDC */
|
||||
#endif
|
||||
|
||||
#ifndef C
|
||||
#define C(c) (0x1f & (c))
|
||||
#endif
|
||||
|
||||
#ifdef ALTMETA
|
||||
STATIC_VAR boolean alt_esc = FALSE;
|
||||
#endif
|
||||
@@ -625,8 +641,18 @@ wiz_identify(VOID_ARGS)
|
||||
{
|
||||
if (wizard) {
|
||||
iflags.override_ID = (int) cmd_from_func(wiz_identify);
|
||||
if (display_inventory((char *) 0, TRUE) == -1)
|
||||
/* command remapping might leave #wizidentify as the only way
|
||||
to invoke us, in which case cmd_from_func() will yield NUL;
|
||||
it won't matter to display_inventory()/display_pickinv()
|
||||
if ^I invokes some other command--what matters is that it
|
||||
is never an inventory letter */
|
||||
if (!iflags.override_ID)
|
||||
iflags.override_ID = C('I');
|
||||
/* C('I') == ^I == default keystroke for wiz_identify;
|
||||
it doesn't matter whether the command has been remapped */
|
||||
if (display_inventory((char *) 0, TRUE) == C('I'))
|
||||
identify_pack(0, FALSE);
|
||||
/* [TODO? if player picks a specific inventory item, ID it] */
|
||||
iflags.override_ID = 0;
|
||||
} else
|
||||
pline("Unavailable command '%s'.",
|
||||
@@ -2859,22 +2885,6 @@ int final;
|
||||
en_win = WIN_ERR;
|
||||
}
|
||||
|
||||
/* Macros for meta and ctrl modifiers:
|
||||
* M and C return the meta/ctrl code for the given character;
|
||||
* e.g., (C('c') is ctrl-c
|
||||
*/
|
||||
#ifndef M
|
||||
#ifndef NHSTDC
|
||||
#define M(c) (0x80 | (c))
|
||||
#else
|
||||
#define M(c) ((c) - 128)
|
||||
#endif /* NHSTDC */
|
||||
#endif
|
||||
|
||||
#ifndef C
|
||||
#define C(c) (0x1f & (c))
|
||||
#endif
|
||||
|
||||
/* ordered by command name */
|
||||
struct ext_func_tab extcmdlist[] = {
|
||||
{ '#', "#", "perform an extended command",
|
||||
|
||||
@@ -748,7 +748,7 @@ time_t when; /* date+time at end of game */
|
||||
dump_plines();
|
||||
putstr(0, 0, "");
|
||||
putstr(0, 0, "Inventory:");
|
||||
display_inventory((char *) 0, TRUE);
|
||||
(void) display_inventory((char *) 0, TRUE);
|
||||
container_contents(invent, TRUE, TRUE, FALSE);
|
||||
enlightenment((BASICENLIGHTENMENT | MAGICENLIGHTENMENT),
|
||||
(how >= PANICKED) ? ENL_GAMEOVERALIVE : ENL_GAMEOVERDEAD);
|
||||
|
||||
14
src/invent.c
14
src/invent.c
@@ -5,6 +5,10 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
#ifndef C /* same as cmd.c */
|
||||
#define C(c) (0x1f & (c))
|
||||
#endif
|
||||
|
||||
#define NOINVSYM '#'
|
||||
#define CONTAINED_SYM '>' /* designator for inside a container */
|
||||
#define HANDS_SYM '-'
|
||||
@@ -2580,9 +2584,15 @@ long *out_cnt;
|
||||
if (wizard && iflags.override_ID) {
|
||||
char prompt[QBUFSZ];
|
||||
|
||||
any.a_char = -1;
|
||||
/* C('I') == ^I == default keystroke for wiz_identify;
|
||||
it is guaranteed not to be in use as an inventory letter
|
||||
(wiz_identify might be remapped to an ordinary letter,
|
||||
making iflags.override_ID ambiguous as a return value) */
|
||||
any.a_char = C('I');
|
||||
/* wiz_identify stuffed the wiz_identify command character (^I)
|
||||
into iflags.override_ID for our use as an accelerator */
|
||||
into iflags.override_ID for our use as an accelerator;
|
||||
it could be ambiguous as a selector but the only time it
|
||||
is wanted is in case where no item is being selected */
|
||||
Sprintf(prompt, "Debug Identify (%s to permanently identify)",
|
||||
visctrl(iflags.override_ID));
|
||||
add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE,
|
||||
|
||||
Reference in New Issue
Block a user