diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 574b9da45..0e370f932 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1457,6 +1457,10 @@ adding command line 'nethack --usage' broke 'nethack -u name' (however, being hit by a big monster and getting knockback effect could send hero out of a shop (or into its "free spot") while carrying unpaid goods; robbery wasn't noticed until hero eventually moved to a different spot +hallucination of objects incorrectly included generic objects as candidates + for what objects looked like; if an object had its dknown flag set, + formatting a generic object in its place was unreliable (Null pointer + deference prior to static analyzer fix, odd fake name "generic" after) curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/include/display.h b/include/display.h index a09ddf027..ece52cd13 100644 --- a/include/display.h +++ b/include/display.h @@ -180,9 +180,11 @@ * random_object() * * Respectively return a random monster or object. + * random_object() won't return STRANGE_OBJECT or the generic objects. + * -/+ MAXOCLASSES is used to skip it and them. */ -#define random_monster(rng) rng(NUMMONS) -#define random_object(rng) (rng(NUM_OBJECTS - 1) + 1) +#define random_monster(rng) ((*rng)(NUMMONS)) +#define random_object(rng) ((*rng)(NUM_OBJECTS - MAXOCLASSES) + MAXOCLASSES) /* * what_obj() diff --git a/src/pager.c b/src/pager.c index adb6d93ca..3da66038e 100644 --- a/src/pager.c +++ b/src/pager.c @@ -332,10 +332,11 @@ look_at_object( } static void -look_at_monster(char *buf, - char *monbuf, /* buf: output, monbuf: optional output */ - struct monst *mtmp, - coordxy x, coordxy y) +look_at_monster( + char *buf, + char *monbuf, /* buf: output, monbuf: optional output */ + struct monst *mtmp, + coordxy x, coordxy y) { char *name, monnambuf[BUFSZ], healthbuf[BUFSZ]; boolean accurate = !Hallucination;