Fix another impossible no_charge object
[NetHack.git] / win / tty / topl.c
blobc20dfa28878fc6b53a48faa1a03c651ee48b4c1b
1 /* NetHack 3.7 topl.c $NHDT-Date: 1717967339 2024/06/09 21:08:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.89 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Michael Allison, 2009. */
4 /* NetHack may be freely redistributed. See license for details. */
6 #include "hack.h"
8 #ifdef TTY_GRAPHICS
10 #include "tcap.h"
11 #include "wintty.h"
13 static void redotoplin(const char *);
14 static void topl_putsym(char);
15 static void removetopl(int);
16 static void msghistory_snapshot(boolean);
17 static void free_msghistory_snapshot(boolean);
19 int
20 tty_doprev_message(void)
22 struct WinDesc *cw = wins[WIN_MESSAGE];
23 winid prevmsg_win;
24 int i;
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);
77 } while (morc == C('p'));
78 ttyDisplay->dismiss_more = 0;
79 } else { /* reversed */
80 morc = 0;
81 prevmsg_win = create_nhwindow(NHW_MENU);
82 putstr(prevmsg_win, 0, "Message History");
83 putstr(prevmsg_win, 0, "");
84 putstr(prevmsg_win, 0, gt.toplines);
85 cw->maxcol = cw->maxrow - 1;
86 if (cw->maxcol < 0)
87 cw->maxcol = cw->rows - 1;
88 do {
89 putstr(prevmsg_win, 0, cw->data[cw->maxcol]);
90 cw->maxcol--;
91 if (cw->maxcol < 0)
92 cw->maxcol = cw->rows - 1;
93 if (!cw->data[cw->maxcol])
94 cw->maxcol = cw->maxrow;
95 } while (cw->maxcol != cw->maxrow);
97 display_nhwindow(prevmsg_win, TRUE);
98 destroy_nhwindow(prevmsg_win);
99 cw->maxcol = cw->maxrow;
100 ttyDisplay->dismiss_more = 0;
102 } else if (iflags.prevmsg_window == 's') { /* single */
103 ttyDisplay->dismiss_more = C('p'); /* <ctrl/P> allowed at --More-- */
104 do {
105 morc = 0;
106 if (cw->maxcol == cw->maxrow)
107 redotoplin(gt.toplines);
108 else if (cw->data[cw->maxcol])
109 redotoplin(cw->data[cw->maxcol]);
110 cw->maxcol--;
111 if (cw->maxcol < 0)
112 cw->maxcol = cw->rows - 1;
113 if (!cw->data[cw->maxcol])
114 cw->maxcol = cw->maxrow;
115 } while (morc == C('p'));
116 ttyDisplay->dismiss_more = 0;
118 return 0;
121 static void
122 redotoplin(const char *str)
124 int otoplin = ttyDisplay->toplin;
126 home();
127 if (!ttyDisplay->topl_utf8) {
128 if (ttyDisplay->mixed && (*str & 0x80)) {
129 /* kludge for the / command, the only time we ever want a */
130 /* graphics character on the top line */
131 g_putch((int) *str++);
132 ttyDisplay->curx++;
134 end_glyphout(); /* in case message printed during graphics output */
136 putsyms(str);
137 cl_end();
138 ttyDisplay->toplin = TOPLINE_NEED_MORE;
139 if (ttyDisplay->cury && otoplin != TOPLINE_SPECIAL_PROMPT)
140 more();
143 /* for use by tty_putstr() */
144 void
145 show_topl(const char *str)
147 struct WinDesc *cw = wins[WIN_MESSAGE];
149 /* show if either STOP isn't set or current message specifies NOSTOP */
150 if ((cw->flags & (WIN_STOP | WIN_NOSTOP)) != WIN_STOP) {
151 /* NOSTOP cancels persistent STOP and is a one-shot operation;
152 force both to be cleared (no-op for either bit that isn't set) */
153 cw->flags &= ~(WIN_STOP | WIN_NOSTOP);
155 if (ttyDisplay->cury && ttyDisplay->toplin == TOPLINE_NON_EMPTY)
156 tty_clear_nhwindow(WIN_MESSAGE);
158 cw->curx = cw->cury = 0;
159 home();
160 cl_end();
161 addtopl(str);
163 if (ttyDisplay->cury && ttyDisplay->toplin != TOPLINE_SPECIAL_PROMPT)
164 ttyDisplay->toplin = TOPLINE_NON_EMPTY;
168 /* used by update_topl(); also by tty_putstr() */
169 void
170 remember_topl(void)
172 struct WinDesc *cw = wins[WIN_MESSAGE];
173 int idx = cw->maxrow;
174 unsigned len = strlen(gt.toplines) + 1;
176 if ((cw->flags & WIN_LOCKHISTORY) || !*gt.toplines)
177 return;
179 if (len > (unsigned) cw->datlen[idx]) {
180 if (cw->data[idx])
181 free(cw->data[idx]);
182 len += (8 - (len & 7)); /* pad up to next multiple of 8 */
183 cw->data[idx] = (char *) alloc(len);
184 cw->datlen[idx] = (short) len;
186 Strcpy(cw->data[idx], gt.toplines);
187 if (!program_state.in_checkpoint) {
188 *gt.toplines = '\0';
189 cw->maxcol = cw->maxrow = (idx + 1) % cw->rows;
193 void
194 addtopl(const char *s)
196 struct WinDesc *cw = wins[WIN_MESSAGE];
198 tty_curs(BASE_WINDOW, cw->curx + 1, cw->cury);
199 putsyms(s);
200 cl_end();
201 ttyDisplay->toplin = TOPLINE_NEED_MORE;
204 void
205 more(void)
207 struct WinDesc *cw = wins[WIN_MESSAGE];
209 if (iflags.debug_fuzzer)
210 return;
212 /* avoid recursion -- only happens from interrupts */
213 if (ttyDisplay->inmore)
214 return;
216 ttyDisplay->inmore++;
218 if (ttyDisplay->toplin) {
219 tty_curs(BASE_WINDOW, cw->curx + 1, cw->cury);
220 if (cw->curx >= CO - 8)
221 topl_putsym('\n');
224 if (flags.standout)
225 standoutbeg();
226 putsyms(defmorestr);
227 if (flags.standout)
228 standoutend();
230 xwaitforspace("\033 ");
232 if (morc == '\033') {
233 if (!(cw->flags & WIN_NOSTOP))
234 cw->flags |= WIN_STOP;
237 if (ttyDisplay->toplin && cw->cury) {
238 docorner(1, cw->cury + 1, 0);
239 cw->curx = cw->cury = 0;
240 home();
241 } else if (morc == '\033') {
242 cw->curx = cw->cury = 0;
243 home();
244 cl_end();
246 ttyDisplay->toplin = TOPLINE_EMPTY;
247 ttyDisplay->inmore = 0;
250 void
251 update_topl(const char *bp)
253 char *tl, *otl;
254 int n0;
255 int notdied = 1;
256 struct WinDesc *cw = wins[WIN_MESSAGE];
257 boolean skip = (cw->flags & (WIN_STOP | WIN_NOSTOP)) == WIN_STOP;
259 /* If there is room on the line, print message on same line */
260 /* But messages like "You die..." deserve their own line */
261 n0 = strlen(bp);
262 if ((ttyDisplay->toplin == TOPLINE_NEED_MORE || skip)
263 && cw->cury == 0
264 && n0 + (int) strlen(gt.toplines) + 3 < CO - 8 /* room for --More-- */
265 && (notdied = strncmp(bp, "You die", 7)) != 0) {
266 Strcat(gt.toplines, " ");
267 Strcat(gt.toplines, bp);
268 cw->curx += 2;
269 if (!skip)
270 addtopl(bp);
271 return;
272 } else if (!skip) {
273 if (ttyDisplay->toplin == TOPLINE_NEED_MORE) {
274 more();
275 } else if (cw->cury) { /* for toplin==TOPLINE_NON_EMPTY && cury > 1 */
276 docorner(1, cw->cury + 1, 0); /* reset cury = 0 if redraw screen */
277 cw->curx = cw->cury = 0; /* from home--cls() & docorner(1,n,0) */
280 remember_topl();
281 (void) strncpy(gt.toplines, bp, TBUFSZ);
282 gt.toplines[TBUFSZ - 1] = 0;
284 for (tl = gt.toplines; n0 >= CO; ) {
285 otl = tl;
286 for (tl += CO - 1; tl != otl; --tl)
287 if (*tl == ' ')
288 break;
289 if (tl == otl) {
290 /* Eek! A huge token. Try splitting after it. */
291 tl = strchr(otl, ' ');
292 if (!tl)
293 break; /* No choice but to spit it out whole. */
295 *tl++ = '\n';
296 n0 = strlen(tl);
298 if (!notdied) /* double negative => "You die"; avoid suppressing mesg */
299 cw->flags &= ~WIN_STOP, skip = FALSE;
300 if (!skip)
301 redotoplin(gt.toplines);
304 static void
305 topl_putsym(char c)
307 struct WinDesc *cw = wins[WIN_MESSAGE];
309 if (cw == (struct WinDesc *) 0)
310 panic("Putsym window MESSAGE nonexistent");
312 switch (c) {
313 case '\b':
314 if (ttyDisplay->curx == 0 && ttyDisplay->cury > 0)
315 tty_curs(BASE_WINDOW, CO, (int) ttyDisplay->cury - 1);
316 backsp();
317 nhassert(ttyDisplay->curx > 0);
318 ttyDisplay->curx--;
319 cw->curx = ttyDisplay->curx;
320 return;
321 case '\n':
322 cl_end();
323 ttyDisplay->curx = 0;
324 ttyDisplay->cury++;
325 cw->cury = ttyDisplay->cury;
326 #ifdef WIN32CON
327 (void) putchar(c);
328 #endif
329 break;
330 default:
331 if (ttyDisplay->curx == CO - 1)
332 topl_putsym('\n'); /* 1 <= curx < CO; avoid CO */
333 #ifdef WIN32CON
334 (void) putchar(c);
335 #endif
336 ttyDisplay->curx++;
338 cw->curx = ttyDisplay->curx;
339 if (cw->curx == 0)
340 cl_end();
341 #ifndef WIN32CON
342 (void) putchar(c);
343 #endif
346 void
347 putsyms(const char *str)
349 while (*str)
350 topl_putsym(*str++);
353 static void
354 removetopl(int n)
356 /* assume addtopl() has been done, so ttyDisplay->toplin is already set */
357 while (n-- > 0)
358 putsyms("\b \b");
361 extern char erase_char; /* from xxxtty.c; don't need kill_char */
363 /* returns a single keystroke; also sets 'yn_number' */
364 char
365 tty_yn_function(
366 const char *query,
367 const char *resp,
368 char def)
371 * Generic yes/no function. 'def' is the default (returned by space
372 * or return; 'esc' returns 'q', or 'n', or the default, depending on
373 * what's in the expected-response string. The 'query' string is
374 * printed before the user is asked about the string.
376 * If resp is NULL, any single character is accepted and returned.
377 * If not-NULL, only characters in it are allowed (exceptions: the
378 * quitchars are always allowed, and if it contains '#' then digits
379 * are allowed). If it includes an <esc>, anything beyond that won't
380 * be shown in the prompt to the user but will be acceptable as input.
382 char q;
383 char rtmp[40];
384 boolean digit_ok, allow_num, preserve_case = FALSE;
385 struct WinDesc *cw = wins[WIN_MESSAGE];
386 boolean doprev = 0;
387 char prompt[BUFSZ];
389 yn_number = 0L;
390 if (ttyDisplay->toplin == TOPLINE_NEED_MORE
391 && (cw->flags & (WIN_STOP | WIN_NOSTOP)) != WIN_STOP)
392 more();
393 cw->flags &= ~(WIN_STOP | WIN_NOSTOP);
394 ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT;
395 ttyDisplay->inread++;
396 if (resp) {
397 char *rb, respbuf[QBUFSZ];
399 allow_num = (strchr(resp, '#') != 0);
400 Strcpy(respbuf, resp);
401 /* normally we force lowercase, but if any uppercase letters
402 are present in the allowed response, preserve case;
403 check this before stripping the hidden choices */
404 for (rb = respbuf; *rb; ++rb)
405 if ('A' <= *rb && *rb <= 'Z') {
406 preserve_case = TRUE;
407 break;
409 /* any acceptable responses that follow <esc> aren't displayed */
410 if ((rb = strchr(respbuf, '\033')) != 0)
411 *rb = '\0';
412 (void) strncpy(prompt, query, QBUFSZ - 1);
413 prompt[QBUFSZ - 1] = '\0';
414 Sprintf(eos(prompt), " [%s]", respbuf);
415 if (def)
416 Sprintf(eos(prompt), " (%c)", def);
417 /* not pline("%s ", prompt);
418 trailing space is wanted here in case of reprompt */
419 Strcat(prompt, " ");
420 custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s", prompt);
421 } else {
422 /* no restriction on allowed response, so always preserve case */
423 /* preserve_case = TRUE; -- moot since we're jumping to the end */
424 Sprintf(prompt, "%s ", query);
425 custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s", prompt);
426 q = readchar();
427 goto clean_up;
430 do { /* loop until we get valid input */
431 q = readchar();
432 if (!preserve_case)
433 q = lowc(q);
434 if (q == '\020') { /* ctrl-P */
435 if (iflags.prevmsg_window != 's') {
436 int sav = ttyDisplay->inread;
437 ttyDisplay->inread = 0;
438 (void) tty_doprev_message();
439 ttyDisplay->inread = sav;
440 tty_clear_nhwindow(WIN_MESSAGE);
441 cw->maxcol = cw->maxrow;
442 addtopl(prompt);
443 } else {
444 if (!doprev)
445 (void) tty_doprev_message(); /* need two initially */
446 (void) tty_doprev_message();
447 doprev = 1;
449 q = '\0'; /* force another loop iteration */
450 continue;
451 } else if (doprev) {
452 /* BUG[?]: this probably ought to check whether the
453 character which has just been read is an acceptable
454 response; if so, skip the reprompt and use it. */
455 tty_clear_nhwindow(WIN_MESSAGE);
456 cw->maxcol = cw->maxrow;
457 doprev = 0;
458 addtopl(prompt);
459 q = '\0'; /* force another loop iteration */
460 continue;
462 digit_ok = allow_num && digit(q);
463 if (q == '\033') {
464 if (strchr(resp, 'q'))
465 q = 'q';
466 else if (strchr(resp, 'n'))
467 q = 'n';
468 else
469 q = def;
470 break;
471 } else if (strchr(quitchars, q)) {
472 q = def;
473 break;
475 if (!strchr(resp, q) && !digit_ok) {
476 tty_nhbell();
477 q = (char) 0;
478 } else if (q == '#' || digit_ok) {
479 char z, digit_string[2];
480 int n_len = 0;
481 long value = 0;
483 addtopl("#"), n_len++;
484 digit_string[1] = '\0';
485 if (q != '#') {
486 digit_string[0] = q;
487 addtopl(digit_string), n_len++;
488 value = q - '0';
489 q = '#';
491 do { /* loop until we get a non-digit */
492 z = readchar();
493 if (!preserve_case)
494 z = lowc(z);
495 if (digit(z)) {
496 long dgt = (long) (z - '0');
498 /* value = (10 * value) + (z - '0'); */
499 value = AppendLongDigit(value, dgt);
500 if (value < 0)
501 break; /* overflow: try again */
502 digit_string[0] = z;
503 addtopl(digit_string), n_len++;
504 } else if (z == 'y' || strchr(quitchars, z)) {
505 if (z == '\033')
506 value = -1; /* abort */
507 z = '\n'; /* break */
508 } else if (z == erase_char || z == '\b') {
509 if (n_len <= 1) {
510 value = -1;
511 break;
512 } else {
513 value /= 10;
514 removetopl(1), n_len--;
516 } else {
517 value = -1; /* abort */
518 tty_nhbell();
519 break;
521 } while (z != '\n');
522 if (value > 0)
523 yn_number = value;
524 else if (value == 0)
525 q = 'n'; /* 0 => "no" */
526 else { /* remove number from top line, then try again */
527 removetopl(n_len), n_len = 0;
528 q = '\0';
531 } while (!q);
533 clean_up:
534 if (yn_number)
535 Sprintf(rtmp, "#%ld", yn_number);
536 else
537 (void) key2txt(q, rtmp);
538 /* addtopl(rtmp); -- rewrite gt.toplines instead */
539 Sprintf(gt.toplines, "%s%s", prompt, rtmp);
540 #ifdef DUMPLOG_CORE
541 dumplogmsg(gt.toplines);
542 #endif
543 ttyDisplay->inread--;
544 ttyDisplay->toplin = TOPLINE_NON_EMPTY;
545 if (ttyDisplay->intr)
546 ttyDisplay->intr--;
547 if (wins[WIN_MESSAGE]->cury)
548 tty_clear_nhwindow(WIN_MESSAGE);
550 return q;
553 /* shared by tty_getmsghistory() and tty_putmsghistory() */
554 static char **snapshot_mesgs = 0;
556 /* collect currently available message history data into a sequential array;
557 optionally, purge that data from the active circular buffer set as we go */
558 static void
559 msghistory_snapshot(
560 boolean purge) /* clear message history buffer as we copy it */
562 char *mesg;
563 int i, inidx, outidx;
564 struct WinDesc *cw;
566 /* paranoia (too early or too late panic save attempt?) */
567 if (WIN_MESSAGE == WIN_ERR || !wins[WIN_MESSAGE])
568 return;
569 cw = wins[WIN_MESSAGE];
571 /* flush gt.toplines[], moving most recent message to history */
572 remember_topl();
574 /* for a passive snapshot, we just copy pointers, so can't allow further
575 history updating to take place because that could clobber them */
576 if (!purge)
577 cw->flags |= WIN_LOCKHISTORY;
579 snapshot_mesgs = (char **) alloc((cw->rows + 1) * sizeof(char *));
580 outidx = 0;
581 inidx = cw->maxrow;
582 for (i = 0; i < cw->rows; ++i) {
583 snapshot_mesgs[i] = (char *) 0;
584 mesg = cw->data[inidx];
585 if (mesg && *mesg) {
586 snapshot_mesgs[outidx++] = mesg;
587 if (purge) {
588 /* we're taking this pointer away; subsequent history
589 updates will eventually allocate a new one to replace it */
590 cw->data[inidx] = (char *) 0;
591 cw->datlen[inidx] = 0;
594 inidx = (inidx + 1) % cw->rows;
596 snapshot_mesgs[cw->rows] = (char *) 0; /* sentinel */
598 /* for a destructive snapshot, history is now completely empty */
599 if (purge)
600 cw->maxcol = cw->maxrow = 0;
603 /* release memory allocated to message history snapshot */
604 static void
605 free_msghistory_snapshot(
606 boolean purged) /* True: took history's pointers,
607 * False: just cloned them */
609 if (snapshot_mesgs) {
610 /* snapshot pointers are no longer in use */
611 if (purged) {
612 int i;
614 for (i = 0; snapshot_mesgs[i]; ++i)
615 free((genericptr_t) snapshot_mesgs[i]);
618 free((genericptr_t) snapshot_mesgs), snapshot_mesgs = (char **) 0;
620 /* history can resume being updated at will now... */
621 if (!purged)
622 wins[WIN_MESSAGE]->flags &= ~WIN_LOCKHISTORY;
627 * This is called by the core save routines.
628 * Each time we are called, we return one string from the
629 * message history starting with the oldest message first.
630 * When none are left, we return a final null string.
632 * History is collected at the time of the first call.
633 * Any new messages issued after that point will not be
634 * included among the output of the subsequent calls.
636 char *
637 tty_getmsghistory(boolean init)
639 static int nxtidx;
640 char *nextmesg;
641 char *result = 0;
643 if (init) {
644 msghistory_snapshot(FALSE);
645 nxtidx = 0;
648 if (snapshot_mesgs) {
649 nextmesg = snapshot_mesgs[nxtidx++];
650 if (nextmesg) {
651 result = (char *) nextmesg;
652 } else {
653 free_msghistory_snapshot(FALSE);
656 return result;
660 * This is called by the core savefile restore routines.
661 * Each time we are called, we stuff the string into our message
662 * history recall buffer. The core will send the oldest message
663 * first (actually it sends them in the order they exist in the
664 * save file, but that is supposed to be the oldest first).
665 * These messages get pushed behind any which have been issued
666 * since this session with the program has been started, since
667 * they come from a previous session and logically precede
668 * anything (like "Restoring save file...") that's happened now.
670 * Called with a null pointer to finish up restoration.
672 * It's also called by the quest pager code when a block message
673 * has a one-line summary specified. We put that line directly
674 * into message history for ^P recall without having displayed it.
676 void
677 tty_putmsghistory(const char *msg, boolean restoring_msghist)
679 static boolean initd = FALSE;
680 int idx;
682 if (restoring_msghist && !initd) {
683 /* we're restoring history from the previous session, but new
684 messages have already been issued this session ("Restoring...",
685 for instance); collect current history (ie, those new messages),
686 and also clear it out so that nothing will be present when the
687 restored ones are being put into place */
688 msghistory_snapshot(TRUE);
689 initd = TRUE;
690 #ifdef DUMPLOG_CORE
691 /* this suffices; there's no need to scrub saved_pline[] pointers */
692 gs.saved_pline_index = 0;
693 #endif
696 if (msg) {
697 /* Caller is asking us to remember a top line that needed more.
698 Should we call more? This can happen when the player has set
699 iflags.force_invmenu and they attempt to shoot with nothing in
700 the quiver. */
701 if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE)
702 ttyDisplay->toplin = TOPLINE_NON_EMPTY;
704 /* move most recent message to history, make this become most recent */
705 remember_topl();
706 Strcpy(gt.toplines, msg);
707 #ifdef DUMPLOG_CORE
708 dumplogmsg(gt.toplines);
709 #endif
710 } else if (snapshot_mesgs) {
711 nhassert(ttyDisplay == NULL ||
712 ttyDisplay->toplin != TOPLINE_NEED_MORE);
714 /* done putting arbitrary messages in; put the snapshot ones back */
715 for (idx = 0; snapshot_mesgs[idx]; ++idx) {
716 remember_topl();
717 Strcpy(gt.toplines, snapshot_mesgs[idx]);
718 #ifdef DUMPLOG_CORE
719 dumplogmsg(gt.toplines);
720 #endif
722 /* now release the snapshot */
723 free_msghistory_snapshot(TRUE);
724 initd = FALSE; /* reset */
728 #endif /* TTY_GRAPHICS */
730 /*topl.c*/