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

Function curses_puts

win/curses/curswins.c:657–698  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

655 and text attributes */
656
657void
658curses_puts(winid wid, int attr, const char *text)
659{
660 anything Id;
661 WINDOW *win = NULL;
662
663 if (is_main_window(wid)) {
664 win = curses_get_nhwin(wid);
665 }
666
667 if (wid == MESSAGE_WIN) {
668 /* if a no-history message is being shown, remove it */
669 if (counting)
670 curses_count_window((char *) 0);
671
672 curses_message_win_puts(text, FALSE);
673 return;
674 }
675
676#if 0
677 if (wid == STATUS_WIN) {
678 curses_update_stats(); /* We will do the write ourselves */
679 return;
680 }
681#endif
682
683 if (curses_is_menu(wid) || curses_is_text(wid)) {
684 if (!curses_menu_exists(wid)) {
685 impossible(
686 "curses_puts: Attempted write to nonexistent window %d!",
687 wid);
688 return;
689 }
690 Id = cg.zeroany;
691 curses_add_nhmenu_item(wid, &nul_glyphinfo, &Id, 0, 0,
692 attr, NO_COLOR, text, MENU_ITEMFLAGS_NONE);
693 } else {
694 curses_set_wid_colors(wid, NULL);
695 waddstr(win, text);
696 wnoutrefresh(win);
697 }
698}
699
700
701/* Clear the contents of a window via the given NetHack winid */

Callers 1

curses_putstrFunction · 0.85

Calls 10

is_main_windowFunction · 0.85
curses_get_nhwinFunction · 0.85
curses_count_windowFunction · 0.85
curses_message_win_putsFunction · 0.85
curses_is_menuFunction · 0.85
curses_is_textFunction · 0.85
curses_menu_existsFunction · 0.85
curses_add_nhmenu_itemFunction · 0.85
curses_set_wid_colorsFunction · 0.85
impossibleFunction · 0.50

Tested by

no test coverage detected