not PR #1102 - map refresh during #terrain

This fixes the part of pull request #1102 by entrez dealing with the
map refresh side of things.  It was pulled out of a much larger patch
that also deals with terminal window resize for tty.

Using ^R when getpos() is in operation, whether actually picking a
position for something or browsing the map during #terrain or post
detection magic, it was reconstructing the known map and positioning
the cursor on the hero instead redrawing the selected terrain subset
or detected objects/monsters/whatever.  There's already a routine to
redraw the current view of the map without recalculating it, but it
wasn't being used for ^R during getpos operation.
This commit is contained in:
PatR
2023-10-12 01:18:55 -07:00
parent e5c6bf8ec0
commit f70f84aee7
5 changed files with 59 additions and 17 deletions

View File

@@ -730,9 +730,20 @@ enum hilite_states {
static void
getpos_refresh(int *hilite_statep)
{
if (*hilite_statep == Hilite_Active)
int redrawflags = docrtRefresh;
if (*hilite_statep == Hilite_Active) {
/* removing SHOWVALID markers; just redraw the map */
(*getpos_hilitefunc)(2); /* tmp_at(DISP_END) */
docrt(); /* redraw everything */
redrawflags |= docrtMapOnly;
} else {
/* ^R: player requested that the screen be redrawn; maybe something
* outside of nethack has clobbered it; clear it, redisplay what we
* think the map already shows rather than recalculate that, do a
* full status update, and show perminv, if applicable */
; /* just docrtRefresh */
}
docrt_flags(redrawflags);
*hilite_statep = Hilite_Inactive;
}
@@ -928,6 +939,7 @@ getpos(coord *ccp, boolean force, const char *goal)
getpos_help(force, goal);
/* ^R: docrt(), hilite_state = Hilite_Inactive */
getpos_refresh(&hilite_state);
curs(WIN_MAP, cx, cy);
/* update message window to reflect that we're still targeting */
show_goal_msg = TRUE;
} else if (c == gc.Cmd.spkeys[NHKF_GETPOS_SHOWVALID]) {