]> granicus.if.org Git - nethack/commitdiff
drowned in a moat on the Plane of Water (trunk only)
authornethack.rankin <nethack.rankin>
Tue, 19 Jun 2007 03:58:36 +0000 (03:58 +0000)
committernethack.rankin <nethack.rankin>
Tue, 19 Jun 2007 03:58:36 +0000 (03:58 +0000)
     From the newsgroup:  drowning on the Plane of Water gave cause of
death as "drowned in a moat".  There was already some post-3.4.3 code to
handle naming of moat on Juiblex level as "swamp", but it wasn't used for
drowning's cause of death and we were still getting "drowned in a moat"
there too.  Now the Plane of Water yields "drowned in deep water" and
Juiblex's level yields "drowned in a swamp".

doc/fixes35.0
src/mkmaze.c
src/trap.c

index b9ee5e937fcb10f75db0e2abfbd7e16b481b05f9..3763fd1d3b6d9e4fbef4e7f930d46514f7354fe6 100644 (file)
@@ -60,7 +60,8 @@ try to restrict whistles and musical instruments to monsters that can blow
 thrown potions can sometimes hit a steed's saddle
 sync default documentation of "null" option with the code
 tripping over a cockatrice corpse didn't petrify, even when not wearing boots
-do not call swamps on the Juiblex level "moat" when freezing
+do not call swamps on the Juiblex level "moat" when freezing or drowning;
+       likewise for Plane of Water when drowning
 keep score from wrapping around and becoming negative by capping it
 kicked objects do not slide when on the air or water levels
 when a giant carrying a boulder dies in a pit, ensure that the corpse is
index f398dc2b477810e177764684ca829fb684ecf96c..dd3ca98b520eb57bc7a2b442c5f3cb62211b4f82 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mkmaze.c   3.5     2007/03/02      */
+/*     SCCS Id: @(#)mkmaze.c   3.5     2007/06/18      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1131,7 +1131,8 @@ register int fd;
        was_waterlevel = TRUE;
 }
 
-const char *waterbody_name(x, y)
+const char *
+waterbody_name(x, y)
 xchar x,y;
 {
        register struct rm *lev;
@@ -1141,22 +1142,28 @@ xchar x,y;
                return "drink";         /* should never happen */
        lev = &levl[x][y];
        ltyp = lev->typ;
+       if (ltyp == DRAWBRIDGE_UP)
+           switch (lev->drawbridgemask & DB_UNDER) {
+           case DB_ICE:  ltyp = ICE; break;
+           case DB_LAVA: ltyp = LAVAPOOL; break;
+           case DB_MOAT: ltyp = MOAT; break;
+           default:      ltyp = STONE; break;
+           }
 
-       if (is_lava(x,y))
+       if (ltyp == LAVAPOOL)
                return "lava";
-       else if (ltyp == ICE ||
-                (ltyp == DRAWBRIDGE_UP &&
-                 (levl[x][y].drawbridgemask & DB_UNDER) == DB_ICE))
+       else if (ltyp == ICE)
                return "ice";
-       else if (((ltyp != POOL) && (ltyp != WATER) &&
-         !Is_medusa_level(&u.uz) && !Is_waterlevel(&u.uz) && !Is_juiblex_level(&u.uz)) ||
-          (ltyp == DRAWBRIDGE_UP && (levl[x][y].drawbridgemask & DB_UNDER) == DB_MOAT))
-               return "moat";
-       else if ((ltyp != POOL) && (ltyp != WATER) && Is_juiblex_level(&u.uz))
-               return "swamp";
        else if (ltyp == POOL)
                return "pool of water";
-       else return "water";
+       else if (ltyp == WATER || Is_waterlevel(&u.uz))
+               ;       /* fall through to default return value */
+       else if (Is_juiblex_level(&u.uz))
+               return "swamp";
+       else if (ltyp == MOAT && !Is_medusa_level(&u.uz))
+               return "moat";
+
+       return "water";
 }
 
 STATIC_OVL void
index a0c11294761b1cfeb21e89a75170b8a293b7a245..bf3275135eb39e32ae95e5b535e886d9c1611f85 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)trap.c     3.5     2007/05/26      */
+/*     SCCS Id: @(#)trap.c     3.5     2007/06/18      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -3230,7 +3230,8 @@ boolean *lostsome;
 boolean
 drown()
 {
-       boolean inpool_ok = FALSE, crawl_ok, pool_of_water;
+       const char *pool_of_water;
+       boolean inpool_ok = FALSE, crawl_ok;
        int i, x, y;
 
        /* happily wading in the same contiguous pool */
@@ -3352,12 +3353,15 @@ drown()
        }
        u.uinwater = 1;
        You("drown.");
-       pool_of_water = levl[u.ux][u.uy].typ == POOL || Is_medusa_level(&u.uz);
        for (;;) {
            /* killer format and name are reconstructed every iteration
               because lifesaving resets them */
+           pool_of_water = waterbody_name(u.ux, u.uy);
            killer.format = KILLED_BY_AN;
-           Strcpy(killer.name, pool_of_water ? "pool of water" : "moat");
+           /* avoid "drowned in [a] water" */
+           if (!strcmp(pool_of_water, "water"))
+               pool_of_water = "deep water", killer.format = KILLED_BY;
+           Strcpy(killer.name, pool_of_water);
            done(DROWNING);
            /* oops, we're still alive.  better get out of the water. */
            if (safe_teleds(TRUE)) break;       /* successful life-save */