Merge branch 'NetHack-3.6'

This commit is contained in:
nhmall
2019-09-02 10:10:37 -04:00
7 changed files with 56 additions and 42 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.106 $ $NHDT-Date: 1567273590 2019/08/31 17:46:30 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.108 $ $NHDT-Date: 1567418344 2019/09/02 09:59:04 $
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,
@@ -133,6 +133,9 @@ have 'O' update persistent inventory window if 'implicit_uncursed',
'O's "set <option> to what?" could be used to force a buffer overflow
'O's response to bad 'statuslines' value said "must be 2 and 3" (at one point
it was "must be between 2 and 3", change it to "must be 2 or 3")
when spellcasting monster aimed at wrong spot due to not being able to see
invisible hero, feedback could be erroneous if hero could see self
[messages used 'if (Invisible)' test where 'if (Invis)' was meant]
Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
@@ -219,6 +222,8 @@ curses: disable the attempt to support Ctrl+Left_click as an alternate way
to generate Right_click for systems with one-button mouse or trackpad;
the mouse data passed to nethack didn't match the curses (ncurses on
OSX 10.11) documentation and things didn't work as intended
curses: menu coloring required that both 'menucolors' and 'guicolor' be On;
for menus, override guicolor with more-specific menucolors
curses+'perm_invent': entries were wrapping without any control; usually not
noticeable because next entry overwrote, but visible for final entry
when whole inventory fit within the available height; looked ok with
@@ -232,8 +237,6 @@ curses+'perm_invent': don't highlight inventory letters since nothing is
curses+'perm_invent': could crash during restore if game was saved while
hero was swallowed (invalid u.ustuck pointer; suppressing attempts to
update persistent inventory window during restore hides the problem)
curses+'perm_invent': menu coloring required that both 'menucolors' and
'guicolor' be On; override guicolor with more-specific menucolors
curses+'popup_dialog': show the text cursor at the end of prompts for single
character input
curses+DUMPLOG: pass along old messages from save file and quest message

View File

