end_glyphout(); /* in case message printed during graphics output */
putsyms(str);
cl_end();
- ttyDisplay->toplin = 1;
+ ttyDisplay->toplin = TOPLINE_NEED_MORE;
if (ttyDisplay->cury && otoplin != 3)
more();
}
struct WinDesc *cw = wins[WIN_MESSAGE];
if (!(cw->flags & WIN_STOP)) {
- if (ttyDisplay->cury && ttyDisplay->toplin == 2)
+ if (ttyDisplay->cury && ttyDisplay->toplin == TOPLINE_NON_EMPTY)
tty_clear_nhwindow(WIN_MESSAGE);
cw->curx = cw->cury = 0;
cl_end();
addtopl(str);
- if (ttyDisplay->cury && ttyDisplay->toplin != 3)
- ttyDisplay->toplin = 2;
+ if (ttyDisplay->cury && ttyDisplay->toplin != TOPLINE_SPECIAL_PROMPT)
+ ttyDisplay->toplin = TOPLINE_NON_EMPTY;
}
}
tty_curs(BASE_WINDOW, cw->curx + 1, cw->cury);
putsyms(s);
cl_end();
- ttyDisplay->toplin = 1;
+ ttyDisplay->toplin = TOPLINE_NEED_MORE;
}
void
home();
cl_end();
}
- ttyDisplay->toplin = 0;
+ ttyDisplay->toplin = TOPLINE_EMPTY;
ttyDisplay->inmore = 0;
}
/* If there is room on the line, print message on same line */
/* But messages like "You die..." deserve their own line */
n0 = strlen(bp);
- if ((ttyDisplay->toplin == 1 || (cw->flags & WIN_STOP))
+ if ((ttyDisplay->toplin == TOPLINE_NEED_MORE || (cw->flags & WIN_STOP))
&& cw->cury == 0
&& n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */
&& (notdied = strncmp(bp, "You die", 7)) != 0) {
addtopl(bp);
return;
} else if (!(cw->flags & WIN_STOP)) {
- if (ttyDisplay->toplin == 1) {
+ if (ttyDisplay->toplin == TOPLINE_NEED_MORE) {
more();
- } else if (cw->cury) { /* for when flags.toplin == 2 && cury > 1 */
+ } else if (cw->cury) { /* for toplin == TOPLINE_NON_EMPTY && cury > 1 */
docorner(1, cw->cury + 1); /* reset cury = 0 if redraw screen */
cw->curx = cw->cury = 0; /* from home--cls() & docorner(1,n) */
}
char prompt[BUFSZ];
yn_number = 0L;
- if (ttyDisplay->toplin == 1 && !(cw->flags & WIN_STOP))
+ if (ttyDisplay->toplin == TOPLINE_NEED_MORE && !(cw->flags & WIN_STOP))
more();
cw->flags &= ~WIN_STOP;
- ttyDisplay->toplin = 3; /* special prompt state */
+ ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT;
ttyDisplay->inread++;
if (resp) {
char *rb, respbuf[QBUFSZ];
dumplogmsg(toplines);
#endif
ttyDisplay->inread--;
- ttyDisplay->toplin = 2;
+ ttyDisplay->toplin = TOPLINE_NON_EMPTY;
if (ttyDisplay->intr)
ttyDisplay->intr--;
if (wins[WIN_MESSAGE]->cury)
new_status_window();
if (u.ux) {
i = ttyDisplay->toplin;
- ttyDisplay->toplin = 0;
+ ttyDisplay->toplin = TOPLINE_EMPTY;
docrt();
bot();
ttyDisplay->toplin = i;
/* set up tty descriptor */
ttyDisplay = (struct DisplayDesc *) alloc(sizeof (struct DisplayDesc));
- ttyDisplay->toplin = 0;
+ ttyDisplay->toplin = TOPLINE_EMPTY;
ttyDisplay->rows = hgt;
ttyDisplay->cols = wid;
ttyDisplay->curx = ttyDisplay->cury = 0;
switch (cw->type) {
case NHW_MESSAGE:
- if (ttyDisplay->toplin) {
+ if (ttyDisplay->toplin != TOPLINE_EMPTY) {
home();
cl_end();
if (cw->cury)
docorner(1, cw->cury + 1);
- ttyDisplay->toplin = 0;
+ ttyDisplay->toplin = TOPLINE_EMPTY;
}
break;
case NHW_STATUS:
switch (cw->type) {
case NHW_MESSAGE:
- if (ttyDisplay->toplin == 1) {
+ if (ttyDisplay->toplin == TOPLINE_NEED_MORE) {
more();
- ttyDisplay->toplin = 1; /* more resets this */
+ ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */
tty_clear_nhwindow(window);
+ /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */
} else
- ttyDisplay->toplin = 0;
+ ttyDisplay->toplin = TOPLINE_EMPTY;
cw->curx = cw->cury = 0;
if (!cw->active)
iflags.window_inited = TRUE;
case NHW_MAP:
end_glyphout();
if (blocking) {
- if (!ttyDisplay->toplin)
- ttyDisplay->toplin = 1;
+ if (ttyDisplay->toplin != TOPLINE_EMPTY)
+ ttyDisplay->toplin = TOPLINE_NEED_MORE;
tty_display_nhwindow(WIN_MESSAGE, TRUE);
return;
}
cw->offx = 0;
if (cw->type == NHW_MENU)
cw->offy = 0;
- if (ttyDisplay->toplin == 1)
+ if (ttyDisplay->toplin == TOPLINE_NEED_MORE)
tty_display_nhwindow(WIN_MESSAGE, TRUE);
#ifdef H2344_BROKEN
if (cw->maxrow >= (int) ttyDisplay->rows
cl_eos();
} else
clear_screen();
- ttyDisplay->toplin = 0;
+ ttyDisplay->toplin = TOPLINE_EMPTY;
} else {
if (WIN_MESSAGE != WIN_ERR)
tty_clear_nhwindow(WIN_MESSAGE);
switch (cw->type) {
case NHW_MESSAGE:
- if (ttyDisplay->toplin)
+ if (ttyDisplay->toplin != TOPLINE_EMPTY)
tty_display_nhwindow(WIN_MESSAGE, TRUE);
+ /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */
/*FALLTHRU*/
case NHW_STATUS:
case NHW_BASE:
response to a prompt, we'll assume that the display is up to date */
tty_putstr(WIN_MESSAGE, 0, mesg);
/* if `mesg' didn't wrap (triggering --More--), force --More-- now */
- if (ttyDisplay->toplin == 1) {
+ if (ttyDisplay->toplin == TOPLINE_NEED_MORE) {
more();
- ttyDisplay->toplin = 1; /* more resets this */
+ ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */
tty_clear_nhwindow(WIN_MESSAGE);
+ /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */
}
/* normally <ESC> means skip further messages, but in this case
it means cancel the current prompt; any other messages should
(void) fflush(stdout);
} else if (ttyDisplay->inread > program_state.gameover) {
/* this can only happen if we were reading and got interrupted */
- ttyDisplay->toplin = 3;
+ ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT;
/* do this twice; 1st time gets the Quit? message again */
(void) tty_doprev_message();
(void) tty_doprev_message();
i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */
else if (i == EOF)
i = '\033'; /* same for EOF */
- if (ttyDisplay && ttyDisplay->toplin == 1)
- ttyDisplay->toplin = 2;
+ /* topline has been seen - we can clear need for more */
+ if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE)
+ ttyDisplay->toplin = TOPLINE_NON_EMPTY;
#ifdef TTY_TILES_ESCCODES
{
/* hack to force output of the window select code */
i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */
else if (i == EOF)
i = '\033'; /* same for EOF */
- if (ttyDisplay && ttyDisplay->toplin == 1)
- ttyDisplay->toplin = 2;
+ /* topline has been seen - we can clear need for more */
+ if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE)
+ ttyDisplay->toplin = TOPLINE_NON_EMPTY;
#ifdef TTY_TILES_ESCCODES
{
/* hack to force output of the window select code */
i = ntposkey(x, y, mod);
if (!i && mod && (*mod == 0 || *mod == EOF))
i = '\033'; /* map NUL or EOF to ESC, nethack doesn't expect either */
- if (ttyDisplay && ttyDisplay->toplin == 1)
- ttyDisplay->toplin = 2;
+ /* topline has been seen - we can clear need for more */
+ if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE)
+ ttyDisplay->toplin = TOPLINE_NON_EMPTY;
#else /* !WIN32CON */
nhUse(x);
nhUse(y);