Merge branch 'master' into win32-x64-working

Conflicts:
	src/dig.c
	src/mkobj.c

 Changes to be committed:
	modified:   src/dig.c
	modified:   src/mkobj.c
This commit is contained in:
nhmall
2015-05-03 20:53:04 -04:00
2 changed files with 30 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 dig.c $NHDT-Date: 1426465434 2015/03/16 00:23:54 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.73 $ */
/* NetHack 3.5 dig.c $NHDT-Date: 1430697288 2015/05/03 23:54:48 $ $NHDT-Branch: master $:$NHDT-Revision: 1.86 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1861,6 +1861,10 @@ long timeout; /* unused */
setmnotwielded(obj->ocarry,obj);
MON_NOWEP(obj->ocarry);
}
} else if (obj->where == OBJ_MIGRATING) {
/* clear destination flag so that obfree()'s check for
freeing a worn object doesn't get a false hit */
obj->owornmask = 0L;
}
rot_organic(arg, timeout);
if (on_floor) {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 mkobj.c $NHDT-Date: 1430559882 2015/05/02 09:44:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.96 $ */
/* NetHack 3.5 mkobj.c $NHDT-Date: 1430697424 2015/05/03 23:57:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.97 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2031,9 +2031,12 @@ const char *mesg;
switch (obj->where) {
case OBJ_INVENT:
case OBJ_MINVENT:
case OBJ_MIGRATING:
sanity_check_worn(obj);
break;
case OBJ_MIGRATING:
/* migrating objects overload the owornmask field
with a destination code; skip attempt to check it */
break;
case OBJ_FLOOR:
/* note: ball and chain can also be OBJ_FREE, but not across
turns so this sanity check shouldn't encounter that */
@@ -2179,6 +2182,7 @@ struct obj *obj;
/* [W_ART,W_ARTI are property bits for items which aren't worn] */
};
char maskbuf[60];
const char *what;
unsigned long owornmask, allmask = 0L;
int i, n = 0;
@@ -2211,8 +2215,7 @@ struct obj *obj;
insane_object(obj, ofmt0, maskbuf, (struct monst *)0);
}
if (n == 1 && (carried(obj) || (owornmask & (W_BALL|W_CHAIN)) != 0L)) {
const char *what = 0;
what = 0;
/* verify that obj in hero's invent (or ball/chain elsewhere)
with owornmask of W_foo is the object pointed to by ufoo */
switch (owornmask) {
@@ -2256,11 +2259,24 @@ struct obj *obj;
Sprintf(maskbuf, "worn mask 0x%08lx != %s", obj->owornmask, what);
insane_object(obj, ofmt0, maskbuf, (struct monst *)0);
}
}
if (n == 1 && (carried(obj) || (owornmask & (W_BALL|W_CHAIN)) != 0L
|| mcarried(obj))) {
/* check for items worn in invalid slots; practically anything can
be wielded/alt-wielded/quivered, so skip obj if it's one of those */
be wielded/alt-wielded/quivered, so tests on those are limited */
what = 0;
if (owornmask & W_ARMOR) {
if (obj->oclass != ARMOR_CLASS) what = "armor";
} else if (owornmask & (W_WEP|W_SWAPWEP|W_QUIVER)) {
/* monsters don't maintain alternate weapon or quiver */
if (mcarried(obj) && (owornmask & (W_SWAPWEP|W_QUIVER)) != 0L)
what = (owornmask & W_SWAPWEP) != 0L ? "monst alt weapon?"
: "monst quiver?";
/* hero can quiver gold but not wield it (hence not alt-wield
it either); also catches monster wielding gold */
else if (obj->oclass == COIN_CLASS
&& (owornmask & (W_WEP|W_SWAPWEP)) != 0L)
what = (owornmask & W_WEP) != 0L ? "weapon" : "alt weapon";
} else if (owornmask & W_AMUL) {
if (obj->oclass != AMULET_CLASS) what = "amulet";
} else if (owornmask & W_RING) {
@@ -2273,16 +2289,19 @@ struct obj *obj;
if (obj->oclass != BALL_CLASS) what = "chained ball";
} else if (owornmask & W_CHAIN) {
if (obj->oclass != CHAIN_CLASS) what = "chain";
} else if (owornmask & W_SADDLE) {
if (obj->otyp != SADDLE) what = "saddle";
}
if (what) {
char oclassname[30];
struct monst *mon = mcarried(obj) ? obj->ocarry : 0;
/* if we've found a potion worn in the amulet slot,
this yields "worn (potion amulet)" */
Strcpy(oclassname, def_oc_syms[(uchar)obj->oclass].name);
Sprintf(maskbuf, "worn (%s %s)",
makesingular(oclassname), what);
insane_object(obj, ofmt0, maskbuf, (struct monst *)0);
insane_object(obj, ofmt0, maskbuf, mon);
}
}
#else /* not (BETA || DEBUG) */