From de2a6034dd9926a5faf11f0827b4270b19e0c234 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Thu, 12 Jan 2006 03:23:05 +0000 Subject: [PATCH] tin details (trunk only) Reveal more tin details at end of game disclosure. b - an uncursed carrot c - an uncursed tin of broiled kobold meat d - an uncursed tin of stir fried fox meat e - 4 uncursed tripe rations f - 4 uncursed food rations g - an uncursed cream pie n - 4 uncursed tins of spinach o - 3 uncursed tins of pureed newt meat p - an uncursed homemade tin of fox meat Note that in the case of homemade and rotten it sounded better to have the term before the word tin, rather than after: homemade tins of newt meat rather than: tins of homemade newt meat The wishing code should probably be changed to reflect this so people can wish for a "homemade tin of newt". As it stands, they must wish for a "tin of homemade newt" which differs from the final display. That is not included. --- include/extern.h | 1 + src/eat.c | 50 ++++++++++++++++++++++++++++++++++++++++++------ src/end.c | 2 ++ src/objnam.c | 12 ++---------- 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/include/extern.h b/include/extern.h index 8a96ca27c..793915ba0 100644 --- a/include/extern.h +++ b/include/extern.h @@ -577,6 +577,7 @@ E void FDECL(consume_oeaten, (struct obj *,int)); E boolean FDECL(maybe_finished_meal, (BOOLEAN_P)); E void FDECL(set_tin_variety, (struct obj *,int)); E int FDECL(tin_variety_txt, (char *,int *)); +E void FDECL(tin_details, (struct obj *,int,char *)); E boolean FDECL(Popeye, (int)); /* ### end.c ### */ diff --git a/src/eat.c b/src/eat.c index 2d7f6818d..86ea00471 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)eat.c 3.5 2005/12/09 */ +/* SCCS Id: @(#)eat.c 3.5 2006/01/11 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -43,7 +43,7 @@ STATIC_DCL int FDECL(bounded_increase, (int,int,int)); STATIC_DCL void FDECL(accessory_has_effect, (struct obj *)); STATIC_DCL void FDECL(eataccessory, (struct obj *)); STATIC_DCL const char *FDECL(foodword, (struct obj *)); -STATIC_DCL int FDECL(tin_variety, (struct obj *)); +STATIC_DCL int FDECL(tin_variety, (struct obj *,BOOLEAN_P)); STATIC_DCL boolean FDECL(maybe_cannibal, (int,BOOLEAN_P)); char msgbuf[BUFSZ]; @@ -1159,6 +1159,43 @@ int *tinvariety; return 0; } +/* + * This assumes that buf already contains the word "tin", + * as is the case with caller xname(). + */ +void +tin_details(obj, mnum, buf) +struct obj *obj; +int mnum; +char *buf; +{ + char buf2[BUFSZ]; + if (obj && buf) { + if(obj->spe > 0) + Strcat(buf, " of spinach"); + else if (mnum == NON_PM) + Strcpy(buf, "empty tin"); + else { + if (obj->cknown && obj->spe < 0) { + int r = tin_variety(obj, TRUE); + if (r == ROTTEN_TIN || r == HOMEMADE_TIN) { + /* put these before the word tin */ + Sprintf(buf2,"%s %s of ", tintxts[r].txt, buf); + Strcpy(buf, buf2); + } else { + Sprintf(eos(buf), " of %s ", tintxts[r].txt); + } + } else { + Strcpy(eos(buf), " of "); + } + if (vegetarian(&mons[mnum])) + Sprintf(eos(buf), "%s", mons[mnum].mname); + else + Sprintf(eos(buf), "%s meat", mons[mnum].mname); + } + } +} + void set_tin_variety(obj, forcetype) struct obj *obj; @@ -1174,7 +1211,7 @@ int forcetype; obj->spe = 1; /* spinach */ return; } else if (forcetype == HEALTHY_TIN) { - r = tin_variety(obj); + r = tin_variety(obj, FALSE); if (r < 0 || r >= TTSZ) r = ROTTEN_TIN; /* shouldn't happen */ while ((r == ROTTEN_TIN && !obj->cursed) || !tintxts[r].fodder) r = rn2(TTSZ-1); @@ -1190,8 +1227,9 @@ int forcetype; } STATIC_OVL int -tin_variety(obj) +tin_variety(obj, disp) struct obj *obj; +boolean disp; /* we're just displaying so leave things alone */ { register int r; @@ -1205,7 +1243,7 @@ struct obj *obj; } else r = rn2(TTSZ-1); - if (r == HOMEMADE_TIN && + if (!disp && r == HOMEMADE_TIN && !obj->blessed && !rn2(7)) r = ROTTEN_TIN; /* some homemade tins go bad */ @@ -1248,7 +1286,7 @@ opentin() /* called during each move whilst opening a tin */ costly_tin(COST_OPEN); goto use_me; } - r = tin_variety(context.tin.tin); + r = tin_variety(context.tin.tin, FALSE); which = 0; /* 0=>plural, 1=>as-is, 2=>"the" prefix */ if ((mnum == PM_COCKATRICE || mnum == PM_CHICKATRICE) && (Stone_resistance || Hallucination)) { diff --git a/src/end.c b/src/end.c index cb1dbc236..a31761604 100644 --- a/src/end.c +++ b/src/end.c @@ -383,6 +383,8 @@ boolean taken; obj->known = obj->bknown = obj->dknown = obj->rknown = 1; if (Is_container(obj) || obj->otyp == STATUE) obj->cknown = obj->lknown = 1; + if (obj->otyp == TIN) + obj->cknown = 1; } (void) display_inventory((char *)0, TRUE); container_contents(invent, TRUE, TRUE); diff --git a/src/objnam.c b/src/objnam.c index caede5d1a..ffae54960 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -341,16 +341,8 @@ register struct obj *obj; } Strcpy(buf, actualn); - if (typ == TIN && obj->known) { - if(obj->spe > 0) - Strcat(buf, " of spinach"); - else if (omndx == NON_PM) - Strcpy(buf, "empty tin"); - else if (vegetarian(&mons[omndx])) - Sprintf(eos(buf), " of %s", mons[omndx].mname); - else - Sprintf(eos(buf), " of %s meat", mons[omndx].mname); - } + if (typ == TIN && obj->known) + tin_details(obj, omndx, buf); break; case COIN_CLASS: case CHAIN_CLASS: -- 2.40.0