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:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 mkobj.c $NHDT-Date: 1718999849 2024/06/21 19:57:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.299 $ */
|
||||
/* NetHack 3.7 mkobj.c $NHDT-Date: 1725138481 2024/08/31 21:08:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.304 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1160,7 +1160,7 @@ mksobj(int otyp, boolean init, boolean artif)
|
||||
|
||||
otmp = newobj();
|
||||
*otmp = cg.zeroobj;
|
||||
otmp->age = svm.moves;
|
||||
otmp->age = max(svm.moves, 1L);
|
||||
otmp->o_id = next_ident();
|
||||
otmp->quan = 1L;
|
||||
otmp->oclass = let;
|
||||
@@ -1341,7 +1341,7 @@ start_corpse_timeout(struct obj *body)
|
||||
|
||||
action = ROT_CORPSE; /* default action: rot away */
|
||||
rot_adjust = gi.in_mklev ? 25 : 10; /* give some variation */
|
||||
age = svm.moves - body->age;
|
||||
age = max(svm.moves, 1) - body->age;
|
||||
if (age > ROT_AGE)
|
||||
when = rot_adjust;
|
||||
else
|
||||
@@ -2381,8 +2381,7 @@ obj_timer_checks(
|
||||
|
||||
/* mark the corpse as being on ice */
|
||||
otmp->on_ice = 1;
|
||||
debugpline3("%s is now on ice at <%d,%d>.", The(xname(otmp)), x,
|
||||
y);
|
||||
debugpline3("%s is now on ice at <%d,%d>.", The(xname(otmp)), x, y);
|
||||
/* Adjust the time remaining */
|
||||
tleft *= ROT_ICE_ADJUSTMENT;
|
||||
restart_timer = TRUE;
|
||||
|
||||
Reference in New Issue
Block a user