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:
@@ -69,7 +69,7 @@ curses_create_window(int wid, int width, int height, orient orientation)
|
||||
|
||||
if ((orientation == UP) || (orientation == DOWN) ||
|
||||
(orientation == LEFT) || (orientation == RIGHT)) {
|
||||
if (gi.invent || (svm.moves > 1)) {
|
||||
if (svm.moves > 0) {
|
||||
map_border = curses_window_has_border(MAP_WIN);
|
||||
curses_get_window_xy(MAP_WIN, &mapx, &mapy);
|
||||
curses_get_window_size(MAP_WIN, &maph, &mapw);
|
||||
@@ -104,7 +104,7 @@ curses_create_window(int wid, int width, int height, orient orientation)
|
||||
starty = (term_rows / 2) - (height / 2);
|
||||
break;
|
||||
case UP:
|
||||
if (gi.invent || (svm.moves > 1)) {
|
||||
if (svm.moves > 0) {
|
||||
startx = (mapw / 2) - (width / 2) + mapx + mapb_offset;
|
||||
} else {
|
||||
startx = 0;
|
||||
@@ -113,7 +113,7 @@ curses_create_window(int wid, int width, int height, orient orientation)
|
||||
starty = mapy + mapb_offset;
|
||||
break;
|
||||
case DOWN:
|
||||
if (gi.invent || (svm.moves > 1)) {
|
||||
if (svm.moves > 0) {
|
||||
startx = (mapw / 2) - (width / 2) + mapx + mapb_offset;
|
||||
} else {
|
||||
startx = 0;
|
||||
@@ -129,7 +129,7 @@ curses_create_window(int wid, int width, int height, orient orientation)
|
||||
starty = term_rows - height;
|
||||
break;
|
||||
case RIGHT:
|
||||
if (gi.invent || (svm.moves > 1)) {
|
||||
if (svm.moves > 0) {
|
||||
startx = (mapw + mapx + (mapb_offset * 2)) - width;
|
||||
} else {
|
||||
startx = term_cols - width;
|
||||
@@ -222,7 +222,7 @@ curses_refresh_nethack_windows(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((svm.moves <= 1) && !gi.invent) {
|
||||
if (svm.moves == 0) {
|
||||
/* Main windows not yet displayed; refresh base window instead */
|
||||
touchwin(stdscr);
|
||||
refresh();
|
||||
|
||||
Reference in New Issue
Block a user