Skip to content

Commit

Permalink
drowned in a moat on the Plane of Water (trunk only)
Browse files Browse the repository at this point in the history
     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".
  • Loading branch information
nethack.rankin committed Jun 19, 2007
1 parent acc0aa3 commit ed1e29f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
3 changes: 2 additions & 1 deletion doc/fixes35.0
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 20 additions & 13 deletions src/mkmaze.c
Original file line number Diff line number Diff line change
@@ -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. */

Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down
12 changes: 8 additions & 4 deletions src/trap.c
Original file line number Diff line number Diff line change
@@ -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. */

Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit ed1e29f

Please sign in to comment.