MCPcopy Create free account
hub / github.com/NetHack/NetHack / tty_doprev_message

Function tty_doprev_message

win/tty/topl.c:19–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17static void free_msghistory_snapshot(boolean);
18
19int
20tty_doprev_message(void)
21{
22 struct WinDesc *cw = wins[WIN_MESSAGE];
23 winid prevmsg_win;
24 int i;
25
26 if ((iflags.prevmsg_window != 's')
27 && !ttyDisplay->inread) { /* not single */
28 if (iflags.prevmsg_window == 'f') { /* full */
29 prevmsg_win = create_nhwindow(NHW_MENU);
30 putstr(prevmsg_win, 0, "Message History");
31 putstr(prevmsg_win, 0, "");
32 cw->maxcol = cw->maxrow;
33 i = cw->maxcol;
34 do {
35 if (cw->data[i] && strcmp(cw->data[i], ""))
36 putstr(prevmsg_win, 0, cw->data[i]);
37 i = (i + 1) % cw->rows;
38 } while (i != cw->maxcol);
39 putstr(prevmsg_win, 0, gt.toplines);
40 display_nhwindow(prevmsg_win, TRUE);
41 destroy_nhwindow(prevmsg_win);
42 } else if (iflags.prevmsg_window == 'c') { /* combination */
43 do {
44 morc = 0;
45 if (cw->maxcol == cw->maxrow) {
46 ttyDisplay->dismiss_more = C('p'); /* ^P ok at --More-- */
47 redotoplin(gt.toplines);
48 cw->maxcol--;
49 if (cw->maxcol < 0)
50 cw->maxcol = cw->rows - 1;
51 if (!cw->data[cw->maxcol])
52 cw->maxcol = cw->maxrow;
53 } else if (cw->maxcol == (cw->maxrow - 1)) {
54 ttyDisplay->dismiss_more = C('p'); /* ^P ok at --More-- */
55 redotoplin(cw->data[cw->maxcol]);
56 cw->maxcol--;
57 if (cw->maxcol < 0)
58 cw->maxcol = cw->rows - 1;
59 if (!cw->data[cw->maxcol])
60 cw->maxcol = cw->maxrow;
61 } else {
62 prevmsg_win = create_nhwindow(NHW_MENU);
63 putstr(prevmsg_win, 0, "Message History");
64 putstr(prevmsg_win, 0, "");
65 cw->maxcol = cw->maxrow;
66 i = cw->maxcol;
67 do {
68 if (cw->data[i] && strcmp(cw->data[i], ""))
69 putstr(prevmsg_win, 0, cw->data[i]);
70 i = (i + 1) % cw->rows;
71 } while (i != cw->maxcol);
72 putstr(prevmsg_win, 0, gt.toplines);
73 display_nhwindow(prevmsg_win, TRUE);
74 destroy_nhwindow(prevmsg_win);
75 }
76

Callers 4

tty_yn_functionFunction · 0.85
tty_wait_synchFunction · 0.85
hooked_tty_getlinFunction · 0.85
amii_yn_functionFunction · 0.85

Calls 1

redotoplinFunction · 0.85

Tested by

no test coverage detected