another stab at stumble_onto_mimic
The unreliable sanity check is removed.
This commit is contained in:
+5
-1
@@ -289,7 +289,11 @@ object_from_map(
|
|||||||
boolean fakeobj = FALSE, mimic_obj = FALSE;
|
boolean fakeobj = FALSE, mimic_obj = FALSE;
|
||||||
struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
struct obj *otmp;
|
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;
|
*obj_p = (struct obj *) 0;
|
||||||
/* TODO: check inside containers in case glyph came from detection */
|
/* TODO: check inside containers in case glyph came from detection */
|
||||||
|
|||||||
+7
-11
@@ -6068,26 +6068,22 @@ that_is_a_mimic(
|
|||||||
else if (M_AP_TYPE(mtmp) == M_AP_MONSTER)
|
else if (M_AP_TYPE(mtmp) == M_AP_MONSTER)
|
||||||
what = a_monnam(mtmp); /* differs from what was sensed */
|
what = a_monnam(mtmp); /* differs from what was sensed */
|
||||||
} else {
|
} 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)) {
|
if (glyph_is_cmap(glyph)) {
|
||||||
int sym = glyph_to_cmap(glyph);
|
int sym = glyph_to_cmap(glyph);
|
||||||
|
|
||||||
#ifdef EXTRA_SANITY_CHECKS
|
if (M_AP_TYPE(mtmp) == M_AP_FURNITURE
|
||||||
if (iflags.sanity_check && (int) mtmp->mappearance != sym)
|
|| (M_AP_TYPE(mtmp) == M_AP_OBJECT && sym == S_trapped_chest))
|
||||||
impossible("mimic appearance %u does not match"
|
Snprintf(fmtbuf, sizeof fmtbuf, "That %s actually is %%s!",
|
||||||
" map feature %d (glyph=%d)",
|
defsyms[sym].explanation);
|
||||||
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);
|
|
||||||
} else if (glyph_is_object(glyph)) {
|
} else if (glyph_is_object(glyph)) {
|
||||||
boolean fakeobj;
|
boolean fakeobj;
|
||||||
const char *otmp_name;
|
const char *otmp_name;
|
||||||
struct obj *otmp = NULL;
|
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)
|
otmp_name = (otmp && otmp->otyp != STRANGE_OBJECT)
|
||||||
? simpleonames(otmp) : "strange object";
|
? simpleonames(otmp) : "strange object";
|
||||||
Snprintf(fmtbuf, sizeof fmtbuf, "%s %s %s %%s!",
|
Snprintf(fmtbuf, sizeof fmtbuf, "%s %s %s %%s!",
|
||||||
|
|||||||
Reference in New Issue
Block a user