Give statues 'real' spellbooks only.
Provide mkobj() a way to accomplish that instead of resorting to
mksobj(rnd_class()).
-/* NetHack 3.6 extern.h $NHDT-Date: 1578764033 2020/01/11 17:33:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.783 $ */
+/* NetHack 3.6 extern.h $NHDT-Date: 1578895332 2020/01/13 06:02:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.785 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
E void FDECL(free_omailcmd, (struct obj *));
E struct obj *FDECL(mkobj_at, (CHAR_P, int, int, BOOLEAN_P));
E struct obj *FDECL(mksobj_at, (int, int, int, BOOLEAN_P, BOOLEAN_P));
-E struct obj *FDECL(mksobj_migr_to_species, (int, unsigned, BOOLEAN_P, BOOLEAN_P));
-E struct obj *FDECL(mkobj, (CHAR_P, BOOLEAN_P));
+E struct obj *FDECL(mksobj_migr_to_species, (int, unsigned,
+ BOOLEAN_P, BOOLEAN_P));
+E struct obj *FDECL(mkobj, (int, BOOLEAN_P));
E int NDECL(rndmonnum);
E boolean FDECL(bogon_is_pname, (CHAR_P));
E struct obj *FDECL(splitobj, (struct obj *, long));
-/* NetHack 3.6 objclass.h $NHDT-Date: 1547255901 2019/01/12 01:18:21 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.20 $ */
+/* NetHack 3.6 objclass.h $NHDT-Date: 1578895344 2020/01/13 06:02:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.21 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */
MAXOCLASSES = 18
};
+/* for mkobj() use ONLY! odd '-SPBOOK_CLASS' is in case of unsigned enums */
+#define SPBOOK_no_NOVEL (0 - (int) SPBOOK_CLASS)
#define ALLOW_COUNT (MAXOCLASSES + 1) /* Can be used in the object class */
#define ALL_CLASSES (MAXOCLASSES + 2) /* input to getobj(). */
-/* NetHack 3.6 mkobj.c $NHDT-Date: 1578855620 2020/01/12 19:00:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.173 $ */
+/* NetHack 3.6 mkobj.c $NHDT-Date: 1578895344 2020/01/13 06:02:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.174 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
result is always non-Null */
struct obj *
mkobj(oclass, artif)
-char oclass;
+int oclass;
boolean artif;
{
int tprob, i, prob = rnd(1000);
: (const struct icp *) mkobjprobs;
for (tprob = rnd(100); (tprob -= iprobs->iprob) > 0; iprobs++)
- ;
+ continue;
oclass = iprobs->iclass;
}
- i = g.bases[(int) oclass];
- while ((prob -= objects[i].oc_prob) > 0)
- i++;
+ if (oclass == SPBOOK_no_NOVEL) {
+ i = rnd_class(g.bases[SPBOOK_CLASS], SPE_BLANK_PAPER);
+ oclass = SPBOOK_CLASS; /* for sanity check below */
+ } else {
+ i = g.bases[oclass];
+ while ((prob -= objects[i].oc_prob) > 0)
+ ++i;
+ }
if (objects[i].oc_class != oclass || !OBJ_NAME(objects[i]))
panic("probtype error, oclass=%d i=%d", (int) oclass, i);
case STATUE:
/* possibly overridden by mkcorpstat() */
otmp->corpsenm = rndmonnum();
- /* note: might produce a novel rather than a spellbook */
if (!verysmall(&mons[otmp->corpsenm])
&& rn2(level_difficulty() / 2 + 10) > 10)
- (void) add_to_container(otmp, mkobj(SPBOOK_CLASS, FALSE));
+ (void) add_to_container(otmp,
+ mkobj(SPBOOK_no_NOVEL, FALSE));
}
break;
case COIN_CLASS:
-/* NetHack 3.6 pray.c $NHDT-Date: 1578855625 2020/01/12 19:00:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.137 $ */
+/* NetHack 3.6 pray.c $NHDT-Date: 1578895347 2020/01/13 06:02:27 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.138 $ */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
int sp_no, trycnt = u.ulevel + 1;
/* not yet known spells given preference over already known ones;
- also, try to grant a spell for which there is a skill slot;
- make sure that it's a spellbook and not a novel */
- /* otmp = mkobj(SPBOOK_CLASS, TRUE); --might yield NOVEL */
- otmp = mksobj(rnd_class(g.bases[SPBOOK_CLASS],
- SPE_BLANK_PAPER),
- TRUE, FALSE);
+ also, try to grant a spell for which there is a skill slot */
+ otmp = mkobj(SPBOOK_no_NOVEL, TRUE);
while (--trycnt > 0) {
if (otmp->otyp != SPE_BLANK_PAPER) {
for (sp_no = 0; sp_no < MAXSPELL; sp_no++)
-/* NetHack 3.6 priest.c $NHDT-Date: 1578855626 2020/01/12 19:00:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.56 $ */
+/* NetHack 3.6 priest.c $NHDT-Date: 1578895348 2020/01/13 06:02:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.57 $ */
/* Copyright (c) Izchak Miller, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
}
/* 2 to 4 spellbooks */
for (cnt = rn1(3, 2); cnt > 0; --cnt) {
- /* avoid novel (used to be mkobj(SPBOOK_CLASS, FALSE) here) */
- (void) mpickobj(priest, mksobj(rnd_class(g.bases[SPBOOK_CLASS],
- SPE_BLANK_PAPER),
- TRUE, FALSE));
+ (void) mpickobj(priest, mkobj(SPBOOK_no_NOVEL, FALSE));
}
/* robe [via makemon()] */
if (rn2(2) && (otmp = which_armor(priest, W_ARMC)) != 0) {