rename #wizcheckmdifficulty to #wizmondiff

Shorten the name of the recently added debug command that validates
monster difficulty values.  'wizcheckmdifficulty' was 19 characters
long, the next longest is 14 ('wiztelekinesis').  The extra width
messed up the Qt interface's extended command selection dialog when
wizard mode commands are included.  It sizes the button for every
command to fit the longest name; the increase in size from 14 to 19
made the button grid become too big for the screen.

Add monsters' base difficulty level to the #wizmondiff output.

Add #wizmondiff and #wizdispmacros to 'wizhelp'.
This commit is contained in:
PatR
2022-10-14 12:42:12 -07:00
committed by nhmall
parent 0848ae7d83
commit b7d46980ce
2 changed files with 60 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
Debug-Mode Quick Reference: Debug-Mode Quick Reference:
^E == detect secret doors and traps ^E == detect secret doors and traps nearby
^F == map level; reveals traps and secret corridors but not secret doors ^F == map level; reveals traps and secret corridors but not secret doors
^G == create monster by name or class ^G == create monster by name or class
^I == identify items in pack ^I == identify items in pack
@@ -13,7 +13,7 @@ Debug-Mode Quick Reference:
escalates impossible warnings to panic escalates impossible warnings to panic
#levelchange == set hero's experience level #levelchange == set hero's experience level
#lightsources == show mobile light sources #lightsources == show mobile light sources
#migratemons == show migrating monsters; optionally create some #migratemons == show migrating monsters; [Opt] potentially create some
#panic == panic test (warning: current game will be terminated) #panic == panic test (warning: current game will be terminated)
#polyself == polymorph self #polyself == polymorph self
#stats == show memory statistics #stats == show memory statistics
@@ -23,12 +23,14 @@ Debug-Mode Quick Reference:
#vision == show vision array #vision == show vision array
#wizborn == show monster birth/death/geno/extinct stats #wizborn == show monster birth/death/geno/extinct stats
#wizcast == cast any spell #wizcast == cast any spell
#wizdispmacros == [Opt] check internal display classifications
#wizfliplevel == transpose the current dungeon level #wizfliplevel == transpose the current dungeon level
#wizintrinsic == set selected intrinsic timeouts #wizintrinsic == set selected intrinsic timeouts
#wizkill == remove monster(s) from play #wizkill == remove monster(s) from play
#wizloaddes == load and execute a special level description lua script #wizloaddes == load and execute a special level description lua script
#wizloadlua == load and execute a lua script #wizloadlua == load and execute a lua script
#wizmakemap == recreate the current dungeon level #wizmakemap == recreate the current dungeon level
#wizmondiff == [Opt] check for discrepancies in monster difficulty ratings
#wizrumorcheck == validate rumor indexing; also show first, second, and last #wizrumorcheck == validate rumor indexing; also show first, second, and last
random engravings, epitaphs, and hallucinatory monsters random engravings, epitaphs, and hallucinatory monsters
#wizseenv == show map locations' seen vectors #wizseenv == show map locations' seen vectors
@@ -45,3 +47,5 @@ debug_overwrite_stairs
monpolycontrol == prompt for new form whenever any monster changes shape monpolycontrol == prompt for new form whenever any monster changes shape
sanity_check == evaluate monsters, objects, and map prior to each turn sanity_check == evaluate monsters, objects, and map prior to each turn
wizweight == augment object descriptions with their objects' weight wizweight == augment object descriptions with their objects' weight
[Opt] = conditionally available depending upon build-time settings

View File

