Merge branch 'NetHack-3.6'
This commit is contained in:
@@ -1129,7 +1129,8 @@ friday_13th()
|
|||||||
int
|
int
|
||||||
night()
|
night()
|
||||||
{
|
{
|
||||||
register int hour = getlt()->tm_hour;
|
register int hour = (iflags.debug_fuzzer ? (moves / 1000) % 24 :
|
||||||
|
getlt()->tm_hour);
|
||||||
|
|
||||||
return (hour < 6 || hour > 21);
|
return (hour < 6 || hour > 21);
|
||||||
}
|
}
|
||||||
@@ -1137,7 +1138,10 @@ night()
|
|||||||
int
|
int
|
||||||
midnight()
|
midnight()
|
||||||
{
|
{
|
||||||
return (getlt()->tm_hour == 0);
|
register int hour = (iflags.debug_fuzzer ? (moves / 1000) % 24 :
|
||||||
|
getlt()->tm_hour);
|
||||||
|
|
||||||
|
return (hour == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* strbuf_init() initializes strbuf state for use */
|
/* strbuf_init() initializes strbuf state for use */
|
||||||
|
|||||||
@@ -125,9 +125,7 @@ curses_line_input_dialog(const char *prompt, char *answer, int buffer)
|
|||||||
int map_height, map_width, maxwidth, remaining_buf, winx, winy, count;
|
int map_height, map_width, maxwidth, remaining_buf, winx, winy, count;
|
||||||
WINDOW *askwin, *bwin;
|
WINDOW *askwin, *bwin;
|
||||||
char *tmpstr;
|
char *tmpstr;
|
||||||
int prompt_width = (int) strlen(prompt) + buffer + 1;
|
int prompt_width, prompt_height = 1, height = prompt_height;
|
||||||
int prompt_height = 1;
|
|
||||||
int height = prompt_height;
|
|
||||||
char input[BUFSZ];
|
char input[BUFSZ];
|
||||||
|
|
||||||
/* if messages were being suppressed for the remainder of the turn,
|
/* if messages were being suppressed for the remainder of the turn,
|
||||||
@@ -136,6 +134,8 @@ curses_line_input_dialog(const char *prompt, char *answer, int buffer)
|
|||||||
|
|
||||||
if (buffer > (int) sizeof input)
|
if (buffer > (int) sizeof input)
|
||||||
buffer = (int) sizeof input;
|
buffer = (int) sizeof input;
|
||||||
|
/* +1: space between prompt and answer; buffer already accounts for \0 */
|
||||||
|
prompt_width = (int) strlen(prompt) + 1 + buffer;
|
||||||
maxwidth = term_cols - 2;
|
maxwidth = term_cols - 2;
|
||||||
|
|
||||||
if (iflags.window_inited) {
|
if (iflags.window_inited) {
|
||||||
@@ -163,23 +163,20 @@ curses_line_input_dialog(const char *prompt, char *answer, int buffer)
|
|||||||
free(tmpstr);
|
free(tmpstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iflags.window_inited) {
|
bwin = curses_create_window(prompt_width, height,
|
||||||
bwin = curses_create_window(prompt_width, height, UP);
|
iflags.window_inited ? UP : CENTER);
|
||||||
wrefresh(bwin);
|
wrefresh(bwin);
|
||||||
getbegyx(bwin, winy, winx);
|
getbegyx(bwin, winy, winx);
|
||||||
askwin = newwin(height, prompt_width, winy + 1, winx + 1);
|
askwin = newwin(height, prompt_width, winy + 1, winx + 1);
|
||||||
} else {
|
|
||||||
bwin = curses_create_window(prompt_width, height, CENTER);
|
|
||||||
wrefresh(bwin);
|
|
||||||
getbegyx(bwin, winy, winx);
|
|
||||||
askwin = newwin(height, prompt_width, winy + 1, winx + 1);
|
|
||||||
}
|
|
||||||
for (count = 0; count < prompt_height; count++) {
|
for (count = 0; count < prompt_height; count++) {
|
||||||
tmpstr = curses_break_str(prompt, maxwidth, count + 1);
|
tmpstr = curses_break_str(prompt, maxwidth, count + 1);
|
||||||
if (count == (prompt_height - 1)) { /* Last line */
|
mvwaddstr(askwin, count, 0, tmpstr);
|
||||||
mvwprintw(askwin, count, 0, "%s ", tmpstr);
|
if (count == prompt_height - 1) { /* Last line */
|
||||||
} else {
|
if ((int) strlen(tmpstr) < maxwidth)
|
||||||
mvwaddstr(askwin, count, 0, tmpstr);
|
waddch(askwin, ' ');
|
||||||
|
else
|
||||||
|
wmove(askwin, count + 1, 0);
|
||||||
}
|
}
|
||||||
free(tmpstr);
|
free(tmpstr);
|
||||||
}
|
}
|
||||||
@@ -188,7 +185,7 @@ curses_line_input_dialog(const char *prompt, char *answer, int buffer)
|
|||||||
curs_set(1);
|
curs_set(1);
|
||||||
wgetnstr(askwin, input, buffer - 1);
|
wgetnstr(askwin, input, buffer - 1);
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
strcpy(answer, input);
|
Strcpy(answer, input);
|
||||||
werase(bwin);
|
werase(bwin);
|
||||||
delwin(bwin);
|
delwin(bwin);
|
||||||
curses_destroy_win(askwin);
|
curses_destroy_win(askwin);
|
||||||
|
|||||||
Reference in New Issue
Block a user