]> granicus.if.org Git - nethack/commitdiff
Merge branch 'NetHack-3.6'
authornhmall <nhmall@nethack.org>
Thu, 30 May 2019 22:10:41 +0000 (18:10 -0400)
committernhmall <nhmall@nethack.org>
Thu, 30 May 2019 22:10:41 +0000 (18:10 -0400)
1  2 
include/hack.h
src/mkmaze.c
src/mon.c
src/pickup.c
src/teleport.c

diff --cc include/hack.h
index b8a747119915d0b0f006d0e52c7aaede1fe69565,8cb0b7253031e9a39f1271b2ae0d78bc7abf8de6..159abb57102ce566452081a73479a10e2398f31a
  #define OFF 0
  #define BOLT_LIM 8        /* from this distance ranged attacks will be made */
  #define MAX_CARR_CAP 1000 /* so that boulders can be heavier */
- #define DUMMY \
-     {         \
-         0     \
-     }
+ #define DUMMY { 0 }       /* array initializer, letting [1..N-1] default */
  
 +/* The UNDEFINED macros are used to initialize variables whose
 +   initialized value is not relied upon.
 +   UNDEFINED_VALUE: used to initialize any scalar type except pointers.
 +   UNDEFINED_VALUES: used to initialize any non scalar type without pointers.
 +   UNDEFINED_PTR: can be used only on pointer types. */
 +#define UNDEFINED_VALUE 0
 +#define UNDEFINED_VALUES { 0 }
 +#define UNDEFINED_PTR NULL
 +
  /* symbolic names for capacity levels */
  enum encumbrance_types {
      UNENCUMBERED = 0,
diff --cc src/mkmaze.c
Simple merge
diff --cc src/mon.c
index 20ee07b746778711ef2564ef92a5f6562d5a61da,de07a96a6db121aa2cdc0b63b6fc31e461d5f815..7a8ec71bfd8f1c1fed06c5b03192bcbe8f5f94b6
+++ b/src/mon.c
@@@ -2597,10 -2600,8 +2598,8 @@@ struct monst *mtmp
          m_into_limbo(mtmp);
          return;
      }
-     if (!isok(mm.x, mm.y))
-         return;
      rloc_to(mtmp, mm.x, mm.y);
 -    if (!in_mklev && (mtmp->mstrategy & STRAT_APPEARMSG)) {
 +    if (!g.in_mklev && (mtmp->mstrategy & STRAT_APPEARMSG)) {
          mtmp->mstrategy &= ~STRAT_APPEARMSG; /* one chance only */
          if (!couldspot && canspotmon(mtmp))
              pline("%s suddenly %s!", Amonnam(mtmp),
diff --cc src/pickup.c
index 84ac8e448e2591382b31cc9e193ea0a83c24f9c7,151a63808d06e9665158553ad4998569d1bb5f84..19be7a71b14f834336ed1b044dff3c521b7088f5
@@@ -2556,14 -2569,14 +2556,14 @@@ boolean more_containers; /* True iff #l
       * or
       * <The/Your/Shk's container> is empty.  Do what with it? [:irs nq or ?]
       */
-     for (;;) { /* repeats iff '?' or ":' gets chosen */
+     for (;;) { /* repeats iff '?' or ':' gets chosen */
 -        outmaybe = (outokay || !current_container->cknown);
 +        outmaybe = (outokay || !g.current_container->cknown);
          if (!outmaybe)
              (void) safe_qbuf(qbuf, (char *) 0, " is empty.  Do what with it?",
 -                             current_container, Yname2, Ysimple_name2,
 +                             g.current_container, Yname2, Ysimple_name2,
                               "This");
          else
 -            (void) safe_qbuf(qbuf, "Do what with ", "?", current_container,
 +            (void) safe_qbuf(qbuf, "Do what with ", "?", g.current_container,
                               yname, ysimple_name, "it");
          /* ask player about what to do with this container */
          if (flags.menu_style == MENU_PARTIAL
diff --cc src/teleport.c
index 956d1945375d6209f5dc88fa32edc41ba157cf95,fe5689aeb24bf4b268073c35f33adb74d2f8c56b..24a4bd1869ac8f9582d5f722df4bec03f6b9d543
@@@ -36,7 -39,8 +36,8 @@@ unsigned gpflags
       * which could be co-located and thus get restricted a bit too much.
       * oh well.
       */
-     if (mtmp != &g.youmonst && x == u.ux && y == u.uy
+     if (x == u.ux && y == u.uy
 -        && mtmp != &youmonst && (mtmp != u.ustuck || !u.uswallow)
++        && mtmp != &g.youmonst && (mtmp != u.ustuck || !u.uswallow)
          && (!u.usteed || mtmp != u.usteed))
          return FALSE;
  
@@@ -126,9 -132,16 +129,16 @@@ unsigned entflags
          /* default to player's original monster type */
          mdat = &mons[u.umonster];
      }
 -    fakemon = zeromonst;
 +    fakemon = cg.zeromonst;
      set_mon_data(&fakemon, mdat); /* set up for goodpos */
  
+     /* used to use 'if (range > ROWNO && range > COLNO) return FALSE' below,
+        so effectively 'max(ROWNO, COLNO)' which performs useless iterations
+        (possibly many iterations if <xx,yy> is in the center of the map) */
+     xmax = max(xx - 1, (COLNO - 1) - xx);
+     ymax = max(yy - 0, (ROWNO - 1) - yy);
+     rangemax = max(xmax, ymax);
+     /* setup: no suitable spots yet, first iteration checks adjacent spots */
      good_ptr = good;
      range = 1;
      /*
@@@ -858,9 -879,9 +876,9 @@@ level_tele(
           * we let negative values requests fall into the "heaven" loop.
           */
          if (In_quest(&u.uz) && newlev > 0)
 -            newlev = newlev + dungeons[u.uz.dnum].depth_start - 1;
 +            newlev = newlev + g.dungeons[u.uz.dnum].depth_start - 1;
      } else { /* involuntary level tele */
-     random_levtport:
+  random_levtport:
          newlev = random_teleport_level();
          if (newlev == depth(&u.uz)) {
              You1(shudder_for_moment);