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
+6 -3
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 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, 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 "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 '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") 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 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; 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 the mouse data passed to nethack didn't match the curses (ncurses on
OSX 10.11) documentation and things didn't work as intended 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 curses+'perm_invent': entries were wrapping without any control; usually not
noticeable because next entry overwrote, but visible for final entry noticeable because next entry overwrote, but visible for final entry
when whole inventory fit within the available height; looked ok with 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 curses+'perm_invent': could crash during restore if game was saved while
hero was swallowed (invalid u.ustuck pointer; suppressing attempts to hero was swallowed (invalid u.ustuck pointer; suppressing attempts to
update persistent inventory window during restore hides the problem) 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 curses+'popup_dialog': show the text cursor at the end of prompts for single
character input character input
curses+DUMPLOG: pass along old messages from save file and quest message curses+DUMPLOG: pass along old messages from save file and quest message
+1
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 int curses_read_char(void);
extern void curses_toggle_color_attr(WINDOW *win, int color, int attr, extern void curses_toggle_color_attr(WINDOW *win, int color, int attr,
int onoff); int onoff);
extern void curses_menu_color_attr(WINDOW *, int, int, int);
extern void curses_bail(const char *mesg); extern void curses_bail(const char *mesg);
extern winid curses_get_wid(int type); extern winid curses_get_wid(int type);
extern char *curses_copy_of(const char *s); extern char *curses_copy_of(const char *s);
+13 -13
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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -264,7 +264,7 @@ boolean foundyou;
canspotmon(mtmp) ? Monnam(mtmp) : "Something", canspotmon(mtmp) ? Monnam(mtmp) : "Something",
is_undirected_spell(mattk->adtyp, spellnum) is_undirected_spell(mattk->adtyp, spellnum)
? "" ? ""
: (Invisible && !perceives(mtmp->data) : (Invis && !perceives(mtmp->data)
&& (mtmp->mux != u.ux || mtmp->muy != u.uy)) && (mtmp->mux != u.ux || mtmp->muy != u.uy))
? " at a spot near you" ? " at a spot near you"
: (Displaced : (Displaced
@@ -406,15 +406,15 @@ int spellnum;
int count; int count;
count = nasty(mtmp); /* summon something nasty */ count = nasty(mtmp); /* summon something nasty */
if (mtmp->iswiz) if (mtmp->iswiz) {
verbalize("Destroy the thief, my pet%s!", plur(count)); verbalize("Destroy the thief, my pet%s!", plur(count));
else { } else {
const char *mappear = const char *mappear = (count == 1) ? "A monster appears"
(count == 1) ? "A monster appears" : "Monsters appear"; : "Monsters appear";
/* messages not quite right if plural monsters created but /* messages not quite right if plural monsters created but
only a single monster is seen */ only a single monster is seen */
if (Invisible && !perceives(mtmp->data) if (Invis && !perceives(mtmp->data)
&& (mtmp->mux != u.ux || mtmp->muy != u.uy)) && (mtmp->mux != u.ux || mtmp->muy != u.uy))
pline("%s around a spot near you!", mappear); pline("%s around a spot near you!", mappear);
else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy)) 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")); pline("%s %s.", upstart(arg), vtense(arg, "appear"));
} }
/* seen caster, possibly producing unseen--or just one--critters; /* seen caster, possibly producing unseen--or just one--critters;
hero is told what the caster is doing and doesn't necessarily hero is told what the caster is doing and doesn't necessarily
observe complete accuracy of that caster's results (in other observe complete accuracy of that caster's results (in other
words, no need to fuss with visibility or singularization; words, no need to fuss with visibility or singularization;
player is told what's happening even if hero is unconscious) */ player is told what's happening even if hero is unconscious) */
} else if (!success) } else if (!success)
fmt = "%s casts at a clump of sticks, but nothing happens."; fmt = "%s casts at a clump of sticks, but nothing happens.";
else if (let == S_SNAKE) else if (let == S_SNAKE)
fmt = "%s transforms a clump of sticks into snakes!"; 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)) && (mtmp->mux != u.ux || mtmp->muy != u.uy))
fmt = "%s summons insects around a spot near you!"; fmt = "%s summons insects around a spot near you!";
else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy)) else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
+16 -14
View File
@@ -1185,21 +1185,20 @@ menu_display_page(nhmenu *menu, WINDOW * win, int page_num, char *selectors)
start_col += 2; start_col += 2;
} }
#endif #endif
if (iflags.use_menu_color color = NO_COLOR;
&& (menu_color = get_menu_coloring(menu_item_ptr->str, menu_color = iflags.use_menu_color
&color, &attr)) != 0) { && get_menu_coloring(menu_item_ptr->str, &color, &attr);
if (color != NO_COLOR) { if (menu_color) {
curses_toggle_color_attr(win, color, NONE, ON);
}
attr = curses_convert_attr(attr); attr = curses_convert_attr(attr);
if (attr != A_NORMAL) { if (color != NO_COLOR || attr != A_NORMAL)
menu_item_ptr->attr = menu_item_ptr->attr | attr; 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); num_lines = curses_num_lines(menu_item_ptr->str, entry_cols);
for (count = 0; count < num_lines; count++) { for (count = 0; count < num_lines; count++) {
if (menu_item_ptr->str && *menu_item_ptr->str) { if (menu_item_ptr->str && *menu_item_ptr->str) {
tmpstr = curses_break_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); free(tmpstr);
} }
} }
if (menu_color && (color != NO_COLOR)) { if (color != NO_COLOR || attr != A_NORMAL) {
curses_toggle_color_attr(win, color, NONE, OFF); 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; menu_item_ptr = menu_item_ptr->next_item;
} }
+2 -11
View File
@@ -60,7 +60,6 @@ curses_add_inv(int y,
CHAR_P accelerator, attr_t attr, const char *str) CHAR_P accelerator, attr_t attr, const char *str)
{ {
WINDOW *win = curses_get_nhwin(INV_WIN); WINDOW *win = curses_get_nhwin(INV_WIN);
boolean save_guicolor;
int color = NO_COLOR; int color = NO_COLOR;
int x = 0, width, height, available_width, stroffset = 0, int x = 0, width, height, available_width, stroffset = 0,
border = curses_window_has_border(INV_WIN) ? 1 : 0; border = curses_window_has_border(INV_WIN) ? 1 : 0;
@@ -142,16 +141,8 @@ curses_add_inv(int y,
} }
if (color == NO_COLOR) if (color == NO_COLOR)
color = NONE; color = NONE;
/* curses_toggle_color_attr() uses 'guicolor' to decide whether to curses_menu_color_attr(win, color, attr, ON);
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); */
wprintw(win, "%.*s", available_width, str + stroffset); wprintw(win, "%.*s", available_width, str + stroffset);
/* wattroff(win, attr); */ curses_menu_color_attr(win, color, attr, OFF);
curses_toggle_color_attr(win, color, attr, OFF);
iflags.wc2_guicolor = save_guicolor;
wclrtoeol(win); wclrtoeol(win);
} }
+16
View File
@@ -163,6 +163,22 @@ curses_toggle_color_attr(WINDOW *win, int color, int attr, int onoff)
#endif /* TEXTCOLOR */ #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 */ /* clean up and quit - taken from tty port */
+2 -1
View File
@@ -9,7 +9,8 @@
/* Global declarations */ /* Global declarations */
int curses_read_char(void); 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); void curses_bail(const char *mesg);
winid curses_get_wid(int type); winid curses_get_wid(int type);
char *curses_copy_of(const char *s); char *curses_copy_of(const char *s);