another stab at stumble_onto_mimic
The unreliable sanity check is removed.
This commit is contained in:
@@ -289,7 +289,11 @@ object_from_map(
|
||||
boolean fakeobj = FALSE, mimic_obj = FALSE;
|
||||
struct monst *mtmp;
|
||||
struct obj *otmp;
|
||||
int glyphotyp = glyph_to_obj(glyph);
|
||||
int glyphotyp = glyph_is_object(glyph) ? glyph_to_obj(glyph)
|
||||
/* if not an object, probably a detected chest trap */
|
||||
: glyph_is_cmap(glyph) /* assume trapped chest|door */
|
||||
? (sobj_at(CHEST, x, y) ? CHEST : LARGE_BOX)
|
||||
: STRANGE_OBJECT;
|
||||
|
||||
*obj_p = (struct obj *) 0;
|
||||
/* TODO: check inside containers in case glyph came from detection */
|
||||
|
||||
18
src/uhitm.c
18
src/uhitm.c
@@ -6068,26 +6068,22 @@ that_is_a_mimic(
|
||||
else if (M_AP_TYPE(mtmp) == M_AP_MONSTER)
|
||||
what = a_monnam(mtmp); /* differs from what was sensed */
|
||||
} else {
|
||||
int glyph = glyph_at(u.ux + u.dx, u.uy + u.dy);
|
||||
coordxy x = u.ux + u.dx, y = u.uy + u.dy;
|
||||
int glyph = glyph_at(x, y);
|
||||
|
||||
if (glyph_is_cmap(glyph)) {
|
||||
int sym = glyph_to_cmap(glyph);
|
||||
|
||||
#ifdef EXTRA_SANITY_CHECKS
|
||||
if (iflags.sanity_check && (int) mtmp->mappearance != sym)
|
||||
impossible("mimic appearance %u does not match"
|
||||
" map feature %d (glyph=%d)",
|
||||
mtmp->mappearance, sym, glyph);
|
||||
#endif
|
||||
/* note: defsyms[stairs] yields singular "staircase {up|down}" */
|
||||
Snprintf(fmtbuf, sizeof fmtbuf, "That %s actually is %%s!",
|
||||
defsyms[sym].explanation);
|
||||
if (M_AP_TYPE(mtmp) == M_AP_FURNITURE
|
||||
|| (M_AP_TYPE(mtmp) == M_AP_OBJECT && sym == S_trapped_chest))
|
||||
Snprintf(fmtbuf, sizeof fmtbuf, "That %s actually is %%s!",
|
||||
defsyms[sym].explanation);
|
||||
} else if (glyph_is_object(glyph)) {
|
||||
boolean fakeobj;
|
||||
const char *otmp_name;
|
||||
struct obj *otmp = NULL;
|
||||
|
||||
fakeobj = object_from_map(glyph, mtmp->mx, mtmp->my, &otmp);
|
||||
fakeobj = object_from_map(glyph, x, y, &otmp);
|
||||
otmp_name = (otmp && otmp->otyp != STRANGE_OBJECT)
|
||||
? simpleonames(otmp) : "strange object";
|
||||
Snprintf(fmtbuf, sizeof fmtbuf, "%s %s %s %%s!",
|
||||
|
||||
Reference in New Issue
Block a user