]> granicus.if.org Git - nethack/commitdiff
Merge branch 'NetHack-3.6'
authornhmall <nhmall@nethack.org>
Sat, 16 Nov 2019 22:01:49 +0000 (17:01 -0500)
committernhmall <nhmall@nethack.org>
Sat, 16 Nov 2019 22:01:49 +0000 (17:01 -0500)
1  2 
src/display.c
src/objnam.c
src/region.c
win/curses/cursstat.c

diff --cc src/display.c
Simple merge
diff --cc src/objnam.c
Simple merge
diff --cc src/region.c
index d918b27d906972e834df38e42450a1492c16782f,9422de20cf04a4dd4322c0f5f2d9fa39c4b378f8..2e177291f6252f3e9e26530def1a56bb7fb964f4
@@@ -428,42 -430,48 +428,48 @@@ xchar x, y
  {
      int i, f_indx;
  
-     /* First check if we can do the move */
+     /* First check if hero can do the move */
 -    for (i = 0; i < n_regions; i++) {
 -        if (regions[i]->attach_2_u)
 +    for (i = 0; i < g.n_regions; i++) {
-         if (inside_region(g.regions[i], x, y) && !hero_inside(g.regions[i])
-             && !g.regions[i]->attach_2_u) {
-             if ((f_indx = g.regions[i]->can_enter_f) != NO_CALLBACK)
-                 if (!(*callbacks[f_indx])(g.regions[i], (genericptr_t) 0))
-                     return FALSE;
-         } else if (hero_inside(g.regions[i]) && !inside_region(g.regions[i], x, y)
-                    && !g.regions[i]->attach_2_u) {
-             if ((f_indx = g.regions[i]->can_leave_f) != NO_CALLBACK)
-                 if (!(*callbacks[f_indx])(g.regions[i], (genericptr_t) 0))
-                     return FALSE;
++        if (g.regions[i]->attach_2_u)
+             continue;
 -        if (inside_region(regions[i], x, y)
 -            ? (!hero_inside(regions[i])
 -               && (f_indx = regions[i]->can_enter_f) != NO_CALLBACK)
 -            : (hero_inside(regions[i])
 -               && (f_indx = regions[i]->can_leave_f) != NO_CALLBACK)) {
 -            if (!(*callbacks[f_indx])(regions[i], (genericptr_t) 0))
++        if (inside_region(g.regions[i], x, y)
++            ? (!hero_inside(g.regions[i])
++               && (f_indx = g.regions[i]->can_enter_f) != NO_CALLBACK)
++            : (hero_inside(g.regions[i])
++               && (f_indx = g.regions[i]->can_leave_f) != NO_CALLBACK)) {
++            if (!(*callbacks[f_indx])(g.regions[i], (genericptr_t) 0))
+                 return FALSE;
          }
      }
  
-     /* Callbacks for the regions we do leave */
-     for (i = 0; i < g.n_regions; i++)
-         if (hero_inside(g.regions[i]) && !g.regions[i]->attach_2_u
+     /* Callbacks for the regions hero does leave */
 -    for (i = 0; i < n_regions; i++) {
 -        if (regions[i]->attach_2_u)
++    for (i = 0; i < g.n_regions; i++) {
++        if (g.regions[i]->attach_2_u)
+             continue;
 -        if (hero_inside(regions[i])
 -            && !inside_region(regions[i], x, y)) {
 -            clear_hero_inside(regions[i]);
 -            if (regions[i]->leave_msg != (const char *) 0)
 -                pline1(regions[i]->leave_msg);
 -            if ((f_indx = regions[i]->leave_f) != NO_CALLBACK)
 -                (void) (*callbacks[f_indx])(regions[i], (genericptr_t) 0);
++        if (hero_inside(g.regions[i])
 +            && !inside_region(g.regions[i], x, y)) {
 +            clear_hero_inside(g.regions[i]);
 +            if (g.regions[i]->leave_msg != (const char *) 0)
 +                pline1(g.regions[i]->leave_msg);
 +            if ((f_indx = g.regions[i]->leave_f) != NO_CALLBACK)
 +                (void) (*callbacks[f_indx])(g.regions[i], (genericptr_t) 0);
          }
+     }
  
-     /* Callbacks for the regions we do enter */
-     for (i = 0; i < g.n_regions; i++)
-         if (!hero_inside(g.regions[i]) && !g.regions[i]->attach_2_u
+     /* Callbacks for the regions hero does enter */
 -    for (i = 0; i < n_regions; i++) {
 -        if (regions[i]->attach_2_u)
++    for (i = 0; i < g.n_regions; i++) {
++        if (g.regions[i]->attach_2_u)
+             continue;
 -        if (!hero_inside(regions[i])
 -            && inside_region(regions[i], x, y)) {
 -            set_hero_inside(regions[i]);
 -            if (regions[i]->enter_msg != (const char *) 0)
 -                pline1(regions[i]->enter_msg);
 -            if ((f_indx = regions[i]->enter_f) != NO_CALLBACK)
 -                (void) (*callbacks[f_indx])(regions[i], (genericptr_t) 0);
++        if (!hero_inside(g.regions[i])
 +            && inside_region(g.regions[i], x, y)) {
 +            set_hero_inside(g.regions[i]);
 +            if (g.regions[i]->enter_msg != (const char *) 0)
 +                pline1(g.regions[i]->enter_msg);
 +            if ((f_indx = g.regions[i]->enter_f) != NO_CALLBACK)
 +                (void) (*callbacks[f_indx])(g.regions[i], (genericptr_t) 0);
          }
+     }
      return TRUE;
  }
  
@@@ -477,40 -485,44 +483,44 @@@ xchar x, y
  {
      int i, f_indx;
  
-     /* First check if we can do the move */
+     /* First check if mon can do the move */
 -    for (i = 0; i < n_regions; i++) {
 -        if (regions[i]->attach_2_m == mon->m_id)
 +    for (i = 0; i < g.n_regions; i++) {
-         if (inside_region(g.regions[i], x, y) && !mon_in_region(g.regions[i], mon)
-             && g.regions[i]->attach_2_m != mon->m_id) {
-             if ((f_indx = g.regions[i]->can_enter_f) != NO_CALLBACK)
-                 if (!(*callbacks[f_indx])(g.regions[i], mon))
-                     return FALSE;
-         } else if (mon_in_region(g.regions[i], mon)
-                    && !inside_region(g.regions[i], x, y)
-                    && g.regions[i]->attach_2_m != mon->m_id) {
-             if ((f_indx = g.regions[i]->can_leave_f) != NO_CALLBACK)
-                 if (!(*callbacks[f_indx])(g.regions[i], mon))
-                     return FALSE;
++        if (g.regions[i]->attach_2_m == mon->m_id)
+             continue;
 -        if (inside_region(regions[i], x, y)
 -            ? (!mon_in_region(regions[i], mon)
 -               && (f_indx = regions[i]->can_enter_f) != NO_CALLBACK)
 -            : (mon_in_region(regions[i], mon)
 -               && (f_indx = regions[i]->can_leave_f) != NO_CALLBACK)) {
 -            if (!(*callbacks[f_indx])(regions[i], mon))
++        if (inside_region(g.regions[i], x, y)
++            ? (!mon_in_region(g.regions[i], mon)
++               && (f_indx = g.regions[i]->can_enter_f) != NO_CALLBACK)
++            : (mon_in_region(g.regions[i], mon)
++               && (f_indx = g.regions[i]->can_leave_f) != NO_CALLBACK)) {
++            if (!(*callbacks[f_indx])(g.regions[i], mon))
+                 return FALSE;
          }
      }
  
-     /* Callbacks for the regions we do leave */
-     for (i = 0; i < g.n_regions; i++)
+     /* Callbacks for the regions mon does leave */
 -    for (i = 0; i < n_regions; i++) {
 -        if (regions[i]->attach_2_m == mon->m_id)
++    for (i = 0; i < g.n_regions; i++) {
++        if (g.regions[i]->attach_2_m == mon->m_id)
+             continue;
 -        if (mon_in_region(regions[i], mon)
 -            && !inside_region(regions[i], x, y)) {
 -            remove_mon_from_reg(regions[i], mon);
 -            if ((f_indx = regions[i]->leave_f) != NO_CALLBACK)
 -                (void) (*callbacks[f_indx])(regions[i], mon);
 +        if (mon_in_region(g.regions[i], mon)
-             && g.regions[i]->attach_2_m != mon->m_id
 +            && !inside_region(g.regions[i], x, y)) {
 +            remove_mon_from_reg(g.regions[i], mon);
 +            if ((f_indx = g.regions[i]->leave_f) != NO_CALLBACK)
 +                (void) (*callbacks[f_indx])(g.regions[i], mon);
          }
+     }
  
-     /* Callbacks for the regions we do enter */
-     for (i = 0; i < g.n_regions; i++)
-         if (!hero_inside(g.regions[i]) && !g.regions[i]->attach_2_u
+     /* Callbacks for the regions mon does enter */
 -    for (i = 0; i < n_regions; i++) {
 -        if (regions[i]->attach_2_m == mon->m_id)
++    for (i = 0; i < g.n_regions; i++) {
++        if (g.regions[i]->attach_2_m == mon->m_id)
+             continue;
 -        if (!mon_in_region(regions[i], mon)
 -            && inside_region(regions[i], x, y)) {
 -            add_mon_to_reg(regions[i], mon);
 -            if ((f_indx = regions[i]->enter_f) != NO_CALLBACK)
 -                (void) (*callbacks[f_indx])(regions[i], mon);
++        if (!mon_in_region(g.regions[i], mon)
 +            && inside_region(g.regions[i], x, y)) {
 +            add_mon_to_reg(g.regions[i], mon);
 +            if ((f_indx = g.regions[i]->enter_f) != NO_CALLBACK)
 +                (void) (*callbacks[f_indx])(g.regions[i], mon);
          }
+     }
      return TRUE;
  }
  
@@@ -596,10 -608,12 +606,12 @@@ xchar x, y
  {
      register int i;
  
-     for (i = 0; i < g.n_regions; i++)
-         if (inside_region(g.regions[i], x, y) && g.regions[i]->visible
-             && g.regions[i]->ttl != -2L)
 -    for (i = 0; i < n_regions; i++) {
 -        if (!regions[i]->visible || regions[i]->ttl == -2L)
++    for (i = 0; i < g.n_regions; i++) {
++        if (!g.regions[i]->visible || g.regions[i]->ttl == -2L)
+             continue;
 -        if (inside_region(regions[i], x, y))
 -            return regions[i];
++        if (inside_region(g.regions[i], x, y))
 +            return g.regions[i];
+     }
      return (NhRegion *) 0;
  }
  
Simple merge