oextra follow-up - merging (trunk only)

It seemed inappropriate to allocate and tack on an oextra
structure just to mark it as unmergable, and the oextra
struct itself wouldn't be released until a save/restore took
place.

This uses one of the freed up oattached bits to prevent the merge.
This commit is contained in:
nethack.allison
2006-04-15 13:37:58 +00:00
parent e7948e258c
commit d156b95e0d
3 changed files with 9 additions and 3 deletions

View File

@@ -297,9 +297,9 @@ register struct obj *otmp;
dropy(otmp);
sellobj_state(SELL_NORMAL);
} else {
newolong(otmp); /* hack to prevent merge */
otmp->nomerge = 1; /* used to prevent merge */
otmp = addinv(otmp);
free_olong(otmp);
otmp->nomerge = 0;
}
}
return(otmp);

View File

@@ -2416,6 +2416,9 @@ mergable(otmp, obj) /* returns TRUE if obj & otmp can be merged */
obj->bypass != otmp->bypass)
return(FALSE);
if (obj->nomerge) /* explicitly marked to prevent merge */
return FALSE;
if ((obj->oclass==WEAPON_CLASS || obj->oclass==ARMOR_CLASS) &&
(obj->oerodeproof!=otmp->oerodeproof || obj->rknown!=otmp->rknown))
return FALSE;