From b7b261e8e16b27fe35f6914e3577bedde01d746c Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 25 Oct 2018 14:15:55 -0700 Subject: [PATCH] stinking cloud vs drawbridge While looking at something else, I noticed that newsym() was checking for pool and lava by examining the terrain type directly rather than using the pool and lava checks, so it would never show a gas cloud at a closed drawbridge (the spot in front of the portcullis). Level's terrain at a closed drawbridge spot is DRAWBRIDGE_UP; need to look at drawbridgemask field to figure out whether the accessible terrain at that spot is moat or lava. --- doc/fixes36.2 | 1 + src/display.c | 59 +++++++++++++++++++++++---------------------------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 527c68ab9..5b5f058ce 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -171,6 +171,7 @@ overview information for former hero was not being set properly when bones in Guidebook.mn and Guidebook.txt, the 'I' command mis-described `IX' as displaying inventory items whose bless/curse state is "known" (Guidebook.tex correctly had "unknown") +poison gas (stinking cloud) wasn't shown at drawbridge-up spot Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/display.c b/src/display.c index a142eab91..9aca21fa4 100644 --- a/src/display.c +++ b/src/display.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 display.c $NHDT-Date: 1525056598 2018/04/30 02:49:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.92 $ */ +/* NetHack 3.6 display.c $NHDT-Date: 1540502147 2018/10/25 21:15:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.94 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* and Dave Cohrs, 1990. */ /* NetHack may be freely redistributed. See license for details. */ @@ -512,6 +512,7 @@ warning_of(mon) struct monst *mon; { int wl = 0, tmp = 0; + if (mon_warning(mon)) { tmp = (int) (mon->m_lev / 4); /* match display.h */ wl = (tmp > WARNCOUNT - 1) ? WARNCOUNT - 1 : tmp; @@ -755,38 +756,36 @@ register int x, y; /* normal region shown only on accessible positions, but poison clouds * also shown above lava, pools and moats. */ - if (reg != NULL && (ACCESSIBLE(lev->typ) - || (reg->glyph == cmap_to_glyph(S_poisoncloud) - && (lev->typ == LAVAPOOL || lev->typ == POOL - || lev->typ == MOAT)))) { + if (reg && (ACCESSIBLE(lev->typ) + || (reg->glyph == cmap_to_glyph(S_poisoncloud) + && is_pool_or_lava(x, y)))) { show_region(reg, x, y); return; } + if (x == u.ux && y == u.uy) { - if (canspotself()) { - _map_location(x, y, 0); /* map *under* self */ + int see_self = canspotself(); + + /* update map information for (remembered topology + and object/known trap/terrain glyph) but only display it if + hero can't see him/herself, then show self if appropriate */ + _map_location(x, y, !see_self); + if (see_self) display_self(); - } else - /* we can see what is there */ - _map_location(x, y, 1); } else { mon = m_at(x, y); worm_tail = is_worm_tail(mon); - see_it = - mon && (worm_tail ? (!mon->minvis || See_invisible) - : (mon_visible(mon)) || tp_sensemon(mon) - || MATCH_WARN_OF_MON(mon)); + see_it = mon && (mon_visible(mon) + || (!worm_tail && (tp_sensemon(mon) + || MATCH_WARN_OF_MON(mon)))); if (mon && (see_it || (!worm_tail && Detect_monsters))) { if (mon->mtrapped) { struct trap *trap = t_at(x, y); int tt = trap ? trap->ttyp : NO_TRAP; - /* if monster is in a physical trap, you see the trap too - */ - if (tt == BEAR_TRAP || is_pit(tt) - || tt == WEB) { - trap->tseen = TRUE; - } + /* if monster is in a physical trap, you see trap too */ + if (tt == BEAR_TRAP || is_pit(tt) || tt == WEB) + trap->tseen = 1; } _map_location(x, y, 0); /* map under the monster */ /* also gets rid of any invisibility glyph */ @@ -795,7 +794,7 @@ register int x, y; worm_tail); } else if (mon && mon_warning(mon) && !is_worm_tail(mon)) { display_warning(mon); - } else if (glyph_is_invisible(levl[x][y].glyph)) { + } else if (glyph_is_invisible(lev->glyph)) { map_invisible(x, y); } else _map_location(x, y, 1); /* map the location */\ @@ -808,19 +807,17 @@ register int x, y; if (canspotself()) display_self(); - } else if ((mon = m_at(x, y)) + } else if ((mon = m_at(x, y)) != 0 && ((see_it = (tp_sensemon(mon) || MATCH_WARN_OF_MON(mon) || (see_with_infrared(mon) - && mon_visible(mon)))) + && mon_visible(mon)))) != 0 || Detect_monsters)) { - /* Monsters are printed every time. */ - /* This also gets rid of any invisibility glyph */ + /* Seen or sensed monsters are printed every time. + This also gets rid of any invisibility glyph. */ display_monster(x, y, mon, see_it ? 0 : DETECTED, is_worm_tail(mon) ? TRUE : FALSE); - } else if ((mon = m_at(x, y)) && mon_warning(mon) - && !is_worm_tail(mon)) { + } else if (mon && mon_warning(mon) && !is_worm_tail(mon)) { display_warning(mon); - } /* * If the location is remembered as being both dark (waslit is false) @@ -828,7 +825,6 @@ register int x, y; * * (1) A dark location that the hero could see through night * vision. - * * (2) Darkened while out of the hero's sight. This can happen * when cursed scroll of light is read. * @@ -844,7 +840,7 @@ register int x, y; * These checks and changes must be here and not in back_to_glyph(). * They are dependent on the position being out of sight. */ - else if (Is_rogue_level(&u.uz)) { + } else if (Is_rogue_level(&u.uz)) { if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR) show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr)); else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM @@ -852,8 +848,7 @@ register int x, y; show_glyph(x, y, lev->glyph = cmap_to_glyph(S_stone)); else goto show_mem; - } - else if (!lev->waslit || (flags.dark_room && iflags.use_color)) { + } else if (!lev->waslit || (flags.dark_room && iflags.use_color)) { if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR) show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr)); else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM)