From ed1e29f9ca51cef5c0d93842a0b15e04b871c376 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Tue, 19 Jun 2007 03:58:36 +0000 Subject: [PATCH] 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". --- doc/fixes35.0 | 3 ++- src/mkmaze.c | 33 ++++++++++++++++++++------------- src/trap.c | 12 ++++++++---- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index b9ee5e937..3763fd1d3 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 diff --git a/src/mkmaze.c b/src/mkmaze.c index f398dc2b4..dd3ca98b5 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -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 diff --git a/src/trap.c b/src/trap.c index a0c112947..bf3275135 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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 */