Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2019-02-27 08:20:38 -05:00
15 changed files with 246 additions and 112 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 display.c $NHDT-Date: 1540502147 2018/10/25 21:15:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.94 $ */
/* NetHack 3.6 display.c $NHDT-Date: 1551138503 2019/02/25 23:48:23 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.97 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1374,6 +1374,9 @@ docrt()
/* overlay with monsters */
see_monsters();
/* perm_invent */
update_inventory();
g.context.botlx = 1; /* force a redraw of the bottom line */
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do_wear.c $NHDT-Date: 1550014802 2019/02/12 23:40:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.107 $ */
/* NetHack 3.6 do_wear.c $NHDT-Date: 1551138255 2019/02/25 23:44:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.108 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1227,7 +1227,8 @@ struct obj *otmp;
}
/* check whether the target object is currently being taken off,
so that stop_donning() and steal() can vary messages */
so that stop_donning() and steal() can vary messages and doname()
can vary "(being worn)" suffix */
boolean
doffing(otmp)
struct obj *otmp;

View File

@@ -114,8 +114,9 @@ panictrace_handler(sig_unused)
int sig_unused UNUSED;
{
#define SIG_MSG "\nSignal received.\n"
int f2 = (int) write(2, SIG_MSG, sizeof SIG_MSG - 1);
int f2;
f2 = (int) write(2, SIG_MSG, sizeof SIG_MSG - 1);
nhUse(f2); /* what could we do if write to fd#2 (stderr) fails */
NH_abort(); /* ... and we're already in the process of quitting? */
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 hack.c $NHDT-Date: 1549231692 2019/02/03 22:08:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.207 $ */
/* NetHack 3.6 hack.c $NHDT-Date: 1551137618 2019/02/25 23:33:38 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.208 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2885,6 +2885,8 @@ const char *msg_override;
encumbrance hack for levitation--see weight_cap()) */
g.afternmv = (int NDECL((*))) 0;
(void) (*f)();
/* for finishing Armor/Boots/&c_on() */
update_inventory();
}
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1548695445 2019/01/28 17:10:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.234 $ */
/* NetHack 3.6 objnam.c $NHDT-Date: 1551138256 2019/02/25 23:44:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.235 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1029,7 +1029,12 @@ unsigned doname_flags;
case ARMOR_CLASS:
if (obj->owornmask & W_ARMOR)
Strcat(bp, (obj == uskin) ? " (embedded in your skin)"
: " (being worn)");
/* in case of perm_invent update while Wear/Takeoff
is in progress; check doffing() before donning()
because donning() returns True for both cases */
: doffing(obj) ? " (being doffed)"
: donning(obj) ? " (being donned)"
: " (being worn)");
/*FALLTHRU*/
case WEAPON_CLASS:
if (ispoisoned)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1546657409 2019/01/05 03:03:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.351 $ */
/* NetHack 3.6 options.c $NHDT-Date: 1551222973 2019/02/26 23:16:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.356 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2008. */
/* NetHack may be freely redistributed. See license for details. */
@@ -29,6 +29,7 @@ NEARDATA struct instance_flags iflags; /* provide linkage */
#ifdef CURSES_GRAPHICS
extern int curses_read_attrs(char *attrs);
extern char *curses_fmt_attrs(char *);
#endif
enum window_option_types {
@@ -131,9 +132,9 @@ static const struct Bool_Opt {
{ "flush", (boolean *) 0, FALSE, SET_IN_FILE },
#endif
{ "force_invmenu", &iflags.force_invmenu, FALSE, SET_IN_GAME },
{ "fullscreen", &iflags.wc2_fullscreen, FALSE, SET_IN_FILE },
{ "fullscreen", &iflags.wc2_fullscreen, FALSE, SET_IN_FILE }, /*WC2*/
{ "goldX", &iflags.goldX, FALSE, SET_IN_GAME },
{ "guicolor", &iflags.wc2_guicolor, TRUE, SET_IN_GAME},
{ "guicolor", &iflags.wc2_guicolor, TRUE, SET_IN_GAME}, /*WC2*/
{ "help", &flags.help, TRUE, SET_IN_GAME },
{ "herecmd_menu", &iflags.herecmd_menu, FALSE, SET_IN_GAME },
{ "hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME }, /*WC*/
@@ -209,7 +210,7 @@ static const struct Bool_Opt {
{ "showscore", (boolean *) 0, FALSE, SET_IN_FILE },
#endif
{ "silent", &flags.silent, TRUE, SET_IN_GAME },
{ "softkeyboard", &iflags.wc2_softkeyboard, FALSE, SET_IN_FILE },
{ "softkeyboard", &iflags.wc2_softkeyboard, FALSE, SET_IN_FILE }, /*WC2*/
{ "sortpack", &flags.sortpack, TRUE, SET_IN_GAME },
{ "sparkle", &flags.sparkle, TRUE, SET_IN_GAME },
{ "splash_screen", &iflags.wc_splash_screen, TRUE, DISP_IN_GAME }, /*WC*/
@@ -228,7 +229,7 @@ static const struct Bool_Opt {
#ifdef DEBUG
{ "travel_debug", &iflags.trav_debug, FALSE, SET_IN_WIZGAME }, /*hack.c*/
#endif
{ "use_darkgray", &iflags.wc2_darkgray, TRUE, SET_IN_FILE },
{ "use_darkgray", &iflags.wc2_darkgray, TRUE, SET_IN_FILE }, /*WC2*/
#ifdef WIN32
{ "use_inverse", &iflags.wc_inverse, TRUE, SET_IN_GAME }, /*WC*/
#else
@@ -243,7 +244,7 @@ static const struct Bool_Opt {
{ "whatis_menu", &iflags.getloc_usemenu, FALSE, SET_IN_GAME },
{ "whatis_moveskip", &iflags.getloc_moveskip, FALSE, SET_IN_GAME },
{ "wizweight", &iflags.wizweight, FALSE, SET_IN_WIZGAME },
{ "wraptext", &iflags.wc2_wraptext, FALSE, SET_IN_GAME },
{ "wraptext", &iflags.wc2_wraptext, FALSE, SET_IN_GAME }, /*WC2*/
#ifdef ZEROCOMP
{ "zerocomp", &iflags.zerocomp,
#if defined(COMPRESS) || defined(ZLIB_COMP)
@@ -344,19 +345,18 @@ static struct Comp_Opt {
#ifdef CHANGE_COLOR
{ "palette",
#ifndef WIN32
"palette (00c/880/-fff is blue/yellow/reverse white)", 15,
SET_IN_GAME },
"palette (00c/880/-fff is blue/yellow/reverse white)", 15, SET_IN_GAME
#else
"palette (adjust an RGB color in palette (color-R-G-B)", 15,
SET_IN_FILE },
"palette (adjust an RGB color in palette (color-R-G-B)", 15, SET_IN_FILE
#endif
},
#if defined(MAC)
{ "hicolor", "same as palette, only order is reversed", 15, SET_IN_FILE },
#endif
#endif
{ "paranoid_confirmation", "extra prompting in certain situations", 28,
SET_IN_GAME },
{ "petattr", "attributes for highlighting pets", 12, SET_IN_FILE },
{ "petattr", "attributes for highlighting pets", 88, SET_IN_GAME },
{ "pettype", "your preferred initial pet type", 4, DISP_IN_GAME },
{ "pickup_burden", "maximum burden picked up before prompt", 20,
SET_IN_GAME },
@@ -409,6 +409,9 @@ static struct Comp_Opt {
#endif
{ "suppress_alert", "suppress alerts about version-specific features", 8,
SET_IN_GAME },
/* term_cols,term_rows -> WC2_TERM_SIZE (6: room to format 1..32767) */
{ "term_cols", "number of columns", 6, SET_IN_FILE }, /*WC2*/
{ "term_rows", "number of rows", 6, SET_IN_FILE }, /*WC2*/
{ "tile_width", "width of tiles", 20, DISP_IN_GAME }, /*WC*/
{ "tile_height", "height of tiles", 20, DISP_IN_GAME }, /*WC*/
{ "tile_file", "name of tile file", 70, DISP_IN_GAME }, /*WC*/
@@ -430,6 +433,7 @@ static struct Comp_Opt {
{ "whatis_filter",
"filter coordinate locations when targeting next or previous",
1, SET_IN_GAME },
{ "windowborders", "1 (on), 2 (off), 3 (auto)", 9, DISP_IN_GAME }, /*WC2*/
{ "windowcolors", "the foreground/background colors of windows", /*WC*/
80, DISP_IN_GAME },
{ "windowtype", "windowing system to use", WINTYPELEN, DISP_IN_GAME },
@@ -440,7 +444,7 @@ static struct Comp_Opt {
{ "DECgraphics", "load DECGraphics display symbols", 70, SET_IN_FILE },
{ "IBMgraphics", "load IBMGraphics display symbols", 70, SET_IN_FILE },
#ifdef CURSES_GRAPHICS
{"cursesgraphics", "load curses display symbols", 70, SET_IN_FILE},
{ "cursesgraphics", "load curses display symbols", 70, SET_IN_FILE },
#endif
#ifdef MAC_GRAPHICS_ENV
{ "Macgraphics", "load MACGraphics display symbols", 70, SET_IN_FILE },
@@ -3315,6 +3319,7 @@ boolean tinitial, tfrom_file;
return retval;
}
#endif /* VIDEOSHADES */
#ifdef MSDOS
#ifdef NO_TERMS
/* video:string -- must be after longer tests */
@@ -3437,8 +3442,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else {
#if defined(WIN32)
} else {
op = string_for_opt(opts, 0);
if (!op)
return FALSE;
@@ -3583,29 +3588,34 @@ boolean tinitial, tfrom_file;
}
return retval;
}
#ifdef CURSES_GRAPHICS
/* WINCAP2
* term_cols:amount */
* term_cols:amount or term_rows:amount */
fullname = "term_cols";
if (match_optname(opts, fullname, sizeof "term_cols" - 1, TRUE)) {
op = string_for_opt(opts, negated);
iflags.wc2_term_cols = atoi(op);
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
}
return retval;
}
if (match_optname(opts, fullname, 8, TRUE)
/* alternate spelling */
|| match_optname(opts, "term_columns", 9, TRUE)
/* different option but identical handlng */
|| (fullname = "term_rows", match_optname(opts, fullname, 8, TRUE))) {
long ltmp;
/* WINCAP2
* term_rows:amount */
fullname = "term_rows";
if (match_optname(opts, fullname, sizeof "term_rows" - 1, TRUE)) {
op = string_for_opt(opts, negated);
iflags.wc2_term_rows = atoi(op);
ltmp = atol(op);
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
retval = FALSE;
/* this just checks atol() sanity, not logical window size sanity */
} else if (ltmp <= 0L || ltmp >= (long) LARGEST_INT) {
config_error_add("Invalid %s: %ld", fullname, ltmp);
retval = FALSE;
} else {
if (!strcmp(fullname, "term_rows"))
iflags.wc2_term_rows = (int) ltmp;
else /* !strcmp(fullname, "term_cols") */
iflags.wc2_term_cols = (int) ltmp;
}
return retval;
}
@@ -3615,22 +3625,31 @@ boolean tinitial, tfrom_file;
fullname = "petattr";
if (match_optname(opts, fullname, sizeof "petattr" - 1, TRUE)) {
op = string_for_opt(opts, negated);
if (op && !negated) {
if (op && negated) {
bad_negation(fullname, TRUE);
retval = FALSE;
} else if (op) {
#ifdef CURSES_GRAPHICS
iflags.wc2_petattr = curses_read_attrs(op);
if (!curses_read_attrs(op)) {
int itmp = curses_read_attrs(op);
if (itmp == -1) {
config_error_add("Unknown %s parameter '%s'", fullname, opts);
return FALSE;
}
retval = FALSE;
} else
iflags.wc2_petattr = itmp;
#else
/* non-curses windowports will not use this flag anyway
* but the above will not compile if we don't have curses.
* Just set it to a sensible default: */
iflags.wc2_petattr = ATR_INVERSE
iflags.wc2_petattr = ATR_INVERSE;
#endif
} else if (negated) {
bad_negation(fullname, TRUE);
return FALSE;
iflags.wc2_petattr = ATR_NONE;
}
if (retval) {
iflags.hilite_pet = (iflags.wc2_petattr != ATR_NONE);
if (!initial)
g.opt_need_redraw = TRUE;
}
return retval;
}
@@ -3638,28 +3657,31 @@ boolean tinitial, tfrom_file;
/* WINCAP2
* windowborders:n */
fullname = "windowborders";
if (match_optname(opts, fullname, sizeof "windowborders" - 1, TRUE)) {
if (match_optname(opts, fullname, 10, TRUE)) {
op = string_for_opt(opts, negated);
if (negated && op) {
bad_negation(fullname, TRUE);
return FALSE;
retval = FALSE;
} else {
int itmp;
if (negated)
iflags.wc2_windowborders = 2; /* Off */
itmp = 2; /* Off */
else if (!op)
iflags.wc2_windowborders = 1; /* On */
else /* Value supplied */
iflags.wc2_windowborders = atoi(op);
if ((iflags.wc2_windowborders > 3)
|| (iflags.wc2_windowborders < 1)) {
iflags.wc2_windowborders = 0;
config_error_add("Badoption - windowborders %s.", opts);
return FALSE;
itmp = 1; /* On */
else /* Value supplied; expect 1 (on), 2 (off), or 3 (auto) */
itmp = atoi(op);
if (itmp < 1 || itmp > 3) {
config_error_add("Invalid %s: %s.", fullname, opts);
retval = FALSE;
} else {
iflags.wc2_windowborders = itmp;
}
}
return retval;
}
#endif
#endif /* CURSES_GRAPHICS */
/* menustyle:traditional or combination or full or partial */
fullname = "menustyle";
@@ -3977,8 +3999,11 @@ boolean tinitial, tfrom_file;
#endif
g.context.botl = TRUE;
} else if (boolopt[i].addr == &flags.invlet_constant) {
if (flags.invlet_constant)
if (flags.invlet_constant) {
reassign();
if (iflags.perm_invent)
g.opt_need_redraw = TRUE;
}
} else if (boolopt[i].addr == &flags.lit_corridor
|| boolopt[i].addr == &flags.dark_room) {
/*
@@ -3996,6 +4021,10 @@ boolean tinitial, tfrom_file;
|| boolopt[i].addr == &iflags.use_inverse
|| boolopt[i].addr == &iflags.hilite_pile
|| boolopt[i].addr == &iflags.hilite_pet
|| boolopt[i].addr == &iflags.perm_invent
#ifdef CURSES_GRAPHICS
|| boolopt[i].addr == &iflags.cursesgraphics
#endif
|| boolopt[i].addr == &iflags.wc_ascii_map
|| boolopt[i].addr == &iflags.wc_tiled_map) {
g.opt_need_redraw = TRUE;
@@ -4004,10 +4033,6 @@ boolean tinitial, tfrom_file;
status_initialize(REASSESS_ONLY);
g.opt_need_redraw = TRUE;
#endif
#ifdef CURSES_GRAPHICS
} else if ((boolopt[i].addr) == &iflags.cursesgraphics) {
g.opt_need_redraw = TRUE;
#endif
#ifdef TEXTCOLOR
} else if (boolopt[i].addr == &iflags.use_color) {
g.opt_need_redraw = TRUE;
@@ -5576,6 +5601,18 @@ char *buf;
if (flags.paranoia_bits & paranoia[i].flagmask)
Sprintf(eos(tmpbuf), " %s", paranoia[i].argname);
Strcpy(buf, tmpbuf[0] ? &tmpbuf[1] : "none");
} else if (!strcmp(optname, "petattr")) {
#ifdef CURSES_GRAPHICS
if (WINDOWPORT("curses")) {
char tmpbuf[QBUFSZ];
Strcpy(buf, curses_fmt_attrs(tmpbuf));
} else
#endif
if (iflags.wc2_petattr != 0)
Sprintf(buf, "0x%08x", iflags.wc2_petattr);
else
Strcpy(buf, defopt);
} else if (!strcmp(optname, "pettype")) {
Sprintf(buf, "%s", (g.preferred_pet == 'c') ? "cat"
: (g.preferred_pet == 'd') ? "dog"
@@ -5658,7 +5695,6 @@ char *buf;
g.symset[PRIMARY].name ? g.symset[PRIMARY].name : "default");
if (g.currentgraphics == PRIMARY && g.symset[PRIMARY].name)
Strcat(buf, ", active");
#ifdef CURSES_GRAPHICS
} else if (!strcmp(optname, "term_cols")) {
if (iflags.wc2_term_cols)
Sprintf(buf, "%d", iflags.wc2_term_cols);
@@ -5666,10 +5702,9 @@ char *buf;
Strcpy(buf, defopt);
} else if (!strcmp(optname, "term_rows")) {
if (iflags.wc2_term_rows)
Sprintf(buf, "%d",iflags.wc2_term_rows);
Sprintf(buf, "%d", iflags.wc2_term_rows);
else
Strcpy(buf, defopt);
#endif
} else if (!strcmp(optname, "tile_file")) {
Sprintf(buf, "%s",
iflags.wc_tile_file ? iflags.wc_tile_file : defopt);
@@ -6417,9 +6452,11 @@ static struct wc_Opt wc2_options[] = {
{ "status hilite rules", WC2_HILITE_STATUS },
/* statushilites doesn't have its own bit */
{ "statushilites", WC2_HILITE_STATUS },
#ifdef CURSES_GRAPHICS
{"windowborders", WC2_WINDOWBORDERS},
#endif
{ "term_cols", WC2_TERM_SIZE },
{ "term_rows", WC2_TERM_SIZE },
{ "petattr", WC2_PETATTR },
{ "guicolor", WC2_GUICOLOR },
{ "windowborders", WC2_WINDOWBORDERS },
{ (char *) 0, 0L }
};

View File

@@ -780,8 +780,12 @@ int mntmp;
if (is_vampire(g.youmonst.data))
pline(use_thec, monsterc, "change shape");
if (lays_eggs(g.youmonst.data) && flags.female)
pline(use_thec, "sit", "lay an egg");
if (lays_eggs(g.youmonst.data) && flags.female &&
!(g.youmonst.data == &mons[PM_GIANT_EEL]
|| g.youmonst.data == &mons[PM_ELECTRIC_EEL]))
pline(use_thec, "sit",
eggs_in_water(g.youmonst.data) ?
"spawn in the water" : "lay an egg");
}
/* you now know what an egg of your type looks like */

View File

@@ -116,12 +116,13 @@ dosit()
You("sit down.");
dotrap(trap, VIASITTING);
}
} else if (Underwater || Is_waterlevel(&u.uz)) {
} else if ((Underwater || Is_waterlevel(&u.uz))
&& !eggs_in_water(g.youmonst.data)) {
if (Is_waterlevel(&u.uz))
There("are no cushions floating nearby.");
else
You("sit down on the muddy bottom.");
} else if (is_pool(u.ux, u.uy)) {
} else if (is_pool(u.ux, u.uy) && !eggs_in_water(g.youmonst.data)) {
in_water:
You("sit in the %s.", hliquid("water"));
if (!rn2(10) && uarm)
@@ -297,8 +298,18 @@ dosit()
} else if (u.uhunger < (int) objects[EGG].oc_nutrition) {
You("don't have enough energy to lay an egg.");
return 0;
} else if (eggs_in_water(g.youmonst.data)) {
if (!(Underwater || Is_waterlevel(&u.uz))) {
pline("A splash tetra you are not.");
return 0;
}
if (Upolyd &&
(g.youmonst.data == &mons[PM_GIANT_EEL]
|| g.youmonst.data == &mons[PM_ELECTRIC_EEL])) {
You("yearn for the Sargasso Sea.");
return 0;
}
}
uegg = mksobj(EGG, FALSE, FALSE);
uegg->spe = 1;
uegg->quan = 1L;
@@ -306,7 +317,7 @@ dosit()
/* this sets hatch timers if appropriate */
set_corpsenm(uegg, egg_type_from_parent(u.umonnum, FALSE));
uegg->known = uegg->dknown = 1;
You("lay an egg.");
You("%s an egg.", eggs_in_water(g.youmonst.data) ? "spawn" : "lay");
dropy(uegg);
stackobj(uegg);
morehungry((int) objects[EGG].oc_nutrition);