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

@@ -670,7 +670,6 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
* the percentage chance is (1/20)*(50/100).]
*/
setmnotwielded(mon, monwep);
MON_NOWEP(mon);
mon->weapon_check = NEED_WEAPON;
pline("%s from the force of your blow!",
Yobjnam2(monwep, "shatter"));
@@ -1349,10 +1348,8 @@ struct attack *mattk;
obj_extract_self(otmp);
if ((unwornmask = otmp->owornmask) != 0L) {
mdef->misc_worn_check &= ~unwornmask;
if (otmp->owornmask & W_WEP) {
if (otmp->owornmask & W_WEP)
setmnotwielded(mdef, otmp);
MON_NOWEP(mdef);
}
otmp->owornmask = 0L;
update_mon_intrinsics(mdef, otmp, FALSE, FALSE);