curses map window

tty ignores map column #0 (0-based index), like the core, and draws
the map in screen columns 1 (1-based index) through 79, leaving screen
column 80 blank.  curses was drawing all 80 map columns and since #0
was always unused, screen column 1 was blank and the map was shown in
2 through 80.  Change curses to work like tty.

This was too easy; there may be problems lurking.  One known issue: it
should be made smarter about when clipping/panning is necessary since
it thinks that a full 80 columns are needed but 79 suffice.
This commit is contained in:
PatR
2019-06-18 03:52:28 -07:00
parent c9962c9d34
commit 1c03d09701
3 changed files with 6 additions and 2 deletions
+2
View File
@@ -519,6 +519,8 @@ curses_move_cursor(winid wid, int x, int y)
if (wid != MAP_WIN) {
return;
} else {
--x; /* map column [0] isn't used, so shift everything over 1 col */
}
#ifdef PDCURSES
/* PDCurses seems to not handle wmove correctly, so we use move and
+2 -1
View File
@@ -363,10 +363,10 @@ curs_destroy_all_wins()
void
curses_putch(winid wid, int x, int y, int ch, int color, int attr)
{
static boolean map_initted = FALSE;
int sx, sy, ex, ey;
boolean border = curses_window_has_border(wid);
nethack_char nch;
static boolean map_initted = FALSE;
/*
if (wid == STATUS_WIN) {
curses_update_stats();
@@ -381,6 +381,7 @@ curses_putch(winid wid, int x, int y, int ch, int color, int attr)
map_initted = TRUE;
}
--x; /* map column [0] is not used; draw column [1] in first screen col */
map[y][x].ch = ch;
map[y][x].color = color;
map[y][x].attr = attr;