diff --git a/include/decl.h b/include/decl.h index 4716f158c..49bd34d2e 100644 --- a/include/decl.h +++ b/include/decl.h @@ -452,6 +452,10 @@ struct instance_context { int spec_dbon_applies; /* coordinate effects from spec_dbon() with * messages in artifact_hit() - artifact.c */ int mrank_sz; /* loaded by max_rank_sz - botl.c */ + short nocreate; /* ini_inv() - u_init.c = STRANGE_OBJECT */ + short nocreate2; /* ini_inv() - u_init.c = STRANGE_OBJECT */ + short nocreate3; /* ini_inv() - u_init.c = STRANGE_OBJECT */ + short nocreate4; /* ini_inv() - u_init.c = STRANGE_OBJECT */ }; E struct instance_context icontext; diff --git a/src/decl.c b/src/decl.c index 2a259efaa..2f52fc41f 100644 --- a/src/decl.c +++ b/src/decl.c @@ -333,6 +333,10 @@ const struct instance_context icontext_initial_state = { -1, /* polearm_range_max - apply.c */ 0, /* spec_dbon_applies - artifact.c */ 0, /* mrank_sz - botl.c */ + STRANGE_OBJECT, /* nocreate - ini_inv() in u_init.c */ + STRANGE_OBJECT, /* nocreate2 - ini_inv() in u_init.c */ + STRANGE_OBJECT, /* nocreate3 - ini_inv() in u_init.c */ + STRANGE_OBJECT, /* nocreate4 - ini_inv() in u_init.c */ }; struct instance_context icontext; diff --git a/src/u_init.c b/src/u_init.c index 71da5a84a..9d38214ed 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -974,11 +974,6 @@ register struct trobj *trop; struct obj *obj; int otyp, i; - NEARDATA short nocreate = STRANGE_OBJECT; - NEARDATA short nocreate2 = STRANGE_OBJECT; - NEARDATA short nocreate3 = STRANGE_OBJECT; - NEARDATA short nocreate4 = STRANGE_OBJECT; - while (trop->trclass) { otyp = (int) trop->trotyp; if (otyp != UNDEF_TYP) { @@ -996,9 +991,9 @@ register struct trobj *trop; */ obj = mkobj(trop->trclass, FALSE); otyp = obj->otyp; - while (otyp == WAN_WISHING || otyp == nocreate - || otyp == nocreate2 || otyp == nocreate3 - || otyp == nocreate4 || otyp == RIN_LEVITATION + while (otyp == WAN_WISHING || otyp == icontext.nocreate + || otyp == icontext.nocreate2 || otyp == icontext.nocreate3 + || otyp == icontext.nocreate4 || otyp == RIN_LEVITATION /* 'useless' items */ || otyp == POT_HALLUCINATION || otyp == POT_ACID @@ -1040,16 +1035,16 @@ register struct trobj *trop; case WAN_POLYMORPH: case RIN_POLYMORPH: case POT_POLYMORPH: - nocreate = RIN_POLYMORPH_CONTROL; + icontext.nocreate = RIN_POLYMORPH_CONTROL; break; case RIN_POLYMORPH_CONTROL: - nocreate = RIN_POLYMORPH; - nocreate2 = SPE_POLYMORPH; - nocreate3 = POT_POLYMORPH; + icontext.nocreate = RIN_POLYMORPH; + icontext.nocreate2 = SPE_POLYMORPH; + icontext.nocreate3 = POT_POLYMORPH; } /* Don't have 2 of the same ring or spellbook */ if (obj->oclass == RING_CLASS || obj->oclass == SPBOOK_CLASS) - nocreate4 = otyp; + icontext.nocreate4 = otyp; } if (urace.malenum != PM_HUMAN) {