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

Function display_map_window

win/X11/winmap.c:993–1038  ·  view source on GitHub ↗

* Check if there are any changed characters. If so, then plaster them on * the screen. */

Source from the content-addressed store, hash-verified

991 * the screen.
992 */
993void
994display_map_window(struct xwindow *wp)
995{
996 int row;
997 struct map_info_t *map_info = wp->map_information;
998
999 if ((Is_rogue_level(&u.uz) ? map_info->is_tile
1000 : (map_info->is_tile != iflags.wc_tiled_map))
1001 && map_info->tile_map.image_width) {
1002 int i;
1003
1004 /* changed map display mode, re-display the full map */
1005 for (i = 0; i < ROWNO; i++) {
1006 map_info->t_start[i] = 0;
1007 map_info->t_stop[i] = COLNO-1;
1008 }
1009 map_info->is_tile = iflags.wc_tiled_map && !Is_rogue_level(&u.uz);
1010 XClearWindow(XtDisplay(wp->w), XtWindow(wp->w));
1011 set_map_size(wp, COLNO, ROWNO);
1012 check_cursor_visibility(wp);
1013 highlight_yn(TRUE); /* change fg/bg to match map */
1014 } else if (wp->prevx != wp->cursx || wp->prevy != wp->cursy) {
1015 coordxy x = wp->prevx, y = wp->prevy;
1016
1017 /*
1018 * Previous cursor position is not the same as the current
1019 * cursor position, update the old cursor position.
1020 */
1021 if (x < map_info->t_start[y])
1022 map_info->t_start[y] = x;
1023 if (x > map_info->t_stop[y])
1024 map_info->t_stop[y] = x;
1025 }
1026
1027 for (row = 0; row < ROWNO; row++) {
1028 if (map_info->t_start[row] <= map_info->t_stop[row]) {
1029 map_update(wp, row, row, (int) map_info->t_start[row],
1030 (int) map_info->t_stop[row], FALSE);
1031 map_info->t_start[row] = COLNO - 1;
1032 map_info->t_stop[row] = 0;
1033 }
1034 }
1035 display_cursor(wp);
1036 wp->prevx = wp->cursx; /* adjust old cursor position */
1037 wp->prevy = wp->cursy;
1038}
1039
1040/*
1041 * Set all map tiles and characters to S_unexplored (was S_stone).

Callers 3

X11_display_nhwindowFunction · 0.85
X11_preference_updateFunction · 0.85
clear_map_windowFunction · 0.85

Calls 5

set_map_sizeFunction · 0.85
check_cursor_visibilityFunction · 0.85
highlight_ynFunction · 0.85
map_updateFunction · 0.85
display_cursorFunction · 0.85

Tested by

no test coverage detected