]> granicus.if.org Git - nethack/commitdiff
fix #H8769 - steed drowns on Plane of Water
authorPatR <rankin@nethack.org>
Wed, 22 May 2019 21:59:43 +0000 (14:59 -0700)
committerPatR <rankin@nethack.org>
Wed, 22 May 2019 21:59:43 +0000 (14:59 -0700)
Air bubble movement on the Plane of Water manipulated <u.ux,u.uy>
directly when changing hero's coordinates, leaving steed with old
coordinates, resulting in dunking it when the old spot switched from
air to water.  Switch to u_on_newpos() which moves the steed with
the hero and also handles clipping when the screen is too small to
show the whole map at once.

doc/fixes36.3
src/mkmaze.c

index 07257e74bec2899eb964a6a5d56ef006b74e2bce..2293f0c7859d0551b3a704df91b0c09474c34fea 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.10 $ $NHDT-Date: 1558355176 2019/05/20 12:26:16 $
+$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.12 $ $NHDT-Date: 1558562367 2019/05/22 21:59:27 $
 
 This fixes36.3 file is here to capture information about updates in the 3.6.x
 lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -16,6 +16,7 @@ when examining the map with '/' or ';', picking a symbol which is used for
 billing and payment issue as a result of glob coalescing
 glob pricing did not consider weight properly
 glob shop interaction improved to handle more of the expected scenarios
+non-flying steed on Plane of Water would drown when air bubble moved hero
 
 
 Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
index 897830243b059dd54bff4a06d1011a804c80c639..2a8dc226c2b2f27b81b3f65229f167208fde2f31 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 mkmaze.c        $NHDT-Date: 1555022325 2019/04/11 22:38:45 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.68 $ */
+/* NetHack 3.6 mkmaze.c        $NHDT-Date: 1558562368 2019/05/22 21:59:28 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.70 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Pasi Kallinen, 2018. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -503,7 +503,7 @@ fixup_special()
 
         case LR_UPSTAIR:
         case LR_DOWNSTAIR:
       place_it:
+ place_it:
             place_lregion(r->inarea.x1, r->inarea.y1, r->inarea.x2,
                           r->inarea.y2, r->delarea.x1, r->delarea.y1,
                           r->delarea.x2, r->delarea.y2, r->rtype, &lev);
@@ -1399,14 +1399,15 @@ STATIC_DCL void FDECL(mv_bubble, (struct bubble *, int, int, BOOLEAN_P));
 void
 movebubbles()
 {
-    static boolean up;
-    struct bubble *b;
-    int x, y, i, j;
-    struct trap *btrap;
     static const struct rm water_pos = { cmap_to_glyph(S_water), WATER, 0, 0,
                                          0, 0, 0, 0, 0, 0 };
     static const struct rm air_pos = { cmap_to_glyph(S_cloud), AIR, 0, 0, 0,
                                        1, 0, 0, 0, 0 };
+    static boolean up = FALSE;
+    struct bubble *b;
+    struct container *cons;
+    struct trap *btrap;
+    int x, y, i, j;
 
     /* set up the portal the first time bubbles are moved */
     if (!wportal)
@@ -1437,9 +1438,6 @@ movebubbles()
                         /* pick up objects, monsters, hero, and traps */
                         if (OBJ_AT(x, y)) {
                             struct obj *olist = (struct obj *) 0, *otmp;
-                            struct container *cons =
-                                (struct container *) alloc(
-                                    sizeof(struct container));
 
                             while ((otmp = level.objects[x][y]) != 0) {
                                 remove_object(otmp);
@@ -1448,6 +1446,7 @@ movebubbles()
                                 olist = otmp;
                             }
 
+                            cons = (struct container *) alloc(sizeof *cons);
                             cons->x = x;
                             cons->y = y;
                             cons->what = CONS_OBJ;
@@ -1457,10 +1456,8 @@ movebubbles()
                         }
                         if (MON_AT(x, y)) {
                             struct monst *mon = m_at(x, y);
-                            struct container *cons =
-                                (struct container *) alloc(
-                                    sizeof(struct container));
 
+                            cons = (struct container *) alloc(sizeof *cons);
                             cons->x = x;
                             cons->y = y;
                             cons->what = CONS_MON;
@@ -1478,10 +1475,7 @@ movebubbles()
                             mon->mx = mon->my = 0;
                         }
                         if (!u.uswallow && x == u.ux && y == u.uy) {
-                            struct container *cons =
-                                (struct container *) alloc(
-                                    sizeof(struct container));
-
+                            cons = (struct container *) alloc(sizeof *cons);
                             cons->x = x;
                             cons->y = y;
                             cons->what = CONS_HERO;
@@ -1491,10 +1485,7 @@ movebubbles()
                             b->cons = cons;
                         }
                         if ((btrap = t_at(x, y)) != 0) {
-                            struct container *cons =
-                                (struct container *) alloc(
-                                    sizeof(struct container));
-
+                            cons = (struct container *) alloc(sizeof *cons);
                             cons->x = x;
                             cons->y = y;
                             cons->what = CONS_TRAP;
@@ -1887,21 +1878,21 @@ boolean ini;
             }
 
             case CONS_HERO: {
+                struct monst *mtmp = m_at(cons->x, cons->y);
                 int ux0 = u.ux, uy0 = u.uy;
 
-                /* change u.ux0 and u.uy0? */
-                u.ux = cons->x;
-                u.uy = cons->y;
+                u_on_newpos(cons->x, cons->y);
                 newsym(ux0, uy0); /* clean up old position */
 
-                if (MON_AT(cons->x, cons->y)) {
-                    mnexto(m_at(cons->x, cons->y));
+                if (mtmp) {
+                    mnexto(mtmp);
                 }
                 break;
             }
 
             case CONS_TRAP: {
                 struct trap *btrap = (struct trap *) cons->list;
+
                 btrap->tx = cons->x;
                 btrap->ty = cons->y;
                 break;