setmnotwielded should always MON_NOWEP

Instead of making the caller remember to use MON_NOWEP, make
setmnotwielded handle that automatically.  This fixes the
"bad monster weapon restore" errors I've been seeing.

Also adds sanity checks for this.
This commit is contained in:
Pasi Kallinen
2015-10-06 18:47:52 +03:00
parent a51531776d
commit 8212ddd69e
5 changed files with 15 additions and 14 deletions

View File

@@ -1973,10 +1973,8 @@ long timeout; /* unused */
stop_occupation();
}
} else if (obj->where == OBJ_MINVENT && obj->owornmask) {
if (obj == MON_WEP(obj->ocarry)) {
if (obj == MON_WEP(obj->ocarry))
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 */