magic map shops and temples

Have magic mapping add special rooms to known overview data.  Only
affects shops and temples because they're the only rooms tracked.

Most other special rooms revert to normal rooms as soon as they're
entered so there wasn't any point in tracking them.  That might no
longer be the case.

Wand of probing zapped at or through a shop door or even at a shop
wall will add the shop annotation to the overview data.  That works
differently for normal shops than for subrooms in the twin business
theme rooms.  I'm not sure whether any fixing is needed there since
the shop type information gets suppressed as soon as more than one
shop becomes known on a level.
This commit is contained in:
PatR
2024-05-09 12:54:29 -07:00
parent 71cfcc6229
commit 9994f186ec
2 changed files with 23 additions and 16 deletions
+12 -5
View File
@@ -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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */ /* 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 if (material
&& objects[glyph_to_obj(glyph)].oc_material == material) { && objects[glyph_to_obj(glyph)].oc_material == material) {
/* object shown here is of interest because material matches */ /* 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)) if (o_material(otmp, GOLD))
return FALSE; return FALSE;
/* didn't find it; perhaps a monster is carrying it */ /* 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) { if (oclass && objects[glyph_to_obj(glyph)].oc_class == oclass) {
/* obj shown here is of interest because its class matches */ /* 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)) if (o_in(otmp, oclass))
return FALSE; return FALSE;
/* didn't find it; perhaps a monster is carrying it */ /* 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; int ter_typ = TER_DETECT | TER_OBJ;
gk.known = stale = clear_stale_map(COIN_CLASS, 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) */ /* look for gold carried by monsters (might be in a container) */
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
@@ -1331,6 +1333,7 @@ use_crystal_ball(struct obj **optr)
return; return;
} }
/* used by magic mapping, clairvoyance, and wand of probing */
void void
show_map_spot(coordxy x, coordxy y, boolean cnf) 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; lev->glyph = oldglyph;
} }
} }
/* possibly update #overview */
if (!cnf && lev->roomno >= ROOMOFFSET)
room_discovered(lev->roomno - ROOMOFFSET);
} }
void void
@@ -1405,7 +1411,8 @@ do_mapping(void)
/* clairvoyance */ /* clairvoyance */
void 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; int zx, zy;
struct monst *mtmp; struct monst *mtmp;
+11 -11
View File
@@ -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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -3644,20 +3644,20 @@ zap_map(
} /* !u.uz */ } /* !u.uz */
if (obj->otyp == WAN_PROBING) { if (obj->otyp == WAN_PROBING) {
schar ltyp;
/* /*
* Probing, either up/down or lateral. * Probing, either up/down or lateral.
*/ */
schar ltyp;
int oldtyp, oldglyph;
/* map unseen terrain */ /* map terrain; might reveal a special room which is already within
if (!cansee(x, y)) { view that hasn't been entered yet */
int oldglyph = glyph_at(x, y); oldtyp = gl.lastseentyp[x][y];
oldglyph = glyph_at(x, y);
show_map_spot(x, y, FALSE); show_map_spot(x, y, FALSE);
if (oldglyph != glyph_at(x, y)) { if (oldtyp != gl.lastseentyp[x][y] || oldglyph != glyph_at(x, y)) {
/* TODO: need to give some message */ /* TODO: ought to give some message */
learn_it = TRUE; learn_it = TRUE;
}
} }
ltyp = SURFACE_AT(x, y); ltyp = SURFACE_AT(x, y);
/* secret door gets revealed, converted into regular door */ /* secret door gets revealed, converted into regular door */