@@ -143,6 +143,7 @@ extern boolean curses_map_borders(int *sx, int *sy, int *ex, int *ey,
extern int curses_read_char(void);
extern void curses_toggle_color_attr(WINDOW *win, int color, int attr,
int onoff);
extern void curses_menu_color_attr(WINDOW *, int, int, int);
extern void curses_bail(const char *mesg);
extern winid curses_get_wid(int type);
extern char *curses_copy_of(const char *s);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mcastu.c $NHDT-Date: 1436753517 2015/07/13 02:11:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */
/* NetHack 3.6 mcastu.c $NHDT-Date: 1567418129 2019/09/02 09:55:29 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.55 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -264,7 +264,7 @@ boolean foundyou;
canspotmon(mtmp) ? Monnam(mtmp) : "Something",
is_undirected_spell(mattk->adtyp, spellnum)
? ""
: (Invisible && !perceives(mtmp->data)
: (Invis && !perceives(mtmp->data)
&& (mtmp->mux != u.ux || mtmp->muy != u.uy))
? " at a spot near you"
: (Displaced
@@ -406,15 +406,15 @@ int spellnum;
int count;
count = nasty(mtmp); /* summon something nasty */
if (mtmp->iswiz)
if (mtmp->iswiz) {
verbalize("Destroy the thief, my pet%s!", plur(count));
else {
const char *mappear =
(count == 1) ? "A monster appears" : "Monsters appear";
} else {
const char *mappear = (count == 1) ? "A monster appears"
: "Monsters appear";
/* messages not quite right if plural monsters created but
only a single monster is seen */
if (Invisible && !perceives(mtmp->data)
if (Invis && !perceives(mtmp->data)
&& (mtmp->mux != u.ux || mtmp->muy != u.uy))
pline("%s around a spot near you!", mappear);
else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
@@ -631,16 +631,16 @@ int spellnum;
pline("%s %s.", upstart(arg), vtense(arg, "appear"));
}
/* seen caster, possibly producing unseen--or just one--critters;
hero is told what the caster is doing and doesn't necessarily
observe complete accuracy of that caster's results (in other
words, no need to fuss with visibility or singularization;
player is told what's happening even if hero is unconscious) */
/* seen caster, possibly producing unseen--or just one--critters;
hero is told what the caster is doing and doesn't necessarily
observe complete accuracy of that caster's results (in other
words, no need to fuss with visibility or singularization;
player is told what's happening even if hero is unconscious) */
} else if (!success)
fmt = "%s casts at a clump of sticks, but nothing happens.";
else if (let == S_SNAKE)
fmt = "%s transforms a clump of sticks into snakes!";
else if (Invisible && !perceives(mtmp->data)
else if (Invis && !perceives(mtmp->data)
&& (mtmp->mux != u.ux || mtmp->muy != u.uy))
fmt = "%s summons insects around a spot near you!";
else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))

View File

@@ -1185,21 +1185,20 @@ menu_display_page(nhmenu *menu, WINDOW * win, int page_num, char *selectors)
start_col += 2;
}
#endif
if (iflags.use_menu_color
&& (menu_color = get_menu_coloring(menu_item_ptr->str,
&color, &attr)) != 0) {
if (color != NO_COLOR) {
curses_toggle_color_attr(win, color, NONE, ON);
}
color = NO_COLOR;
menu_color = iflags.use_menu_color
&& get_menu_coloring(menu_item_ptr->str, &color, &attr);
if (menu_color) {
attr = curses_convert_attr(attr);
if (attr != A_NORMAL) {
menu_item_ptr->attr = menu_item_ptr->attr | attr;
}
if (color != NO_COLOR || attr != A_NORMAL)
curses_menu_color_attr(win, color, attr, ON);
} else {
attr = menu_item_ptr->attr;
if (color != NO_COLOR || attr != A_NORMAL)
curses_toggle_color_attr(win, color, attr, ON);
}
curses_toggle_color_attr(win, NONE, menu_item_ptr->attr, ON);
num_lines = curses_num_lines(menu_item_ptr->str, entry_cols);
for (count = 0; count < num_lines; count++) {
if (menu_item_ptr->str && *menu_item_ptr->str) {
tmpstr = curses_break_str(menu_item_ptr->str,
@@ -1209,10 +1208,13 @@ menu_display_page(nhmenu *menu, WINDOW * win, int page_num, char *selectors)
free(tmpstr);
}
}
if (menu_color && (color != NO_COLOR)) {
curses_toggle_color_attr(win, color, NONE, OFF);
if (color != NO_COLOR || attr != A_NORMAL) {
if (menu_color)
curses_menu_color_attr(win, color, attr, OFF);
else
curses_toggle_color_attr(win, color, attr, OFF);
}
curses_toggle_color_attr(win, NONE, menu_item_ptr->attr, OFF);
menu_item_ptr = menu_item_ptr->next_item;
}

View File

@@ -60,7 +60,6 @@ curses_add_inv(int y,
CHAR_P accelerator, attr_t attr, const char *str)
{
WINDOW *win = curses_get_nhwin(INV_WIN);
boolean save_guicolor;
int color = NO_COLOR;
int x = 0, width, height, available_width, stroffset = 0,
border = curses_window_has_border(INV_WIN) ? 1 : 0;
@@ -142,16 +141,8 @@ curses_add_inv(int y,
}
if (color == NO_COLOR)
color = NONE;
/* curses_toggle_color_attr() uses 'guicolor' to decide whether to
honor specified color, but persistent inventory window has its own
more-specific control, 'menucolors', so override with that here */
save_guicolor = iflags.wc2_guicolor;
iflags.wc2_guicolor = iflags.use_menu_color;
curses_toggle_color_attr(win, color, attr, ON);
/* wattron(win, attr); */
curses_menu_color_attr(win, color, attr, ON);
wprintw(win, "%.*s", available_width, str + stroffset);
/* wattroff(win, attr); */
curses_toggle_color_attr(win, color, attr, OFF);
iflags.wc2_guicolor = save_guicolor;
curses_menu_color_attr(win, color, attr, OFF);
wclrtoeol(win);
}

View File

@@ -163,6 +163,22 @@ curses_toggle_color_attr(WINDOW *win, int color, int attr, int onoff)
#endif /* TEXTCOLOR */
}
/* call curses_toggle_color_attr() with 'menucolors' instead of 'guicolor'
as the control flag */
void
curses_menu_color_attr(WINDOW *win, int color, int attr, int onoff)
{
boolean save_guicolor = iflags.wc2_guicolor;
/* curses_toggle_color_attr() uses 'guicolor' to decide whether to
honor specified color, but menu windows have their own
more-specific control, 'menucolors', so override with that here */
iflags.wc2_guicolor = iflags.use_menu_color;
curses_toggle_color_attr(win, color, attr, onoff);
iflags.wc2_guicolor = save_guicolor;
}
/* clean up and quit - taken from tty port */

View File

@@ -9,7 +9,8 @@
/* Global declarations */
int curses_read_char(void);
void curses_toggle_color_attr(WINDOW * win, int color, int attr, int onoff);
void curses_toggle_color_attr(WINDOW *win, int color, int attr, int onoff);
void curses_menu_color_attr(WINDOW *win, int color, int attr, int onoff);
void curses_bail(const char *mesg);
winid curses_get_wid(int type);
char *curses_copy_of(const char *s);