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

Function curses_putch

win/curses/curswins.c:530–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528/* Print a single character in the given window at the given coordinates */
529
530void
531curses_putch(winid wid, int x, int y, int ch,
532#ifdef ENHANCED_SYMBOLS
533 struct unicode_representation *unicode_representation,
534#endif
535 int color, int framecolor, int attr)
536{
537 static boolean map_initted = FALSE;
538 int sx, sy, ex, ey;
539 boolean border = curses_window_has_border(wid);
540 nethack_char nch;
541/*
542 if (wid == STATUS_WIN) {
543 curses_update_stats();
544 }
545*/
546 if (wid != MAP_WIN) {
547 return;
548 }
549
550 if (!map_initted) {
551 clear_map();
552 map_initted = TRUE;
553 }
554
555 --x; /* map column [0] is not used; draw column [1] in first screen col */
556 map[y][x].ch = ch;
557 map[y][x].color = color;
558 map[y][x].framecolor = framecolor;
559 map[y][x].attr = attr;
560#ifdef ENHANCED_SYMBOLS
561 map[y][x].unicode_representation = unicode_representation;
562#endif
563 nch = map[y][x];
564
565 (void) curses_map_borders(&sx, &sy, &ex, &ey, -1, -1);
566
567 if ((x >= sx) && (x <= ex) && (y >= sy) && (y <= ey)) {
568 if (border) {
569 x++;
570 y++;
571 }
572
573 write_char(mapwin, x - sx, y - sy, nch);
574 }
575 /* refresh after every character?
576 * Fair go, mate! Some of us are playing from Australia! */
577 /* wrefresh(mapwin); */
578}
579
580
581/* Get x, y coordinates of curses window on the physical terminal window */

Callers 1

curses_print_glyphFunction · 0.85

Calls 4

curses_window_has_borderFunction · 0.85
clear_mapFunction · 0.85
curses_map_bordersFunction · 0.85
write_charFunction · 0.85

Tested by

no test coverage detected