diff --git a/include/mkroom.h b/include/mkroom.h index 91b7d3e94..a7889f272 100644 --- a/include/mkroom.h +++ b/include/mkroom.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 mkroom.h $NHDT-Date: 1596498547 2020/08/03 23:49:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.22 $ */ +/* NetHack 3.7 mkroom.h $NHDT-Date: 1715203003 2024/05/08 21:16:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.31 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -26,6 +26,7 @@ struct mkroom { struct shclass { const char *name; /* name of the shop type */ + const char *annotation; /* simpler name for #overview; Null if same */ char symb; /* this identifies the shop type */ int prob; /* the shop type probability in % */ schar shdist; /* object placement type */ diff --git a/src/dungeon.c b/src/dungeon.c index fce3bc9f9..d1ead30cd 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 dungeon.c $NHDT-Date: 1704043695 2023/12/31 17:28:15 $ $NHDT-Branch: keni-luabits2 $:$NHDT-Revision: 1.207 $ */ +/* NetHack 3.7 dungeon.c $NHDT-Date: 1715203022 2024/05/08 21:17:02 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.222 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -61,7 +61,7 @@ staticfn boolean init_dungeon_dungeons(lua_State *, struct proto_dungeon *, staticfn boolean unplaced_floater(struct dungeon *); staticfn boolean unreachable_level(d_level *, boolean); staticfn void tport_menu(winid, char *, struct lchoice *, d_level *, boolean); -staticfn const char *br_string(int); +staticfn const char *br_string(int) NONNULL; staticfn char chr_u_on_lvl(d_level *); staticfn void print_branch(winid, int, int, int, boolean, struct lchoice *); staticfn char *get_annotation(d_level *); @@ -74,10 +74,10 @@ staticfn void print_mapseen(winid, mapseen *, int, int, boolean); staticfn boolean interest_mapseen(mapseen *); staticfn void count_feat_lastseentyp(mapseen *, coordxy, coordxy); staticfn void traverse_mapseenchn(int, winid, int, int, int *); -staticfn const char *seen_string(xint16, const char *); -staticfn const char *br_string2(branch *); -staticfn const char *shop_string(int); -staticfn char *tunesuffix(mapseen *, char *, size_t); +staticfn const char *seen_string(xint16, const char *) NONNULL NONNULLARG2; +staticfn const char *br_string2(branch *) NONNULL NONNULLARG1; +staticfn const char *shop_string(int) NONNULL; +staticfn char *tunesuffix(mapseen *, char *, size_t) NONNULL NONNULLPTRS; #ifdef DEBUG staticfn void dumpit(void); @@ -3339,7 +3339,7 @@ seen_string(xint16 x, const char *obj) switch (x) { case 0: return "no"; - /* an() returns too much. index is ok in this case */ + /* an() returns too much. index/strchr is ok in this case */ case 1: return strchr(vowels, *obj) ? "an" : "a"; case 2: @@ -3404,68 +3404,19 @@ endgamelevelname(char *outbuf, int indx) return outbuf; } +/* short shop description */ staticfn const char * shop_string(int rtype) { - const char *str = "shop"; /* catchall */ - enum roomtype_types ertype = rtype; + extern const struct shclass shtypes[]; /* defined in shknam.c */ + const char *str = "shop?"; /* catchall */ - /* Yuck, redundancy...but shclass.name doesn't cut it as a noun */ - switch (ertype) { - case SHOPBASE - 1: + if (rtype < SHOPBASE) { str = "untended shop"; - break; /* see recalc_mapseen */ - case SHOPBASE: - str = "general store"; - break; - case ARMORSHOP: - str = "armor shop"; - break; - case SCROLLSHOP: - str = "scroll shop"; - break; - case POTIONSHOP: - str = "potion shop"; - break; - case WEAPONSHOP: - str = "weapon shop"; - break; - case FOODSHOP: - str = "delicatessen"; - break; - case RINGSHOP: - str = "jewelers"; - break; - case WANDSHOP: - str = "wand shop"; - break; - case TOOLSHOP: - str = "hardware store"; - break; - case BOOKSHOP: - str = "bookstore"; - break; - case FODDERSHOP: - str = "health food store"; - break; - case CANDLESHOP: - str = "lighting shop"; - break; - /* non-shops room types */ - case OROOM: - case THEMEROOM: - case COURT: - case SWAMP: - case VAULT: - case BEEHIVE: - case MORGUE: - case BARRACKS: - case ZOO: - case DELPHI: - case TEMPLE: - case LEPREHALL: - case COCKNEST: - break; + } else if (shtypes[rtype - SHOPBASE].annotation) { + str = shtypes[rtype - SHOPBASE].annotation; + } else if (shtypes[rtype - SHOPBASE].name) { + str = shtypes[rtype - SHOPBASE].name; } return str; } diff --git a/src/shknam.c b/src/shknam.c index 10cfac363..b4b44b77a 100644 --- a/src/shknam.c +++ b/src/shknam.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 shknam.c $NHDT-Date: 1596498209 2020/08/03 23:43:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.57 $ */ +/* NetHack 3.7 shknam.c $NHDT-Date: 1715203028 2024/05/08 21:17:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.78 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -204,7 +204,7 @@ static const char *const shkhealthfoods[] = { * shtypes[] is externally referenced from mkroom.c, mon.c and shk.c. */ const struct shclass shtypes[] = { - { "general store", + { "general store", NULL, RANDOM_CLASS, 42, D_SHOP, @@ -215,7 +215,7 @@ const struct shclass shtypes[] = { { 0, 0 }, { 0, 0 } }, shkgeneral }, - { "used armor dealership", + { "used armor dealership", "armor shop", ARMOR_CLASS, 14, D_SHOP, @@ -226,7 +226,7 @@ const struct shclass shtypes[] = { { 0, 0 }, { 0, 0 } }, shkarmors }, - { "second-hand bookstore", + { "second-hand bookstore", "scroll shop", SCROLL_CLASS, 10, D_SHOP, @@ -237,7 +237,7 @@ const struct shclass shtypes[] = { { 0, 0 }, { 0, 0 } }, shkbooks }, - { "liquor emporium", + { "liquor emporium", "potion shop", POTION_CLASS, 10, D_SHOP, @@ -248,7 +248,7 @@ const struct shclass shtypes[] = { { 0, 0 }, { 0, 0 } }, shkliquors }, - { "antique weapons outlet", + { "antique weapons outlet", "weapon shop", WEAPON_CLASS, 5, D_SHOP, @@ -259,7 +259,7 @@ const struct shclass shtypes[] = { { 0, 0 }, { 0, 0 } }, shkweapons }, - { "delicatessen", + { "delicatessen", NULL, FOOD_CLASS, 5, D_SHOP, @@ -270,7 +270,7 @@ const struct shclass shtypes[] = { { 3, -ICE_BOX }, { 0, 0 } }, shkfoods }, - { "jewelers", + { "jewelers", NULL, RING_CLASS, 3, D_SHOP, @@ -281,7 +281,7 @@ const struct shclass shtypes[] = { { 0, 0 }, { 0, 0 } }, shkrings }, - { "quality apparel and accessories", + { "quality apparel and accessories", "wand shop", WAND_CLASS, 3, D_SHOP, @@ -290,7 +290,7 @@ const struct shclass shtypes[] = { { 5, -ELVEN_CLOAK }, { 0, 0 } }, shkwands }, - { "hardware store", + { "hardware store", NULL, TOOL_CLASS, 3, D_SHOP, @@ -301,7 +301,7 @@ const struct shclass shtypes[] = { { 0, 0 }, { 0, 0 } }, shktools }, - { "rare books", + { "rare books", "bookstore", SPBOOK_CLASS, 3, D_SHOP, @@ -312,7 +312,7 @@ const struct shclass shtypes[] = { { 0, 0 }, { 0, 0 } }, shkbooks }, - { "health food store", + { "health food store", NULL, FOOD_CLASS, 2, D_SHOP, @@ -327,7 +327,7 @@ const struct shclass shtypes[] = { * probability of zero. They are only created via the special level * loader. */ - { "lighting store", + { "lighting store", "lighting shop", TOOL_CLASS, 0, D_SHOP, @@ -342,7 +342,7 @@ const struct shclass shtypes[] = { { 1, -SPE_LIGHT } }, shklight }, /* sentinel */ - { (char *) 0, + { (char *) 0, NULL, 0, 0, 0, @@ -915,4 +915,6 @@ is_izchak(struct monst *shkp, boolean override_hallucination) return (boolean) !strcmp(shknm, "Izchak"); } +#undef VEGETARIAN_CLASS + /*shknam.c*/