From: Michael Meyer Date: Thu, 30 Sep 2021 15:22:36 +0000 (-0400) Subject: Formally block artifacts as random box contents X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2abe08d0bf5da67f2efef198e5bac74100f5096d;p=nethack Formally block artifacts as random box contents Another (latent) case of an artifact possibly being generated and immediately deleted: part of the process of a mimic disguising itself as an item involves generating a random object, then deleting it. If this item is a box or sack, it will generate with random contents, which will be deleted along with the container. If artifacts are allowed as random box contents, this can silently remove an artifact from being available in the game. This is effectively blocked already, since none of the artifacts eligible for random generation are items from classes marked as valid box contents (see boxiprobs[] in mkobj.c). Nonetheless, formally preventing artifacts from generating as box contents will guarantee this issue won't crop up if a randomly generated artifact tool, ring, etc, is added in the future. --- diff --git a/src/mkobj.c b/src/mkobj.c index abe4c8261..fb5fa1db2 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -273,7 +273,7 @@ mkbox_cnts(struct obj *box) for (n = rn2(n + 1); n > 0; n--) { if (box->otyp == ICE_BOX) { - otmp = mksobj(CORPSE, TRUE, TRUE); + otmp = mksobj(CORPSE, TRUE, FALSE); /* Note: setting age to 0 is correct. Age has a different * from usual meaning for objects stored in ice boxes. -KAA */ @@ -288,7 +288,7 @@ mkbox_cnts(struct obj *box) for (tprob = rnd(100); (tprob -= iprobs->iprob) > 0; iprobs++) ; - if (!(otmp = mkobj(iprobs->iclass, TRUE))) + if (!(otmp = mkobj(iprobs->iclass, FALSE))) continue; /* handle a couple of special cases */