diff --git a/src/detect.c b/src/detect.c index 47ee007ce..d5f78f151 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 detect.c $NHDT-Date: 1703070189 2023/12/20 11:03:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.171 $ */ +/* NetHack 3.7 detect.c $NHDT-Date: 1715284441 2024/05/09 19:54:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.178 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -260,7 +260,8 @@ check_map_spot(coordxy x, coordxy y, char oclass, unsigned material) if (material && objects[glyph_to_obj(glyph)].oc_material == material) { /* object shown here is of interest because material matches */ - for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp->nexthere) + for (otmp = gl.level.objects[x][y]; otmp; + otmp = otmp->nexthere) if (o_material(otmp, GOLD)) return FALSE; /* didn't find it; perhaps a monster is carrying it */ @@ -274,7 +275,8 @@ check_map_spot(coordxy x, coordxy y, char oclass, unsigned material) } if (oclass && objects[glyph_to_obj(glyph)].oc_class == oclass) { /* obj shown here is of interest because its class matches */ - for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp->nexthere) + for (otmp = gl.level.objects[x][y]; otmp; + otmp = otmp->nexthere) if (o_in(otmp, oclass)) return FALSE; /* didn't find it; perhaps a monster is carrying it */ @@ -324,7 +326,7 @@ gold_detect(struct obj *sobj) int ter_typ = TER_DETECT | TER_OBJ; gk.known = stale = clear_stale_map(COIN_CLASS, - (unsigned) (sobj->blessed ? GOLD : 0)); + (unsigned) (sobj->blessed ? GOLD : 0)); /* look for gold carried by monsters (might be in a container) */ for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { @@ -1331,6 +1333,7 @@ use_crystal_ball(struct obj **optr) return; } +/* used by magic mapping, clairvoyance, and wand of probing */ void show_map_spot(coordxy x, coordxy y, boolean cnf) { @@ -1376,6 +1379,9 @@ show_map_spot(coordxy x, coordxy y, boolean cnf) lev->glyph = oldglyph; } } + /* possibly update #overview */ + if (!cnf && lev->roomno >= ROOMOFFSET) + room_discovered(lev->roomno - ROOMOFFSET); } void @@ -1405,7 +1411,8 @@ do_mapping(void) /* clairvoyance */ void -do_vicinity_map(struct obj *sobj) /* scroll--actually fake spellbook--object */ +do_vicinity_map( + struct obj *sobj) /* scroll--actually fake spellbook--object */ { int zx, zy; struct monst *mtmp; diff --git a/src/zap.c b/src/zap.c index b4dc3f286..0cea56935 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 zap.c $NHDT-Date: 1713334819 2024/04/17 06:20:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.532 $ */ +/* NetHack 3.7 zap.c $NHDT-Date: 1715284462 2024/05/09 19:54:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.539 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3644,20 +3644,20 @@ zap_map( } /* !u.uz */ if (obj->otyp == WAN_PROBING) { - schar ltyp; /* * Probing, either up/down or lateral. */ + schar ltyp; + int oldtyp, oldglyph; - /* map unseen terrain */ - if (!cansee(x, y)) { - int oldglyph = glyph_at(x, y); - - show_map_spot(x, y, FALSE); - if (oldglyph != glyph_at(x, y)) { - /* TODO: need to give some message */ - learn_it = TRUE; - } + /* map terrain; might reveal a special room which is already within + view that hasn't been entered yet */ + oldtyp = gl.lastseentyp[x][y]; + oldglyph = glyph_at(x, y); + show_map_spot(x, y, FALSE); + if (oldtyp != gl.lastseentyp[x][y] || oldglyph != glyph_at(x, y)) { + /* TODO: ought to give some message */ + learn_it = TRUE; } ltyp = SURFACE_AT(x, y); /* secret door gets revealed, converted into regular door */