github issue #1275: curses init vs pauper

Reported by ars3niy, the curses interface could behave strangely on
the first turn if the 'pauper' option/conduct was specified.

There isn't any definitive flag indicating whether or not the game
has started.  Since 'moves' has traditionally been initialized to 1
rather than to 0, there were several instances of
|  if (moves <= 1 && invent != NULL)
being used to determine the starting state on the assumption that
once hero has inventory, the game has begun.  Introduction of the
'pauper' option made the test for non-Null invent become unreliable.
For paupers, the program would behave as if the game hadn't started
yet until the player finally made a time-consuming move.

This changes compile-time initialization of 'moves' from 1 to 0,
then sets it to 1 when initial inventory would be bestowed (even
when 'pauper' inhibits that).  That's probably not the best place
for it, but testing for 'moves==0' now should produce an identical
effect as 'moves<=1 && invent!=NULL' used to accomplish.

It would have been much simpler just to give paupers 1 gold piece,
or perhaps one rock, in place of usual starting gear so that their
initial inventory wouldn't be empty, but the moves+invent way of
checking for start-of-play has always bothered me.

Should 'pauper' be preventing 'nethack -X' from giving its starting
wand of wishing?  Conducts and explore mode don't really overlap so
maybe it doesn't matter.

Fixes #1275
This commit is contained in:
PatR
2024-08-31 14:08:04 -07:00
parent 8e85561725
commit 0ce2439e82
7 changed files with 26 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1464 $ $NHDT-Date: 1723945837 2024/08/18 01:50:37 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1471 $ $NHDT-Date: 1725138479 2024/08/31 21:07:59 $
General Fixes and Modified Features
-----------------------------------
@@ -2021,6 +2021,9 @@ having #terrain display gas cloud regions as if they were traps didn't work
when a monster within a gas cloud was displayed on the map because the hero
was next to it, it remained displayed if hero moved away
eating a pyrolisk egg on the floor triggered an "object lost" panic
core object creation and the curses interface's window handling both became
confused by the 'pauper' option/conduct because they assumed that invent
being Null meant that the game hadn't started yet
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository