]> granicus.if.org Git - nethack/commitdiff
Merge branch 'NetHack-3.6'
authornhmall <nhmall@nethack.org>
Sun, 23 Jun 2019 02:03:07 +0000 (22:03 -0400)
committernhmall <nhmall@nethack.org>
Sun, 23 Jun 2019 02:03:07 +0000 (22:03 -0400)
1  2 
src/eat.c
src/files.c
src/makemon.c

diff --cc src/eat.c
index 6ba9718e8cb22571e79b23d8aceda926356618ea,efc04cdfb2c51cf18034449774e941f351fd0714..cafbf8f0a4813afcd8153c03d3398b9d271ea0e9
+++ b/src/eat.c
@@@ -1723,11 -1726,11 +1720,12 @@@ struct obj *otmp
  
  /* 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;
      }
  
@@@ -1786,20 -1792,25 +1787,25 @@@ fprefx(otmp
  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) {
@@@ -2595,13 -2605,15 +2600,15 @@@ doeat(
           * 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;
  }
  
diff --cc src/files.c
Simple merge
diff --cc src/makemon.c
index 9d36a3835fc2bb284230af1160b19f0c6914786d,0f731c3539a4741097f9b9bc7b24af825fd40470..4c867fc0da7c3acb89a67ee2158f23811d3a2fb0
@@@ -878,7 -879,7 +879,7 @@@ xchar x, y; /* clone's preferred locati
      }
  
      /* 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)
@@@ -1114,27 -1121,28 +1121,28 @@@ int mmflags
      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? */