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

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.56 $ $NHDT-Date: 1560611967 2019/06/15 15:19:27 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.57 $ $NHDT-Date: 1560855142 2019/06/18 10:52:22 $
This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -128,6 +128,7 @@ curses: don't convert ^M (or <return> or <enter> key) into ^J; both ^J and ^M
commands, ^J means run toward bottom of screen (when number_pad is
off) and ^M is not bound to any command, so accidental <return> won't
cause the hero to try to move
curses: draw map in screen columns 1..79 like tty, rather than in 2..80
curses+EDIT_GETLIN: when a prompt's answer was preloaded, using ESC to discard
it deleted it from the answer buffer but didn't erase it from screen
tty: re-do one optimization used when status conditions have all been removed

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

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;