Merge remote-tracking branch 'origin/NetHack-3.6.0'
This commit is contained in:
13
src/botl.c
13
src/botl.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 botl.c $NHDT-Date: 1452660188 2016/01/13 04:43:08 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.70 $ */
|
||||
/* NetHack 3.6 botl.c $NHDT-Date: 1469930895 2016/07/31 02:08:15 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.75 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1311,17 +1311,18 @@ boolean from_configfile;
|
||||
/* Now finally, we notify the window port */
|
||||
if (!from_configfile)
|
||||
status_threshold(idx, status_hilites[idx].anytype,
|
||||
status_hilites[idx].threshold,
|
||||
status_hilites[idx].behavior,
|
||||
status_hilites[idx].coloridx[0],
|
||||
status_hilites[idx].coloridx[1]);
|
||||
status_hilites[idx].threshold,
|
||||
status_hilites[idx].behavior,
|
||||
status_hilites[idx].coloridx[0],
|
||||
status_hilites[idx].coloridx[1]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*ARGUSED*/
|
||||
void
|
||||
status_notify_windowport(all)
|
||||
boolean all;
|
||||
boolean all UNUSED;
|
||||
{
|
||||
int idx;
|
||||
anything it;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 dungeon.c $NHDT-Date: 1462486971 2016/05/05 22:22:51 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.73 $ */
|
||||
/* NetHack 3.6 dungeon.c $NHDT-Date: 1470275509 2016/08/04 01:51:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.76 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -2864,7 +2864,9 @@ boolean printdun;
|
||||
Sprintf(eos(buf), " \"%s\"", mptr->custom);
|
||||
if (on_level(&u.uz, &mptr->lev))
|
||||
Sprintf(eos(buf), " <- You %s here.",
|
||||
(!final || (final == 1 && how == ASCENDED)) ? "are" : "were");
|
||||
(!final || (final == 1 && how == ASCENDED)) ? "are"
|
||||
: (final == 1 && how == ESCAPED) ? "left from"
|
||||
: "were");
|
||||
putstr(win, !final ? ATR_BOLD : 0, buf);
|
||||
|
||||
if (mptr->flags.forgot)
|
||||
|
||||
33
src/eat.c
33
src/eat.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 eat.c $NHDT-Date: 1467028559 2016/06/27 11:55:59 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.171 $ */
|
||||
/* NetHack 3.6 eat.c $NHDT-Date: 1470272344 2016/08/04 00:59:04 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.172 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1662,22 +1662,33 @@ struct obj *otmp;
|
||||
} else if (mnum == PM_FLOATING_EYE && u.umonnum == PM_RAVEN) {
|
||||
You("peck the eyeball with delight.");
|
||||
} else {
|
||||
/* [is this right? omnivores end up always disliking the taste] */
|
||||
boolean yummy = vegan(&mons[mnum])
|
||||
? (!carnivorous(youmonst.data)
|
||||
&& herbivorous(youmonst.data))
|
||||
: (carnivorous(youmonst.data)
|
||||
&& !herbivorous(youmonst.data));
|
||||
/* yummy is always False for omnivores, palatable always True */
|
||||
boolean yummy = (vegan(&mons[mnum])
|
||||
? (!carnivorous(youmonst.data)
|
||||
&& herbivorous(youmonst.data))
|
||||
: (carnivorous(youmonst.data)
|
||||
&& !herbivorous(youmonst.data))),
|
||||
palatable = (vegetarian(&mons[mnum])
|
||||
? herbivorous(youmonst.data)
|
||||
: carnivorous(youmonst.data));
|
||||
const char *pmxnam = food_xname(otmp, FALSE);
|
||||
|
||||
if (!strncmpi(pmxnam, "the ", 4))
|
||||
pmxnam += 4;
|
||||
pline("%s%s %s!",
|
||||
type_is_pname(&mons[mnum])
|
||||
? "" : the_unique_pm(&mons[mnum]) ? "The " : "This ",
|
||||
food_xname(otmp, FALSE),
|
||||
? "" : the_unique_pm(&mons[mnum]) ? "The " : "This ",
|
||||
pmxnam,
|
||||
/* tiger reference is to TV ads for "Frosted Flakes",
|
||||
breakfast cereal targeted at kids by "Tony the tiger" */
|
||||
Hallucination
|
||||
? (yummy ? ((u.umonnum == PM_TIGER) ? "is gr-r-reat"
|
||||
: "is gnarly")
|
||||
: "is grody")
|
||||
: (yummy ? "is delicious" : "tastes terrible"));
|
||||
: palatable ? "is copacetic"
|
||||
: "is grody")
|
||||
: (yummy ? "tastes delicious"
|
||||
: palatable ? "tastes okay"
|
||||
: "tastes terrible"));
|
||||
}
|
||||
|
||||
return retcode;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 mhitm.c $NHDT-Date: 1456992461 2016/03/03 08:07:41 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.86 $ */
|
||||
/* NetHack 3.6 mhitm.c $NHDT-Date: 1470819842 2016/08/10 09:04:02 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.92 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1522,7 +1522,7 @@ int mdead;
|
||||
goto assess_dmg;
|
||||
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
|
||||
if (mhit && !mdef->mcan && otmp) {
|
||||
(void) drain_item(otmp);
|
||||
(void) drain_item(otmp, FALSE);
|
||||
/* No message */
|
||||
}
|
||||
break;
|
||||
|
||||
28
src/mhitu.c
28
src/mhitu.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 mhitu.c $NHDT-Date: 1456992469 2016/03/03 08:07:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.136 $ */
|
||||
/* NetHack 3.6 mhitu.c $NHDT-Date: 1470819843 2016/08/10 09:04:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.144 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1597,7 +1597,27 @@ register struct attack *mattk;
|
||||
if (uncancelled) {
|
||||
struct obj *obj = some_armor(&youmonst);
|
||||
|
||||
if (drain_item(obj)) {
|
||||
if (!obj) {
|
||||
/* some rings are susceptible;
|
||||
amulets and blindfolds aren't (at present) */
|
||||
switch (rn2(5)) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
obj = uright;
|
||||
break;
|
||||
case 2:
|
||||
obj = uleft;
|
||||
break;
|
||||
case 3:
|
||||
obj = uamul;
|
||||
break;
|
||||
case 4:
|
||||
obj = ublindf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (drain_item(obj, FALSE)) {
|
||||
pline("%s less effective.", Yobjnam2(obj, "seem"));
|
||||
}
|
||||
}
|
||||
@@ -2691,7 +2711,9 @@ register struct attack *mattk;
|
||||
}
|
||||
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
|
||||
if (otmp) {
|
||||
(void) drain_item(otmp);
|
||||
/* by_you==True: passive counterattack to hero's action
|
||||
is hero's fault */
|
||||
(void) drain_item(otmp, TRUE);
|
||||
/* No message */
|
||||
}
|
||||
return 1;
|
||||
|
||||
82
src/mkmaze.c
82
src/mkmaze.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1461571093 2016/04/25 07:58:13 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.47 $ */
|
||||
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1469930897 2016/07/31 02:08:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.50 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -47,7 +47,7 @@ STATIC_OVL int
|
||||
iswall(x, y)
|
||||
int x, y;
|
||||
{
|
||||
register int type;
|
||||
int type;
|
||||
|
||||
if (!isok(x, y))
|
||||
return 0;
|
||||
@@ -132,7 +132,7 @@ wall_cleanup(x1, y1, x2, y2)
|
||||
int x1, y1, x2, y2;
|
||||
{
|
||||
uchar type;
|
||||
register int x, y;
|
||||
int x, y;
|
||||
struct rm *lev;
|
||||
|
||||
/* sanity check on incoming variables */
|
||||
@@ -164,7 +164,7 @@ fix_wall_spines(x1, y1, x2, y2)
|
||||
int x1, y1, x2, y2;
|
||||
{
|
||||
uchar type;
|
||||
register int x,y;
|
||||
int x, y;
|
||||
struct rm *lev;
|
||||
int FDECL((*loc_f), (int, int));
|
||||
int bits;
|
||||
@@ -232,7 +232,7 @@ int x1, y1, x2, y2;
|
||||
STATIC_OVL boolean
|
||||
okay(x, y, dir)
|
||||
int x, y;
|
||||
register int dir;
|
||||
int dir;
|
||||
{
|
||||
mz_move(x, y, dir);
|
||||
mz_move(x, y, dir);
|
||||
@@ -466,9 +466,9 @@ static boolean was_waterlevel; /* ugh... this shouldn't be needed */
|
||||
void
|
||||
fixup_special()
|
||||
{
|
||||
register lev_region *r = lregions;
|
||||
lev_region *r = lregions;
|
||||
struct d_level lev;
|
||||
register int x, y;
|
||||
int x, y;
|
||||
struct mkroom *croom;
|
||||
boolean added_branch = FALSE;
|
||||
|
||||
@@ -606,7 +606,7 @@ fixup_special()
|
||||
|
||||
create_secret_door(croom, W_ANY);
|
||||
} else if (on_level(&u.uz, &orcus_level)) {
|
||||
register struct monst *mtmp, *mtmp2;
|
||||
struct monst *mtmp, *mtmp2;
|
||||
|
||||
/* it's a ghost town, get rid of shopkeepers */
|
||||
for (mtmp = fmon; mtmp; mtmp = mtmp2) {
|
||||
@@ -631,7 +631,7 @@ fixup_special()
|
||||
|
||||
void
|
||||
makemaz(s)
|
||||
register const char *s;
|
||||
const char *s;
|
||||
{
|
||||
int x, y;
|
||||
char protofile[20];
|
||||
@@ -850,7 +850,7 @@ walkfrom(x, y, typ)
|
||||
int x, y;
|
||||
schar typ;
|
||||
{
|
||||
register int q, a, dir;
|
||||
int q, a, dir;
|
||||
int dirs[4];
|
||||
|
||||
if (!typ) {
|
||||
@@ -898,7 +898,8 @@ coord *cc;
|
||||
&& levl[cc->x][cc->y].typ
|
||||
!= (level.flags.corrmaze ? CORR : ROOM));
|
||||
if (cpt >= 100) {
|
||||
register int x, y;
|
||||
int x, y;
|
||||
|
||||
/* last try */
|
||||
for (x = 0; x < (x_maze_max >> 1) - 1; x++)
|
||||
for (y = 0; y < (y_maze_max >> 1) - 1; y++) {
|
||||
@@ -926,9 +927,9 @@ coord *cc;
|
||||
void
|
||||
bound_digging()
|
||||
{
|
||||
register int x, y;
|
||||
register unsigned typ;
|
||||
register struct rm *lev;
|
||||
int x, y;
|
||||
unsigned typ;
|
||||
struct rm *lev;
|
||||
boolean found, nonwall;
|
||||
int xmin, xmax, ymin, ymax;
|
||||
|
||||
@@ -1035,8 +1036,10 @@ fumaroles()
|
||||
for (n = rn2(3) + 2; n; n--) {
|
||||
xchar x = rn1(COLNO - 4, 3);
|
||||
xchar y = rn1(ROWNO - 4, 3);
|
||||
|
||||
if (levl[x][y].typ == LAVAPOOL) {
|
||||
NhRegion *r = create_gas_cloud(x, y, 4 + rn2(5), rn1(10, 5));
|
||||
|
||||
clear_heros_fault(r);
|
||||
snd = TRUE;
|
||||
if (distu(x, y) < 15)
|
||||
@@ -1054,11 +1057,6 @@ fumaroles()
|
||||
* other source files, but they are all so nicely encapsulated here.
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
/* to ease the work of debuggers at this stage */
|
||||
#define register
|
||||
#endif
|
||||
|
||||
#define CONS_OBJ 0
|
||||
#define CONS_MON 1
|
||||
#define CONS_HERO 2
|
||||
@@ -1082,8 +1080,8 @@ void
|
||||
movebubbles()
|
||||
{
|
||||
static boolean up;
|
||||
register struct bubble *b;
|
||||
register int x, y, i, j;
|
||||
struct bubble *b;
|
||||
int x, y, i, j;
|
||||
struct trap *btrap;
|
||||
static const struct rm water_pos = { cmap_to_glyph(S_water), WATER, 0, 0,
|
||||
0, 0, 0, 0, 0, 0 };
|
||||
@@ -1205,7 +1203,7 @@ movebubbles()
|
||||
*/
|
||||
up = !up;
|
||||
for (b = up ? bbubbles : ebubbles; b; b = up ? b->next : b->prev) {
|
||||
register int rx = rn2(3), ry = rn2(3);
|
||||
int rx = rn2(3), ry = rn2(3);
|
||||
|
||||
mv_bubble(b, b->dx + 1 - (!b->dx ? rx : (rx ? 1 : 0)),
|
||||
b->dy + 1 - (!b->dy ? ry : (ry ? 1 : 0)), FALSE);
|
||||
@@ -1221,8 +1219,8 @@ movebubbles()
|
||||
void
|
||||
water_friction()
|
||||
{
|
||||
register int x, y, dx, dy;
|
||||
register boolean eff = FALSE;
|
||||
int x, y, dx, dy;
|
||||
boolean eff = FALSE;
|
||||
|
||||
if (Swimming && rn2(4))
|
||||
return; /* natural swimmers have advantage */
|
||||
@@ -1256,7 +1254,7 @@ void
|
||||
save_waterlevel(fd, mode)
|
||||
int fd, mode;
|
||||
{
|
||||
register struct bubble *b;
|
||||
struct bubble *b;
|
||||
|
||||
if (!Is_waterlevel(&u.uz) && !Is_airlevel(&u.uz))
|
||||
return;
|
||||
@@ -1279,11 +1277,10 @@ int fd, mode;
|
||||
|
||||
void
|
||||
restore_waterlevel(fd)
|
||||
register int fd;
|
||||
int fd;
|
||||
{
|
||||
register struct bubble *b = (struct bubble *) 0, *btmp;
|
||||
register int i;
|
||||
int n;
|
||||
struct bubble *b = (struct bubble *) 0, *btmp;
|
||||
int i, n;
|
||||
|
||||
if (!Is_waterlevel(&u.uz) && !Is_airlevel(&u.uz))
|
||||
return;
|
||||
@@ -1316,7 +1313,7 @@ const char *
|
||||
waterbody_name(x, y)
|
||||
xchar x, y;
|
||||
{
|
||||
register struct rm *lev;
|
||||
struct rm *lev;
|
||||
schar ltyp;
|
||||
|
||||
if (!isok(x, y))
|
||||
@@ -1355,10 +1352,10 @@ set_wportal()
|
||||
STATIC_OVL void
|
||||
setup_waterlevel()
|
||||
{
|
||||
register int x, y;
|
||||
register int xskip, yskip;
|
||||
register int water_glyph = cmap_to_glyph(S_water);
|
||||
register int air_glyph = cmap_to_glyph(S_air);
|
||||
int x, y;
|
||||
int xskip, yskip;
|
||||
int water_glyph = cmap_to_glyph(S_water),
|
||||
air_glyph = cmap_to_glyph(S_air);
|
||||
|
||||
/* ouch, hardcoded... */
|
||||
|
||||
@@ -1391,7 +1388,7 @@ setup_waterlevel()
|
||||
STATIC_OVL void
|
||||
unsetup_waterlevel()
|
||||
{
|
||||
register struct bubble *b, *bb;
|
||||
struct bubble *b, *bb;
|
||||
|
||||
/* free bubbles */
|
||||
|
||||
@@ -1404,7 +1401,7 @@ unsetup_waterlevel()
|
||||
|
||||
STATIC_OVL void
|
||||
mk_bubble(x, y, n)
|
||||
register int x, y, n;
|
||||
int x, y, n;
|
||||
{
|
||||
/*
|
||||
* These bit masks make visually pleasing bubbles on a normal aspect
|
||||
@@ -1413,14 +1410,15 @@ register int x, y, n;
|
||||
* in situ, either. The first two elements tell the dimensions of
|
||||
* the bubble's bounding box.
|
||||
*/
|
||||
static uchar bm2[] = { 2, 1, 0x3 }, bm3[] = { 3, 2, 0x7, 0x7 },
|
||||
static uchar bm2[] = { 2, 1, 0x3 },
|
||||
bm3[] = { 3, 2, 0x7, 0x7 },
|
||||
bm4[] = { 4, 3, 0x6, 0xf, 0x6 },
|
||||
bm5[] = { 5, 3, 0xe, 0x1f, 0xe },
|
||||
bm6[] = { 6, 4, 0x1e, 0x3f, 0x3f, 0x1e },
|
||||
bm7[] = { 7, 4, 0x3e, 0x7f, 0x7f, 0x3e },
|
||||
bm8[] = { 8, 4, 0x7e, 0xff, 0xff, 0x7e },
|
||||
*bmask[] = { bm2, bm3, bm4, bm5, bm6, bm7, bm8 };
|
||||
register struct bubble *b;
|
||||
struct bubble *b;
|
||||
|
||||
if (x >= bxmax || y >= bymax)
|
||||
return;
|
||||
@@ -1466,11 +1464,11 @@ register int x, y, n;
|
||||
*/
|
||||
STATIC_OVL void
|
||||
mv_bubble(b, dx, dy, ini)
|
||||
register struct bubble *b;
|
||||
register int dx, dy;
|
||||
register boolean ini;
|
||||
struct bubble *b;
|
||||
int dx, dy;
|
||||
boolean ini;
|
||||
{
|
||||
register int x, y, i, j, colli = 0;
|
||||
int x, y, i, j, colli = 0;
|
||||
struct container *cons, *ctemp;
|
||||
|
||||
/* clouds move slowly */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 mondata.c $NHDT-Date: 1446604115 2015/11/04 02:28:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.58 $ */
|
||||
/* NetHack 3.6 mondata.c $NHDT-Date: 1470966820 2016/08/12 01:53:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.61 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -855,16 +855,12 @@ int *mndx_p;
|
||||
if ((p = strstri(x, in_str)) != 0 && (p == x || *(p - 1) == ' '))
|
||||
return i;
|
||||
}
|
||||
/* check individual species names; not as thorough as mon_to_name()
|
||||
but our caller can call that directly if desired */
|
||||
for (i = LOW_PM; i < NUMMONS; i++) {
|
||||
x = mons[i].mname;
|
||||
if ((p = strstri(x, in_str)) != 0
|
||||
&& (p == x || *(p - 1) == ' ')) {
|
||||
if (mndx_p)
|
||||
*mndx_p = i;
|
||||
return mons[i].mlet;
|
||||
}
|
||||
/* check individual species names */
|
||||
i = name_to_mon(in_str);
|
||||
if (i != NON_PM) {
|
||||
if (mndx_p)
|
||||
*mndx_p = i;
|
||||
return mons[i].mlet;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
79
src/objnam.c
79
src/objnam.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 objnam.c $NHDT-Date: 1462067746 2016/05/01 01:55:46 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.169 $ */
|
||||
/* NetHack 3.6 objnam.c $NHDT-Date: 1471112245 2016/08/13 18:17:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.178 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -17,6 +17,7 @@ STATIC_DCL char *NDECL(nextobuf);
|
||||
STATIC_DCL void FDECL(releaseobuf, (char *));
|
||||
STATIC_DCL char *FDECL(minimal_xname, (struct obj *));
|
||||
STATIC_DCL void FDECL(add_erosion_words, (struct obj *, char *));
|
||||
STATIC_DCL char *FDECL(doname_base, (struct obj *obj, unsigned));
|
||||
STATIC_DCL boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P,
|
||||
const char *const *));
|
||||
STATIC_DCL char *FDECL(singplur_compound, (char *));
|
||||
@@ -580,7 +581,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
||||
brown potion -- if oc_name_known not set
|
||||
potion of object detection -- if discovered
|
||||
*/
|
||||
static char *
|
||||
STATIC_OVL char *
|
||||
minimal_xname(obj)
|
||||
struct obj *obj;
|
||||
{
|
||||
@@ -756,12 +757,17 @@ struct obj *obj;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static char *
|
||||
doname_base(obj, with_price)
|
||||
register struct obj *obj;
|
||||
boolean with_price;
|
||||
#define DONAME_WITH_PRICE 1
|
||||
#define DONAME_VAGUE_QUAN 2
|
||||
|
||||
STATIC_OVL char *
|
||||
doname_base(obj, doname_flags)
|
||||
struct obj *obj;
|
||||
unsigned doname_flags;
|
||||
{
|
||||
boolean ispoisoned = FALSE;
|
||||
boolean ispoisoned = FALSE,
|
||||
with_price = (doname_flags & DONAME_WITH_PRICE) != 0,
|
||||
vague_quan = (doname_flags & DONAME_VAGUE_QUAN) != 0;
|
||||
boolean known, dknown, cknown, bknown, lknown;
|
||||
int omndx = obj->corpsenm;
|
||||
char prefix[PREFIX];
|
||||
@@ -792,7 +798,7 @@ boolean with_price;
|
||||
}
|
||||
|
||||
if (obj->quan != 1L) {
|
||||
if (dknown)
|
||||
if (dknown || !vague_quan)
|
||||
Sprintf(prefix, "%ld ", obj->quan);
|
||||
else
|
||||
Strcpy(prefix, "some ");
|
||||
@@ -816,11 +822,11 @@ boolean with_price;
|
||||
making the prefix be redundant; note that 'known' flag
|
||||
isn't set when emptiness gets discovered because then
|
||||
charging magic would yield known number of new charges) */
|
||||
&& (obj->otyp == BAG_OF_TRICKS
|
||||
&& ((obj->otyp == BAG_OF_TRICKS)
|
||||
? (obj->spe == 0 && !obj->known)
|
||||
/* not bag of tricks: empty if container which has no contents */
|
||||
: (Is_container(obj) || obj->otyp == STATUE)
|
||||
&& !Has_contents(obj)))
|
||||
: ((Is_container(obj) || obj->otyp == STATUE)
|
||||
&& !Has_contents(obj))))
|
||||
Strcat(prefix, "empty ");
|
||||
|
||||
if (bknown && obj->oclass != COIN_CLASS
|
||||
@@ -872,11 +878,9 @@ boolean with_price;
|
||||
Strcat(prefix, "greased ");
|
||||
|
||||
if (cknown && Has_contents(obj)) {
|
||||
/* we count all objects (obj->quantity); perhaps we should
|
||||
count separate stacks instead (or even introduce a user
|
||||
preference option to choose between the two alternatives)
|
||||
since it's somewhat odd so see "containing 1002 items"
|
||||
when there are 2 scrolls plus 1000 gold pieces */
|
||||
/* we count the number of separate stacks, which corresponds
|
||||
to the number of inventory slots needed to be able to take
|
||||
everything out if no merges occur */
|
||||
long itemcount = count_contents(obj, FALSE, FALSE, TRUE);
|
||||
|
||||
Sprintf(eos(bp), " containing %ld item%s", itemcount,
|
||||
@@ -960,8 +964,13 @@ boolean with_price;
|
||||
if (obj->oeaten)
|
||||
Strcat(prefix, "partly eaten ");
|
||||
if (obj->otyp == CORPSE) {
|
||||
Sprintf(prefix, "%s ",
|
||||
corpse_xname(obj, prefix, CXN_ARTICLE | CXN_NOCORPSE));
|
||||
/* (quan == 1) => want corpse_xname() to supply article,
|
||||
(quan != 1) => already have count or "some" as prefix;
|
||||
"corpse" is already in the buffer returned by xname() */
|
||||
unsigned cxarg = (((obj->quan != 1L) ? 0 : CXN_ARTICLE)
|
||||
| CXN_NOCORPSE);
|
||||
|
||||
Sprintf(prefix, "%s ", corpse_xname(obj, prefix, cxarg));
|
||||
} else if (obj->otyp == EGG) {
|
||||
#if 0 /* corpses don't tell if they're stale either */
|
||||
if (known && stale_egg(obj))
|
||||
@@ -1074,23 +1083,43 @@ boolean with_price;
|
||||
|
||||
char *
|
||||
doname(obj)
|
||||
register struct obj *obj;
|
||||
struct obj *obj;
|
||||
{
|
||||
return doname_base(obj, FALSE);
|
||||
return doname_base(obj, (unsigned) 0);
|
||||
}
|
||||
|
||||
/* Name of object including price. */
|
||||
char *
|
||||
doname_with_price(obj)
|
||||
register struct obj *obj;
|
||||
struct obj *obj;
|
||||
{
|
||||
return doname_base(obj, TRUE);
|
||||
return doname_base(obj, DONAME_WITH_PRICE);
|
||||
}
|
||||
|
||||
/* "some" instead of precise quantity if obj->dknown not set */
|
||||
char *
|
||||
doname_vague_quan(obj)
|
||||
struct obj *obj;
|
||||
{
|
||||
/* Used by farlook.
|
||||
* If it hasn't been seen up close and quantity is more than one,
|
||||
* use "some" instead of the quantity: "some gold pieces" rather
|
||||
* than "25 gold pieces". This is suboptimal, to put it mildly,
|
||||
* because lookhere and pickup report the precise amount.
|
||||
* Picking the item up while blind also shows the precise amount
|
||||
* for inventory display, then dropping it while still blind leaves
|
||||
* obj->dknown unset so the count reverts to "some" for farlook.
|
||||
*
|
||||
* TODO: add obj->qknown flag for 'quantity known' on stackable
|
||||
* items; it could overlay obj->cknown since no containers stack.
|
||||
*/
|
||||
return doname_base(obj, DONAME_VAGUE_QUAN);
|
||||
}
|
||||
|
||||
/* used from invent.c */
|
||||
boolean
|
||||
not_fully_identified(otmp)
|
||||
register struct obj *otmp;
|
||||
struct obj *otmp;
|
||||
{
|
||||
/* gold doesn't have any interesting attributes [yet?] */
|
||||
if (otmp->oclass == COIN_CLASS)
|
||||
@@ -3448,14 +3477,14 @@ typfnd:
|
||||
otmp->spe = 0; /* No spinach */
|
||||
if (dead_species(mntmp, FALSE)) {
|
||||
otmp->corpsenm = NON_PM; /* it's empty */
|
||||
} else if (!(mons[mntmp].geno & G_UNIQ)
|
||||
} else if ((!(mons[mntmp].geno & G_UNIQ) || wizard)
|
||||
&& !(mvitals[mntmp].mvflags & G_NOCORPSE)
|
||||
&& mons[mntmp].cnutrit != 0) {
|
||||
otmp->corpsenm = mntmp;
|
||||
}
|
||||
break;
|
||||
case CORPSE:
|
||||
if (!(mons[mntmp].geno & G_UNIQ)
|
||||
if ((!(mons[mntmp].geno & G_UNIQ) || wizard)
|
||||
&& !(mvitals[mntmp].mvflags & G_NOCORPSE)) {
|
||||
if (mons[mntmp].msound == MS_GUARDIAN)
|
||||
mntmp = genus(mntmp, 1);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 options.c $NHDT-Date: 1461102048 2016/04/19 21:40:48 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.268 $ */
|
||||
/* NetHack 3.6 options.c $NHDT-Date: 1470357737 2016/08/05 00:42:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.279 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -500,6 +500,7 @@ static boolean initial, from_file;
|
||||
STATIC_DCL void FDECL(nmcpy, (char *, const char *, int));
|
||||
STATIC_DCL void FDECL(escapes, (const char *, char *));
|
||||
STATIC_DCL void FDECL(rejectoption, (const char *));
|
||||
STATIC_DCL void FDECL(badoptmsg, (const char *, const char *));
|
||||
STATIC_DCL void FDECL(badoption, (const char *));
|
||||
STATIC_DCL char *FDECL(string_for_opt, (char *, BOOLEAN_P));
|
||||
STATIC_DCL char *FDECL(string_for_env_opt, (const char *, char *, BOOLEAN_P));
|
||||
@@ -927,40 +928,43 @@ const char *optname;
|
||||
}
|
||||
|
||||
STATIC_OVL void
|
||||
badoption(opts)
|
||||
badoptmsg(opts, reason)
|
||||
const char *opts;
|
||||
const char *reason; /* "Bad syntax" or "Missing value" */
|
||||
{
|
||||
const char *linesplit = "";
|
||||
|
||||
if (!initial) {
|
||||
if (!strncmp(opts, "h", 1) || !strncmp(opts, "?", 1))
|
||||
option_help();
|
||||
else
|
||||
pline("Bad syntax: %s. Enter \"?g\" for help.", opts);
|
||||
pline("%s: %s. Enter \"?g\" for help.", reason, opts);
|
||||
return;
|
||||
}
|
||||
#ifdef MAC
|
||||
else
|
||||
} else {
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
linesplit = "\n";
|
||||
#endif
|
||||
if (from_file)
|
||||
raw_printf("Bad syntax in OPTIONS in %s: %s%s.\n", configfile,
|
||||
#ifdef WIN32
|
||||
"\n",
|
||||
#else
|
||||
"",
|
||||
#endif
|
||||
opts);
|
||||
raw_printf("%s in OPTIONS in %s: %s%s.\n",
|
||||
reason, configfile, linesplit, opts);
|
||||
else
|
||||
raw_printf("Bad syntax in NETHACKOPTIONS: %s%s.\n",
|
||||
#ifdef WIN32
|
||||
"\n",
|
||||
#else
|
||||
"",
|
||||
#endif
|
||||
opts);
|
||||
raw_printf("%s in NETHACKOPTIONS: %s%s.\n",
|
||||
reason, linesplit, opts);
|
||||
wait_synch();
|
||||
}
|
||||
|
||||
STATIC_OVL void
|
||||
badoption(opts)
|
||||
const char *opts;
|
||||
{
|
||||
badoptmsg(opts, "Bad syntax");
|
||||
}
|
||||
|
||||
STATIC_OVL char *
|
||||
string_for_opt(opts, val_optional)
|
||||
char *opts;
|
||||
@@ -975,7 +979,7 @@ boolean val_optional;
|
||||
|
||||
if (!colon || !*++colon) {
|
||||
if (!val_optional)
|
||||
badoption(opts);
|
||||
badoptmsg(opts, "Missing value");
|
||||
return (char *) 0;
|
||||
}
|
||||
return colon;
|
||||
@@ -2700,7 +2704,9 @@ boolean tinitial, tfrom_file;
|
||||
bad_negation(fullname, FALSE);
|
||||
if (duplicate || negated)
|
||||
return;
|
||||
op = string_for_opt(opts, TRUE);
|
||||
op = string_for_opt(opts, FALSE);
|
||||
if (!op)
|
||||
return;
|
||||
if (!strncmpi(op, "normal", 6) || !strcmpi(op, "play")) {
|
||||
wizard = discover = FALSE;
|
||||
} else if (!strncmpi(op, "explore", 6)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 pager.c $NHDT-Date: 1466638086 2016/06/22 23:28:06 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.111 $ */
|
||||
/* NetHack 3.6 pager.c $NHDT-Date: 1471112245 2016/08/13 18:17:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.112 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -203,7 +203,7 @@ int x, y, glyph;
|
||||
|
||||
if (otmp) {
|
||||
Strcpy(buf, (otmp->otyp != STRANGE_OBJECT)
|
||||
? distant_name(otmp, doname)
|
||||
? distant_name(otmp, doname_vague_quan)
|
||||
: obj_descr[STRANGE_OBJECT].oc_name);
|
||||
if (fakeobj)
|
||||
dealloc_obj(otmp), otmp = 0;
|
||||
|
||||
48
src/pickup.c
48
src/pickup.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 pickup.c $NHDT-Date: 1461919368 2016/04/29 08:42:48 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.177 $ */
|
||||
/* NetHack 3.6 pickup.c $NHDT-Date: 1470449858 2016/08/06 02:17:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.184 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -21,7 +21,7 @@ STATIC_DCL boolean FDECL(all_but_uchain, (struct obj *));
|
||||
#if 0 /* not used */
|
||||
STATIC_DCL boolean FDECL(allow_cat_no_uchain, (struct obj *));
|
||||
#endif
|
||||
STATIC_DCL boolean FDECL(autopick_testobj, (struct obj *));
|
||||
STATIC_DCL boolean FDECL(autopick_testobj, (struct obj *, BOOLEAN_P));
|
||||
STATIC_DCL int FDECL(autopick, (struct obj *, int, menu_item **));
|
||||
STATIC_DCL int FDECL(count_categories, (struct obj *, int));
|
||||
STATIC_DCL long FDECL(carry_count, (struct obj *, struct obj *, long,
|
||||
@@ -685,30 +685,42 @@ boolean grab; /* forced pickup, rather than forced leave behind? */
|
||||
/*
|
||||
* Does the text description of this match an exception?
|
||||
*/
|
||||
char *objdesc = makesingular(doname(obj));
|
||||
struct autopickup_exception
|
||||
*ape = (grab) ? iflags.autopickup_exceptions[AP_GRAB]
|
||||
: iflags.autopickup_exceptions[AP_LEAVE];
|
||||
|
||||
while (ape) {
|
||||
if (regex_match(objdesc, ape->regex))
|
||||
return TRUE;
|
||||
ape = ape->next;
|
||||
if (ape) {
|
||||
char *objdesc = makesingular(doname(obj));
|
||||
|
||||
while (ape) {
|
||||
if (regex_match(objdesc, ape->regex))
|
||||
return TRUE;
|
||||
ape = ape->next;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
boolean
|
||||
autopick_testobj(otmp)
|
||||
STATIC_OVL boolean
|
||||
autopick_testobj(otmp, calc_costly)
|
||||
struct obj *otmp;
|
||||
boolean calc_costly;
|
||||
{
|
||||
static boolean costly = FALSE;
|
||||
const char *otypes = flags.pickup_types;
|
||||
/* pick if in pickup_types and not unpaid item in shop */
|
||||
boolean pickit = ((!*otypes || index(otypes, otmp->oclass))
|
||||
&& !(otmp->where == OBJ_FLOOR
|
||||
&& !otmp->no_charge
|
||||
&& isok(otmp->ox, otmp->oy)
|
||||
&& costly_spot(otmp->ox, otmp->oy)));
|
||||
boolean pickit;
|
||||
|
||||
/* calculate 'costly' just once for a given autopickup operation */
|
||||
if (calc_costly)
|
||||
costly = (otmp->where == OBJ_FLOOR
|
||||
&& costly_spot(otmp->ox, otmp->oy));
|
||||
|
||||
/* first check: reject if an unpaid item in a shop */
|
||||
if (costly && !otmp->no_charge)
|
||||
return FALSE;
|
||||
|
||||
/* check for pickup_types */
|
||||
pickit = (!*otypes || index(otypes, otmp->oclass));
|
||||
/* check for "always pick up */
|
||||
if (!pickit)
|
||||
pickit = is_autopickup_exception(otmp, TRUE);
|
||||
@@ -737,17 +749,19 @@ menu_item **pick_list; /* list of objects and counts to pick up */
|
||||
menu_item *pi; /* pick item */
|
||||
struct obj *curr;
|
||||
int n;
|
||||
boolean check_costly = TRUE;
|
||||
|
||||
/* first count the number of eligible items */
|
||||
for (n = 0, curr = olist; curr; curr = FOLLOW(curr, follow)) {
|
||||
if (autopick_testobj(curr))
|
||||
if (autopick_testobj(curr, check_costly))
|
||||
++n;
|
||||
check_costly = FALSE; /* only need to check once per autopickup */
|
||||
}
|
||||
|
||||
if (n) {
|
||||
*pick_list = pi = (menu_item *) alloc(sizeof (menu_item) * n);
|
||||
for (n = 0, curr = olist; curr; curr = FOLLOW(curr, follow)) {
|
||||
if (autopick_testobj(curr)) {
|
||||
if (autopick_testobj(curr, FALSE)) {
|
||||
pi[n].item.a_obj = curr;
|
||||
pi[n].count = curr->quan;
|
||||
n++;
|
||||
|
||||
10
src/uhitm.c
10
src/uhitm.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 uhitm.c $NHDT-Date: 1460103141 2016/04/08 08:12:21 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.156 $ */
|
||||
/* NetHack 3.6 uhitm.c $NHDT-Date: 1470819843 2016/08/10 09:04:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.164 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -2537,12 +2537,12 @@ boolean wep_was_destroyed;
|
||||
*/
|
||||
void
|
||||
passive_obj(mon, obj, mattk)
|
||||
register struct monst *mon;
|
||||
register struct obj *obj; /* null means pick uwep, uswapwep or uarmg */
|
||||
struct monst *mon;
|
||||
struct obj *obj; /* null means pick uwep, uswapwep or uarmg */
|
||||
struct attack *mattk; /* null means we find one internally */
|
||||
{
|
||||
struct permonst *ptr = mon->data;
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
/* if caller hasn't specified an object, use uwep, uswapwep or uarmg */
|
||||
if (!obj) {
|
||||
@@ -2589,7 +2589,7 @@ struct attack *mattk; /* null means we find one internally */
|
||||
break;
|
||||
case AD_ENCH:
|
||||
if (!mon->mcan) {
|
||||
if (drain_item(obj) && carried(obj)
|
||||
if (drain_item(obj, TRUE) && carried(obj)
|
||||
&& (obj->known || obj->oclass == ARMOR_CLASS)) {
|
||||
pline("%s less effective.", Yobjnam2(obj, "seem"));
|
||||
}
|
||||
|
||||
21
src/zap.c
21
src/zap.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 zap.c $NHDT-Date: 1464163779 2016/05/25 08:09:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.258 $ */
|
||||
/* NetHack 3.6 zap.c $NHDT-Date: 1470819844 2016/08/10 09:04:04 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.263 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1062,8 +1062,9 @@ register struct obj *obj;
|
||||
* possibly carried by you or a monster
|
||||
*/
|
||||
boolean
|
||||
drain_item(obj)
|
||||
register struct obj *obj;
|
||||
drain_item(obj, by_you)
|
||||
struct obj *obj;
|
||||
boolean by_you;
|
||||
{
|
||||
boolean u_ring;
|
||||
|
||||
@@ -1078,7 +1079,8 @@ register struct obj *obj;
|
||||
return FALSE;
|
||||
|
||||
/* Charge for the cost of the object */
|
||||
costly_alteration(obj, COST_DRAIN);
|
||||
if (by_you)
|
||||
costly_alteration(obj, COST_DRAIN);
|
||||
|
||||
/* Drain the object and any implied effects */
|
||||
obj->spe--;
|
||||
@@ -1110,6 +1112,10 @@ register struct obj *obj;
|
||||
if ((obj->owornmask & W_RING) && u_ring)
|
||||
u.udaminc--;
|
||||
break;
|
||||
case RIN_PROTECTION:
|
||||
if (u_ring)
|
||||
context.botl = 1; /* bot() will recalc u.uac */
|
||||
break;
|
||||
case HELM_OF_BRILLIANCE:
|
||||
if ((obj->owornmask & W_ARMH) && (obj == uarmh)) {
|
||||
ABON(A_INT)--;
|
||||
@@ -1123,10 +1129,11 @@ register struct obj *obj;
|
||||
context.botl = 1;
|
||||
}
|
||||
break;
|
||||
case RIN_PROTECTION:
|
||||
context.botl = 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (context.botl)
|
||||
bot();
|
||||
if (carried(obj))
|
||||
update_inventory();
|
||||
return TRUE;
|
||||
@@ -1935,7 +1942,7 @@ struct obj *obj, *otmp;
|
||||
#endif
|
||||
break;
|
||||
case SPE_DRAIN_LIFE:
|
||||
(void) drain_item(obj);
|
||||
(void) drain_item(obj, TRUE);
|
||||
break;
|
||||
case WAN_TELEPORTATION:
|
||||
case SPE_TELEPORT_AWAY:
|
||||
|
||||
Reference in New Issue
Block a user