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:
nethack.rankin
2005-03-13 05:29:01 +00:00
parent 2799e8f617
commit 2ca87d8a5e
5 changed files with 65 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mkroom.h 3.5 1992/11/14 */ /* SCCS Id: @(#)mkroom.h 3.5 2005/03/12 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -71,9 +71,10 @@ extern NEARDATA coord doors[DOORMAX];
#define WANDSHOP 21 #define WANDSHOP 21
#define TOOLSHOP 22 #define TOOLSHOP 22
#define BOOKSHOP 23 #define BOOKSHOP 23
#define UNIQUESHOP 24 /* shops here & above not randomly gen'd. */ #define FODDERSHOP 24 /* health food store */
#define CANDLESHOP 24 #define UNIQUESHOP 25 /* shops here & below not randomly gen'd. */
#define MAXRTYPE 24 /* maximum valid room type */ #define CANDLESHOP 25
#define MAXRTYPE 25 /* maximum valid room type */
/* Special type for search_special() */ /* Special type for search_special() */
#define ANY_TYPE (-1) #define ANY_TYPE (-1)

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)patchlevel.h 3.5 2005/01/22 */ /* SCCS Id: @(#)patchlevel.h 3.5 2005/03/12 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -13,7 +13,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones * Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files. * and save files.
*/ */
#define EDITLEVEL 20 #define EDITLEVEL 21
#define COPYRIGHT_BANNER_A \ #define COPYRIGHT_BANNER_A \
"NetHack, Copyright 1985-2005" "NetHack, Copyright 1985-2005"

View File

@@ -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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -119,6 +119,8 @@ mkshop()
goto gottype; goto gottype;
if(*ep == 'g' || *ep == 'G') if(*ep == 'g' || *ep == 'G')
i = 0; i = 0;
else if (*ep == 'v' || *ep == 'V')
i = FODDERSHOP - SHOPBASE; /* veggy food */
else else
i = -1; i = -1;
} }

View File

@@ -7,6 +7,9 @@
#include "hack.h" #include "hack.h"
#include "eshk.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(mkshobj_at, (const struct shclass *,int,int));
STATIC_DCL void FDECL(nameshk, (struct monst *,const char * const *)); STATIC_DCL void FDECL(nameshk, (struct monst *,const char * const *));
STATIC_DCL int FDECL(shkinit, (const struct shclass *,struct mkroom *)); STATIC_DCL int FDECL(shkinit, (const struct shclass *,struct mkroom *));
@@ -267,6 +270,38 @@ init_shop_selection()
} }
#endif /*0*/ #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 STATIC_OVL int
shkveg() shkveg()
{ {
@@ -276,11 +311,14 @@ shkveg()
j = maxprob = 0; j = maxprob = 0;
for (i = bases[(int)oclass]; i < NUM_OBJECTS; ++i) { 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; ok[j++] = i;
maxprob += objects[i].oc_prob; maxprob += objects[i].oc_prob;
} }
} }
if (maxprob < 1) panic("shkveg no veggy objects");
prob = rnd(maxprob); prob = rnd(maxprob);
j = 0; j = 0;
@@ -295,6 +333,18 @@ shkveg()
return i; 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 STATIC_OVL void
mkshobj_at(shp, sx, sy) mkshobj_at(shp, sx, sy)
/* make an object of the appropriate type for a shop square */ /* make an object of the appropriate type for a shop square */
@@ -316,7 +366,7 @@ int sx, sy;
} else { } else {
atype = get_shop_item(shp - shtypes); atype = get_shop_item(shp - shtypes);
if (atype == VEGETARIAN_CLASS) if (atype == VEGETARIAN_CLASS)
(void) mksobj_at(shkveg(), sx, sy, TRUE, TRUE); mkveggy_at(sx, sy);
else if (atype < 0) else if (atype < 0)
(void) mksobj_at(-atype, sx, sy, TRUE, TRUE); (void) mksobj_at(-atype, sx, sy, TRUE, TRUE);
else else
@@ -564,15 +614,7 @@ struct obj *obj;
for (i = 0; i < SIZE(shtypes[0].iprobs) && shp->iprobs[i].iprob; i++) { for (i = 0; i < SIZE(shtypes[0].iprobs) && shp->iprobs[i].iprob; i++) {
/* pseudo-class needs special handling */ /* pseudo-class needs special handling */
if (shp->iprobs[i].itype == VEGETARIAN_CLASS) { if (shp->iprobs[i].itype == VEGETARIAN_CLASS) {
if ((obj->otyp == TIN || obj->otyp == CORPSE) && if (veggy_item(obj, 0)) return TRUE;
((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;
} else if ((shp->iprobs[i].itype < 0) ? } else if ((shp->iprobs[i].itype < 0) ?
shp->iprobs[i].itype == - obj->otyp : shp->iprobs[i].itype == - obj->otyp :
shp->iprobs[i].itype == obj->oclass) shp->iprobs[i].itype == obj->oclass)

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)lev_main.c 3.5 2002/03/27 */ /* SCCS Id: @(#)lev_main.c 3.5 2005/03/12 */
/* Copyright (c) 1989 by Jean-Christophe Collet */ /* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -162,6 +162,7 @@ static struct {
{ "wand shop", WANDSHOP }, { "wand shop", WANDSHOP },
{ "tool shop", TOOLSHOP }, { "tool shop", TOOLSHOP },
{ "book shop", BOOKSHOP }, { "book shop", BOOKSHOP },
{ "health food shop", FODDERSHOP },
{ "candle shop", CANDLESHOP }, { "candle shop", CANDLESHOP },
{ 0, 0 } { 0, 0 }
}; };