more health food shops (trunk only)
Allow health food stores to carry eggs and tins of veggy contents in
their stock. The tins will almost always contain spinach because random
tins containing meat are converted into that.
Also, allow health food stores to be placed with the level compiler
(not tested) and to be forcibly placed in wizard mode via SHOPTYPE setting
of "V". Increments EDITLEVEL in patchlevel.h because lighting store in
Minetown got renumbered and the special level for it needs to be rebuilt.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)mkroom.c 3.5 2004/06/10 */
|
||||
/* SCCS Id: @(#)mkroom.c 3.5 2005/03/12 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -119,6 +119,8 @@ mkshop()
|
||||
goto gottype;
|
||||
if(*ep == 'g' || *ep == 'G')
|
||||
i = 0;
|
||||
else if (*ep == 'v' || *ep == 'V')
|
||||
i = FODDERSHOP - SHOPBASE; /* veggy food */
|
||||
else
|
||||
i = -1;
|
||||
}
|
||||
|
||||
64
src/shknam.c
64
src/shknam.c
@@ -7,6 +7,9 @@
|
||||
#include "hack.h"
|
||||
#include "eshk.h"
|
||||
|
||||
STATIC_DCL boolean FDECL(veggy_item, (struct obj *obj,int));
|
||||
STATIC_DCL int NDECL(shkveg);
|
||||
STATIC_DCL void FDECL(mkveggy_at, (int,int));
|
||||
STATIC_DCL void FDECL(mkshobj_at, (const struct shclass *,int,int));
|
||||
STATIC_DCL void FDECL(nameshk, (struct monst *,const char * const *));
|
||||
STATIC_DCL int FDECL(shkinit, (const struct shclass *,struct mkroom *));
|
||||
@@ -267,6 +270,38 @@ init_shop_selection()
|
||||
}
|
||||
#endif /*0*/
|
||||
|
||||
/* decide whether an object or object type is considered vegetarian;
|
||||
for types, items which might go either way are assumed to be veggy */
|
||||
STATIC_OVL boolean
|
||||
veggy_item(obj, otyp)
|
||||
struct obj *obj;
|
||||
int otyp; /* used iff obj is null */
|
||||
{
|
||||
int corpsenm;
|
||||
char oclass;
|
||||
|
||||
if (obj) {
|
||||
/* actual object; will check tin content and corpse species */
|
||||
otyp = (int) obj->otyp;
|
||||
oclass = obj->oclass;
|
||||
corpsenm = obj->corpsenm;
|
||||
} else {
|
||||
/* just a type; caller will have to handle tins and corpses */
|
||||
oclass = objects[otyp].oc_class;
|
||||
corpsenm = PM_LICHEN; /* veggy standin */
|
||||
}
|
||||
|
||||
if (oclass == FOOD_CLASS) {
|
||||
if (objects[otyp].oc_material == VEGGY || otyp == EGG)
|
||||
return TRUE;
|
||||
if (otyp == TIN && corpsenm == NON_PM) /* implies obj is non-null */
|
||||
return (obj->spe == 1); /* 0 = empty, 1 = spinach */
|
||||
if (otyp == TIN || otyp == CORPSE)
|
||||
return (corpsenm >= LOW_PM && vegetarian(&mons[corpsenm]));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
STATIC_OVL int
|
||||
shkveg()
|
||||
{
|
||||
@@ -276,11 +311,14 @@ shkveg()
|
||||
|
||||
j = maxprob = 0;
|
||||
for (i = bases[(int)oclass]; i < NUM_OBJECTS; ++i) {
|
||||
if (objects[i].oc_material == VEGGY) {
|
||||
if (objects[i].oc_class != oclass) break;
|
||||
|
||||
if (veggy_item((struct obj *)0, i)) {
|
||||
ok[j++] = i;
|
||||
maxprob += objects[i].oc_prob;
|
||||
}
|
||||
}
|
||||
if (maxprob < 1) panic("shkveg no veggy objects");
|
||||
prob = rnd(maxprob);
|
||||
|
||||
j = 0;
|
||||
@@ -295,6 +333,18 @@ shkveg()
|
||||
return i;
|
||||
}
|
||||
|
||||
/* make a random item for health food store */
|
||||
STATIC_OVL void
|
||||
mkveggy_at(sx, sy)
|
||||
int sx, sy;
|
||||
{
|
||||
struct obj *obj = mksobj_at(shkveg(), sx, sy, TRUE, TRUE);
|
||||
|
||||
if (obj && obj->otyp == TIN)
|
||||
set_tin_variety(obj, HEALTHY_TIN);
|
||||
return;
|
||||
}
|
||||
|
||||
STATIC_OVL void
|
||||
mkshobj_at(shp, sx, sy)
|
||||
/* make an object of the appropriate type for a shop square */
|
||||
@@ -316,7 +366,7 @@ int sx, sy;
|
||||
} else {
|
||||
atype = get_shop_item(shp - shtypes);
|
||||
if (atype == VEGETARIAN_CLASS)
|
||||
(void) mksobj_at(shkveg(), sx, sy, TRUE, TRUE);
|
||||
mkveggy_at(sx, sy);
|
||||
else if (atype < 0)
|
||||
(void) mksobj_at(-atype, sx, sy, TRUE, TRUE);
|
||||
else
|
||||
@@ -564,15 +614,7 @@ struct obj *obj;
|
||||
for (i = 0; i < SIZE(shtypes[0].iprobs) && shp->iprobs[i].iprob; i++) {
|
||||
/* pseudo-class needs special handling */
|
||||
if (shp->iprobs[i].itype == VEGETARIAN_CLASS) {
|
||||
if ((obj->otyp == TIN || obj->otyp == CORPSE) &&
|
||||
((obj->corpsenm >= LOW_PM &&
|
||||
vegetarian(&mons[obj->corpsenm])) ||
|
||||
(obj->otyp == TIN && obj->spe == 1))) /* spinach */
|
||||
return TRUE;
|
||||
if (obj->oclass == FOOD_CLASS &&
|
||||
(objects[obj->otyp].oc_material == VEGGY ||
|
||||
obj->otyp == EGG))
|
||||
return TRUE;
|
||||
if (veggy_item(obj, 0)) return TRUE;
|
||||
} else if ((shp->iprobs[i].itype < 0) ?
|
||||
shp->iprobs[i].itype == - obj->otyp :
|
||||
shp->iprobs[i].itype == obj->oclass)
|
||||
|
||||
Reference in New Issue
Block a user