/* called as you start to eat */
STATIC_OVL void
- start_eating(otmp)
+ start_eating(otmp, already_partly_eaten)
struct obj *otmp;
+ boolean already_partly_eaten;
{
const char *old_nomovemsg, *save_nomovemsg;
+ static char msgbuf[BUFSZ];
debugpline2("start_eating: %s (victual = %s)",
/* note: fmt_ptr() returns a static buffer but supports
return;
}
- if (++context.victual.usedtime >= context.victual.reqtime) {
+ if (++g.context.victual.usedtime >= g.context.victual.reqtime) {
/* print "finish eating" message if they just resumed -dlc */
- done_eating(g.context.victual.reqtime > 1 ? TRUE : FALSE);
- done_eating((context.victual.reqtime > 1
++ done_eating((g.context.victual.reqtime > 1
+ || already_partly_eaten) ? TRUE : FALSE);
return;
}
struct obj *otmp;
{
switch (otmp->otyp) {
- case FOOD_RATION:
+ case FOOD_RATION: /* nutrition 800 */
+ /* 200+800 remains below 1000+1, the satiation threshold */
if (u.uhunger <= 200)
- pline(Hallucination ? "Oh wow, like, superior, man!"
- : "That food really hit the spot!");
- else if (u.uhunger <= 700)
- pline("That satiated your %s!", body_part(STOMACH));
+ pline("%s!", Hallucination ? "Oh wow, like, superior, man"
+ : "This food really hits the spot");
+
+ /* 700-1+800 remains below 1500, the choking threshold which
+ triggers "you're having a hard time getting it down" feedback */
+ else if (u.uhunger < 700)
+ pline("This satiates your %s!", body_part(STOMACH));
+ /* [satiation message may be inaccurate if eating gets interrupted] */
break;
case TRIPE_RATION:
- if (carnivorous(g.youmonst.data) && !humanoid(g.youmonst.data))
- pline("That tripe ration was surprisingly good!");
- else if (maybe_polyd(is_orc(g.youmonst.data), Race_if(PM_ORC)))
- if (carnivorous(youmonst.data) && !humanoid(youmonst.data)) {
++ if (carnivorous(g.youmonst.data) && !humanoid(g.youmonst.data)) {
+ pline("This tripe ration is surprisingly good!");
- } else if (maybe_polyd(is_orc(youmonst.data), Race_if(PM_ORC))) {
++ } else if (maybe_polyd(is_orc(g.youmonst.data), Race_if(PM_ORC))) {
pline(Hallucination ? "Tastes great! Less filling!"
: "Mmm, tripe... not bad!");
- else {
+ } else {
pline("Yak - dog food!");
more_experienced(1, 0);
newexplevel();
/*FALLTHRU*/
default:
if (otmp->otyp == SLIME_MOLD && !otmp->cursed
- && otmp->spe == context.current_fruit) {
+ && otmp->spe == g.context.current_fruit) {
- pline("My, that was a %s %s!",
+ pline("My, this is a %s %s!",
Hallucination ? "primo" : "yummy",
singular(otmp, xname));
} else if (otmp->otyp == APPLE && otmp->cursed && !Sleep_resistance) {
* they shouldn't be able to choke now.
*/
if (u.uhs != SATIATED)
- context.victual.canchoke = FALSE;
- context.victual.o_id = 0;
- context.victual.piece = touchfood(otmp);
- if (context.victual.piece)
- context.victual.o_id = context.victual.piece->o_id;
+ g.context.victual.canchoke = FALSE;
+ g.context.victual.o_id = 0;
+ g.context.victual.piece = touchfood(otmp);
+ if (g.context.victual.piece)
+ g.context.victual.o_id = g.context.victual.piece->o_id;
- You("resume your meal.");
- start_eating(g.context.victual.piece);
+ You("resume %syour meal.",
- (context.victual.usedtime + 1 >= context.victual.reqtime)
++ (g.context.victual.usedtime + 1 >= g.context.victual.reqtime)
+ ? "the last bite of " : "");
- start_eating(context.victual.piece, FALSE);
++ start_eating(g.context.victual.piece, FALSE);
return 1;
}
/* KMH, conduct */
u.uconduct.food++;
- g.context.victual.o_id = 0;
+ already_partly_eaten = otmp->oeaten ? TRUE : FALSE;
- context.victual.o_id = 0;
- context.victual.piece = otmp = touchfood(otmp);
- if (context.victual.piece)
- context.victual.o_id = context.victual.piece->o_id;
- context.victual.usedtime = 0;
+ g.context.victual.piece = otmp = touchfood(otmp);
+ if (g.context.victual.piece)
+ g.context.victual.o_id = g.context.victual.piece->o_id;
+ g.context.victual.usedtime = 0;
/* Now we need to calculate delay and nutritional info.
* The base nutrition calculated here and in eatcorpse() accounts
dont_start = TRUE;
}
consume_oeaten(otmp, 1); /* oeaten >>= 1 */
- } else
+ } else if (!already_partly_eaten) {
fprefx(otmp);
- (context.victual.reqtime == 1) ? "eat" : "begin eating",
+ } else {
+ You("%s %s.",
++ (g.context.victual.reqtime == 1) ? "eat" : "begin eating",
+ doname(otmp));
+ }
}
/* re-calc the nutrition */
* to this method.
* TODO: add in a "remainder" value to be given at the end of the meal.
*/
- if (context.victual.reqtime == 0 || otmp->oeaten == 0)
+ if (g.context.victual.reqtime == 0 || otmp->oeaten == 0)
/* possible if most has been eaten before */
- context.victual.nmod = 0;
- else if ((int) otmp->oeaten >= context.victual.reqtime)
- context.victual.nmod = -((int) otmp->oeaten
- / context.victual.reqtime);
+ g.context.victual.nmod = 0;
+ else if ((int) otmp->oeaten >= g.context.victual.reqtime)
+ g.context.victual.nmod = -((int) otmp->oeaten
+ / g.context.victual.reqtime);
else
- context.victual.nmod = context.victual.reqtime % otmp->oeaten;
- context.victual.canchoke = (u.uhs == SATIATED);
+ g.context.victual.nmod = g.context.victual.reqtime % otmp->oeaten;
+ g.context.victual.canchoke = (u.uhs == SATIATED);
if (!dont_start)
- start_eating(otmp);
+ start_eating(otmp, already_partly_eaten);
return 1;
}
}
/* not all clones caused by player are tame or peaceful */
- if (!g.context.mon_moving) {
- if (!context.mon_moving && mon->mpeaceful) {
++ if (!g.context.mon_moving && mon->mpeaceful) {
if (mon->mtame)
m2->mtame = rn2(max(2 + u.uluck, 2)) ? mon->mtame : 0;
else if (mon->mpeaceful)
boolean countbirth = ((mmflags & MM_NOCOUNTBIRTH) == 0);
unsigned gpflags = (mmflags & MM_IGNOREWATER) ? MM_IGNOREWATER : 0;
- fakemon = zeromonst;
++ fakemon = cg.zeromonst;
+ cc.x = cc.y = 0;
+
/* if caller wants random location, do it here */
if (x == 0 && y == 0) {
- coord cc;
- struct monst fakemon;
-
- cc.x = cc.y = 0; /* lint suppression */
- fakemon = cg.zeromonst;
fakemon.data = ptr; /* set up for goodpos */
- if (!makemon_rnd_goodpos(ptr ? &fakemon : (struct monst *)0,
+ if (!makemon_rnd_goodpos(ptr ? &fakemon : (struct monst *) 0,
gpflags, &cc))
return (struct monst *) 0;
x = cc.x;
y = cc.y;
- } else if (byyou && !in_mklev) {
+ } else if (byyou && !g.in_mklev) {
- coord bypos;
-
- if (enexto_core(&bypos, u.ux, u.uy, ptr, gpflags)) {
- x = bypos.x;
- y = bypos.y;
- } else
+ if (!enexto_core(&cc, u.ux, u.uy, ptr, gpflags))
return (struct monst *) 0;
+ x = cc.x;
+ y = cc.y;
+ }
+
+ /* sanity check */
+ if (!isok(x, y)) {
+ impossible("makemon trying to create a monster at <%d,%d>?", x, y);
+ return (struct monst *) 0;
}
/* Does monster already exist at the position? */