candy bar wrappers
Adopt the suggestion that candy bar stacks which get split should keep the same wrapper text for both halves of the stack. The patch stuck with using obj->o_id to manage the wrapper which prior to the patch wasn't a factor in merging and splitting. Switch to obj->spe instead, comparable to tin varities, so mergability is already taken care of. End of game disclosure tacks on T-shirt text to formatted items. Do the same for candy bar wrappers.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.261 $ $NHDT-Date: 1596124734 2020/07/30 15:58:54 $
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.262 $ $NHDT-Date: 1596162338 2020/07/31 02:25:38 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -233,6 +233,9 @@ give rot-away timer instead of revive timer to corpses of cancelled trolls
|
||||
switch revive timer to rot-away timer if a troll corpse gets cancelled
|
||||
uncancel an ice troll if its corpse is put into an ice box; give corpse a
|
||||
revive timer if later taken out
|
||||
splitting a stack of candy bars gave new wrapper text depending upon the
|
||||
obj->o_id value assigned; keep existing text for both halves of stack
|
||||
(side-effect: separate candy bars usually won't merge anymore)
|
||||
|
||||
|
||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1594168620 2020/07/08 00:37:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.851 $ */
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1596162339 2020/07/31 02:25:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.852 $ */
|
||||
/* Copyright (c) Steve Creps, 1988. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -2157,6 +2157,8 @@ E long NDECL(random);
|
||||
|
||||
E void FDECL(learnscroll, (struct obj *));
|
||||
E char *FDECL(tshirt_text, (struct obj *, char *));
|
||||
E const char *FDECL(candy_wrapper_text, (struct obj *));
|
||||
E void FDECL(assign_candy_wrapper, (struct obj *));
|
||||
E int NDECL(doread);
|
||||
E boolean FDECL(is_chargeable, (struct obj *));
|
||||
E void FDECL(recharge, (struct obj *, int));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 obj.h $NHDT-Date: 1590870784 2020/05/30 20:33:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.69 $ */
|
||||
/* NetHack 3.6 obj.h $NHDT-Date: 1596162340 2020/07/31 02:25:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.70 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Michael Allison, 2006. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -44,6 +44,7 @@ struct obj {
|
||||
number of charges for wand or charged tool ( >= -1 );
|
||||
number of candles attached to candelabrum;
|
||||
marks your eggs, tin variety and spinach tins;
|
||||
candy bar wrapper index;
|
||||
Schroedinger's Box (1) or royal coffers for a court (2);
|
||||
tells which fruit a fruit is;
|
||||
special for uball and amulet;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 mkobj.c $NHDT-Date: 1595787211 2020/07/26 18:13:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.182 $ */
|
||||
/* NetHack 3.6 mkobj.c $NHDT-Date: 1596162341 2020/07/31 02:25:41 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.183 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -836,6 +836,12 @@ boolean artif;
|
||||
case KELP_FROND:
|
||||
otmp->quan = (long) rnd(2);
|
||||
break;
|
||||
case CANDY_BAR:
|
||||
/* set otmp->spe */
|
||||
assign_candy_wrapper(otmp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (Is_pudding(otmp)) {
|
||||
otmp->quan = 1L; /* for emphasis; glob quantity is always 1 */
|
||||
|
||||
21
src/objnam.c
21
src/objnam.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 objnam.c $NHDT-Date: 1595627152 2020/07/24 21:45:52 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.303 $ */
|
||||
/* NetHack 3.7 objnam.c $NHDT-Date: 1596162343 2020/07/31 02:25:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.304 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -718,10 +718,25 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
||||
if (pluralize)
|
||||
Strcpy(buf, makeplural(buf));
|
||||
|
||||
if (obj->otyp == T_SHIRT && g.program_state.gameover) {
|
||||
/* maybe give some extra information which isn't shown during play */
|
||||
if (g.program_state.gameover) {
|
||||
const char *lbl;
|
||||
char tmpbuf[BUFSZ];
|
||||
|
||||
Sprintf(eos(buf), " with text \"%s\"", tshirt_text(obj, tmpbuf));
|
||||
/* disclose without breaking illiterate conduct, but mainly tip off
|
||||
players who aren't aware that something readable is present */
|
||||
switch (obj->otyp) {
|
||||
case T_SHIRT:
|
||||
Sprintf(eos(buf), " with text \"%s\"", tshirt_text(obj, tmpbuf));
|
||||
break;
|
||||
case CANDY_BAR:
|
||||
lbl = candy_wrapper_text(obj);
|
||||
if (*lbl)
|
||||
Sprintf(eos(buf), " labeled \"%s\"", lbl);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (has_oname(obj) && dknown) {
|
||||
|
||||
52
src/read.c
52
src/read.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 read.c $NHDT-Date: 1595966992 2020/07/28 20:09:52 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.199 $ */
|
||||
/* NetHack 3.6 read.c $NHDT-Date: 1596162345 2020/07/31 02:25:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.200 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -178,6 +178,39 @@ char *buf;
|
||||
return erode_obj_text(apron, buf);
|
||||
}
|
||||
|
||||
static const char *candy_wrappers[] = {
|
||||
"", /* (none -- should never happen) */
|
||||
"Apollo", /* Lost */
|
||||
"Moon Crunchy", /* South Park */
|
||||
"Snacky Cake", "Chocolate Nuggie", "The Small Bar",
|
||||
"Crispy Yum Yum", "Nilla Crunchie", "Berry Bar",
|
||||
"Choco Nummer", "Om-nom", /* Cat Macro */
|
||||
"Fruity Oaty", /* Serenity */
|
||||
"Wonka Bar", /* Charlie and the Chocolate Factory */
|
||||
};
|
||||
|
||||
/* return the text of a candy bar's wrapper */
|
||||
const char *
|
||||
candy_wrapper_text(obj)
|
||||
struct obj *obj;
|
||||
{
|
||||
/* modulo operation is just bullet proofing; 'spe' is already in range */
|
||||
return candy_wrappers[obj->spe % SIZE(candy_wrappers)];
|
||||
}
|
||||
|
||||
/* assign a wrapper to a candy bar stack */
|
||||
void
|
||||
assign_candy_wrapper(obj)
|
||||
struct obj *obj;
|
||||
{
|
||||
if (obj->otyp == CANDY_BAR) {
|
||||
/* skips candy_wrappers[0] */
|
||||
obj->spe = 1 + rn2(SIZE(candy_wrappers) - 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* the 'r' command; read a scroll or spell book or various other things */
|
||||
int
|
||||
doread()
|
||||
{
|
||||
@@ -299,22 +332,17 @@ doread()
|
||||
u.uconduct.literate++;
|
||||
return 1;
|
||||
} else if (scroll->otyp == CANDY_BAR) {
|
||||
static const char *wrapper_msgs[] = {
|
||||
"Apollo", /* Lost */
|
||||
"Moon Crunchy", /* South Park */
|
||||
"Snacky Cake", "Chocolate Nuggie", "The Small Bar",
|
||||
"Crispy Yum Yum", "Nilla Crunchie", "Berry Bar",
|
||||
"Choco Nummer", "Om-nom", /* Cat Macro */
|
||||
"Fruity Oaty", /* Serenity */
|
||||
"Wonka Bar" /* Charlie and the Chocolate Factory */
|
||||
};
|
||||
const char *wrapper = candy_wrapper_text(scroll);
|
||||
|
||||
if (Blind) {
|
||||
You_cant("feel any Braille writing.");
|
||||
return 0;
|
||||
}
|
||||
pline("The wrapper reads: \"%s\".",
|
||||
wrapper_msgs[scroll->o_id % SIZE(wrapper_msgs)]);
|
||||
if (!*wrapper) {
|
||||
pline("The candy bar's wrapper is blank.");
|
||||
return 0;
|
||||
}
|
||||
pline("The wrapper reads: \"%s\".", wrapper);
|
||||
u.uconduct.literate++;
|
||||
return 1;
|
||||
} else if (scroll->oclass != SCROLL_CLASS
|
||||
|
||||
Reference in New Issue
Block a user