generic object fix

When hallucinating, random object selection for objects was including
the new generic objects.  It was already excluding 'strange object'
by using 'rn2(NUM_OBJECTS - 1) + 1' to skip objects[0]; changing that
to be 'rn2(NUM_OBJECTS - MAXOCLASSES) + MAXOCLASSES' will skip the
first 18 objects, 'strange object' plus the 17 generic objects.

(I'm trying to convince myself that there's no off-by-1 or off-by-N
error and think I've succeeded.)
This commit is contained in:
PatR
2023-01-15 11:04:35 -08:00
parent 2e1f52e882
commit 68d8b5376a
3 changed files with 13 additions and 6 deletions

View File

@@ -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