@@ -17,7 +17,7 @@
#endif #endif
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG)
static int wiz_display_macros(void); static int wiz_display_macros(void);
static int wiz_check_mdifficulty(void); static int wiz_mon_diff(void);
#endif #endif
#ifdef DUMB /* stuff commented out in extern.h, but needed here */ #ifdef DUMB /* stuff commented out in extern.h, but needed here */
@@ -2757,8 +2757,6 @@ struct ext_func_tab extcmdlist[] = {
{ C('e'), "wizdetect", "reveal hidden things within a small radius", { C('e'), "wizdetect", "reveal hidden things within a small radius",
wiz_detect, IFBURIED | WIZMODECMD, NULL }, wiz_detect, IFBURIED | WIZMODECMD, NULL },
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG)
{ '\0', "wizcheckmdifficulty", "validate the difficulty levels of monsters",
wiz_check_mdifficulty, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
{ '\0', "wizdispmacros", "validate the display macro ranges", { '\0', "wizdispmacros", "validate the display macro ranges",
wiz_display_macros, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, wiz_display_macros, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
#endif #endif
@@ -2783,6 +2781,10 @@ struct ext_func_tab extcmdlist[] = {
wiz_makemap, IFBURIED | WIZMODECMD, NULL }, wiz_makemap, IFBURIED | WIZMODECMD, NULL },
{ C('f'), "wizmap", "map the level", { C('f'), "wizmap", "map the level",
wiz_map, IFBURIED | WIZMODECMD, NULL }, wiz_map, IFBURIED | WIZMODECMD, NULL },
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG)
{ '\0', "wizmondiff", "validate the difficulty ratings of monsters",
wiz_mon_diff, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
#endif
{ '\0', "wizrumorcheck", "verify rumor boundaries", { '\0', "wizrumorcheck", "verify rumor boundaries",
wiz_rumor_check, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, wiz_rumor_check, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
{ '\0', "wizseenv", "show map locations' seen vectors", { '\0', "wizseenv", "show map locations' seen vectors",
@@ -3695,8 +3697,12 @@ count_obj(struct obj *chain, long *total_count, long *total_size,
DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE_WARNING follows show_wiz_stats */ DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE_WARNING follows show_wiz_stats */
static void static void
obj_chain(winid win, const char *src, struct obj *chain, boolean force, obj_chain(
long *total_count, long *total_size) winid win,
const char *src,
struct obj *chain,
boolean force,
long *total_count, long *total_size)
{ {
char buf[BUFSZ]; char buf[BUFSZ];
long count = 0L, size = 0L; long count = 0L, size = 0L;
@@ -3712,8 +3718,11 @@ obj_chain(winid win, const char *src, struct obj *chain, boolean force,
} }
static void static void
mon_invent_chain(winid win, const char *src, struct monst *chain, mon_invent_chain(
long *total_count, long *total_size) winid win,
const char *src,
struct monst *chain,
long *total_count, long *total_size)
{ {
char buf[BUFSZ]; char buf[BUFSZ];
long count = 0, size = 0; long count = 0, size = 0;
@@ -3731,8 +3740,10 @@ mon_invent_chain(winid win, const char *src, struct monst *chain,
} }
static void static void
contained_stats(winid win, const char *src, long *total_count, contained_stats(
long *total_size) winid win,
const char *src,
long *total_count, long *total_size)
{ {
char buf[BUFSZ]; char buf[BUFSZ];
long count = 0, size = 0; long count = 0, size = 0;
@@ -3785,8 +3796,12 @@ size_monst(struct monst *mtmp, boolean incl_wsegs)
} }
static void static void
mon_chain(winid win, const char *src, struct monst *chain, mon_chain(
boolean force, long *total_count, long *total_size) winid win,
const char *src,
struct monst *chain,
boolean force,
long *total_count, long *total_size)
{ {
char buf[BUFSZ]; char buf[BUFSZ];
long count, size; long count, size;
@@ -3808,7 +3823,9 @@ mon_chain(winid win, const char *src, struct monst *chain,
} }
static void static void
misc_stats(winid win, long *total_count, long *total_size) misc_stats(
winid win,
long *total_count, long *total_size)
{ {
char buf[BUFSZ], hdrbuf[QBUFSZ]; char buf[BUFSZ], hdrbuf[QBUFSZ];
long count, size; long count, size;
@@ -4010,6 +4027,8 @@ wiz_show_stats(void)
return ECMD_OK; return ECMD_OK;
} }
RESTORE_WARNING_FORMAT_NONLITERAL
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG)
/* the #wizdispmacros command /* the #wizdispmacros command
* Verify that some display macros are returning sane values */ * Verify that some display macros are returning sane values */
@@ -4031,9 +4050,8 @@ wiz_display_macros(void)
if (test == no_glyph) { if (test == no_glyph) {
if (!trouble++) if (!trouble++)
putstr(win, 0, display_issues); putstr(win, 0, display_issues);
Sprintf(buf, Sprintf(buf, "glyph_is_cmap() / glyph_to_cmap(glyph=%d)"
"glyph_is_cmap() / glyph_to_cmap(glyph=%d)" " sync failure, returned NO_GLYPH (%d)",
" sync failure, returned NO_GLYPH (%d)",
glyph, test); glyph, test);
putstr(win, 0, buf); putstr(win, 0, buf);
} }
@@ -4051,7 +4069,7 @@ wiz_display_macros(void)
if (!trouble++) if (!trouble++)
putstr(win, 0, display_issues); putstr(win, 0, display_issues);
Sprintf(buf, "glyph_to_cmap(glyph=%d) returns %d" Sprintf(buf, "glyph_to_cmap(glyph=%d) returns %d"
" exceeds defsyms[%d] bounds (MAX_GLYPH = %d)", " exceeds defsyms[%d] bounds (MAX_GLYPH = %d)",
glyph, test, SIZE(defsyms), max_glyph); glyph, test, SIZE(defsyms), max_glyph);
putstr(win, 0, buf); putstr(win, 0, buf);
} }
@@ -4064,7 +4082,7 @@ wiz_display_macros(void)
if (!trouble++) if (!trouble++)
putstr(win, 0, display_issues); putstr(win, 0, display_issues);
Sprintf(buf, "glyph_to_mon(glyph=%d) returns %d" Sprintf(buf, "glyph_to_mon(glyph=%d) returns %d"
" exceeds mons[%d] bounds", " exceeds mons[%d] bounds",
glyph, test, NUMMONS); glyph, test, NUMMONS);
putstr(win, 0, buf); putstr(win, 0, buf);
} }
@@ -4077,14 +4095,14 @@ wiz_display_macros(void)
if (!trouble++) if (!trouble++)
putstr(win, 0, display_issues); putstr(win, 0, display_issues);
Sprintf(buf, "glyph_to_obj(glyph=%d) returns %d" Sprintf(buf, "glyph_to_obj(glyph=%d) returns %d"
" exceeds objects[%d] bounds", " exceeds objects[%d] bounds",
glyph, test, NUM_OBJECTS); glyph, test, NUM_OBJECTS);
putstr(win, 0, buf); putstr(win, 0, buf);
} }
} }
} }
if (!trouble) if (!trouble)
putstr(win, 0, "No display macro issues detected"); putstr(win, 0, "No display macro issues detected.");
display_nhwindow(win, FALSE); display_nhwindow(win, FALSE);
destroy_nhwindow(win); destroy_nhwindow(win);
return ECMD_OK; return ECMD_OK;
@@ -4092,15 +4110,22 @@ wiz_display_macros(void)
#endif /* (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) */ #endif /* (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) */
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG)
/* the #wizcheckmdifficulty command */ /* the #wizmondiff command */
static int static int
wiz_check_mdifficulty(void) wiz_mon_diff(void)
{ {
static const char window_title[] = "Review of monster difficulty ratings"
" [index:level]:";
char buf[BUFSZ]; char buf[BUFSZ];
winid win; winid win;
int mhardcoded = 0, mcalculated = 0, trouble = 0, cnt = 0, mdiff = 0; int mhardcoded = 0, mcalculated = 0, trouble = 0, cnt = 0, mdiff = 0;
int mlev;
struct permonst *ptr; struct permonst *ptr;
static const char *const window_title = "Review of monster difficulties:";
/*
* Possible extension: choose between showing discrepancies,
* showing all monsters, or monsters within a particular class.
*/
win = create_nhwindow(NHW_TEXT); win = create_nhwindow(NHW_TEXT);
for (ptr = &mons[0]; ptr->mlet; ptr++, cnt++) { for (ptr = &mons[0]; ptr->mlet; ptr++, cnt++) {
@@ -4110,23 +4135,24 @@ wiz_check_mdifficulty(void)
if (mdiff) { if (mdiff) {
if (!trouble++) if (!trouble++)
putstr(win, 0, window_title); putstr(win, 0, window_title);
mlev = (int) ptr->mlevel;
if (mlev > 50) /* hack for named demons */
mlev = 50;
Snprintf(buf, sizeof buf, Snprintf(buf, sizeof buf,
"%-18s [%4d]: calculated: %2d, hardcoded: %2d (%+d)", "%-18s [%3d:%2d]: calculated: %2d, hardcoded: %2d (%+d)",
ptr->pmnames[NEUTRAL], cnt, mcalculated, mhardcoded, ptr->pmnames[NEUTRAL], cnt, mlev,
mdiff); mcalculated, mhardcoded, mdiff);
putstr(win, 0, buf); putstr(win, 0, buf);
} }
} }
if (!trouble) if (!trouble)
putstr(win, 0, "No monster difficulty discrepencies were detected"); putstr(win, 0, "No monster difficulty discrepencies were detected.");
display_nhwindow(win, FALSE); display_nhwindow(win, FALSE);
destroy_nhwindow(win); destroy_nhwindow(win);
return ECMD_OK; return ECMD_OK;
} }
#endif /* (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) */ #endif /* (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) */
RESTORE_WARNING_FORMAT_NONLITERAL
static void static void
you_sanity_check(void) you_sanity_check(void)
{ {