drowned in a moat on the Plane of Water (trunk only)

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".
This commit is contained in:
nethack.rankin
2007-06-19 03:58:36 +00:00
parent acc0aa3ff3
commit ed1e29f9ca
3 changed files with 30 additions and 18 deletions
+2 -1
View 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 thrown potions can sometimes hit a steed's saddle
sync default documentation of "null" option with the code sync default documentation of "null" option with the code
tripping over a cockatrice corpse didn't petrify, even when not wearing boots 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 keep score from wrapping around and becoming negative by capping it
kicked objects do not slide when on the air or water levels 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 when a giant carrying a boulder dies in a pit, ensure that the corpse is
+20 -13
View 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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1131,7 +1131,8 @@ register int fd;
was_waterlevel = TRUE; was_waterlevel = TRUE;
} }
const char *waterbody_name(x, y) const char *
waterbody_name(x, y)
xchar x,y; xchar x,y;
{ {
register struct rm *lev; register struct rm *lev;
@@ -1141,22 +1142,28 @@ xchar x,y;
return "drink"; /* should never happen */ return "drink"; /* should never happen */
lev = &levl[x][y]; lev = &levl[x][y];
ltyp = lev->typ; 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"; return "lava";
else if (ltyp == ICE || else if (ltyp == ICE)
(ltyp == DRAWBRIDGE_UP &&
(levl[x][y].drawbridgemask & DB_UNDER) == DB_ICE))
return "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) else if (ltyp == POOL)
return "pool of water"; 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 STATIC_OVL void
+8 -4
View 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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -3230,7 +3230,8 @@ boolean *lostsome;
boolean boolean
drown() 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; int i, x, y;
/* happily wading in the same contiguous pool */ /* happily wading in the same contiguous pool */
@@ -3352,12 +3353,15 @@ drown()
} }
u.uinwater = 1; u.uinwater = 1;
You("drown."); You("drown.");
pool_of_water = levl[u.ux][u.uy].typ == POOL || Is_medusa_level(&u.uz);
for (;;) { for (;;) {
/* killer format and name are reconstructed every iteration /* killer format and name are reconstructed every iteration
because lifesaving resets them */ because lifesaving resets them */
pool_of_water = waterbody_name(u.ux, u.uy);
killer.format = KILLED_BY_AN; 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); done(DROWNING);
/* oops, we're still alive. better get out of the water. */ /* oops, we're still alive. better get out of the water. */
if (safe_teleds(TRUE)) break; /* successful life-save */ if (safe_teleds(TRUE)) break; /* successful life-save */