preserve dknown field between fakeobj instances

Preserve temporary fake object's previous dknown value by storing it
as a flag value within the m_ap_type field of the posing monster, and
recalling it when it is needed.

This is intended to help eliminate observable differences in price display
between real objects and mimics posing as objects.

98% of this is just switching the code to utilize macro M_AP_TYPE(mon)
everywhere to ensure that the flag bits are stripped off when needed.
This commit is contained in:
nhmall
2019-04-22 14:17:18 -04:00
parent cd6b5ef933
commit dcf4da2150
30 changed files with 127 additions and 115 deletions

View File

@@ -655,7 +655,7 @@ int class; /* an object class, 0 for all */
if (do_dknown)
do_dknown_of(obj);
}
if ((is_cursed && mtmp->m_ap_type == M_AP_OBJECT
if ((is_cursed && M_AP_TYPE(mtmp) == M_AP_OBJECT
&& (!class || class == objects[mtmp->mappearance].oc_class))
|| (findgold(mtmp->minvent) && (!class || class == COIN_CLASS))) {
ct++;
@@ -730,7 +730,7 @@ int class; /* an object class, 0 for all */
break;
}
/* Allow a mimic to override the detected objects it is carrying. */
if (is_cursed && mtmp->m_ap_type == M_AP_OBJECT
if (is_cursed && M_AP_TYPE(mtmp) == M_AP_OBJECT
&& (!class || class == objects[mtmp->mappearance].oc_class)) {
struct obj temp;
@@ -1469,7 +1469,7 @@ genericptr_t num;
(*(int *) num)++;
}
} else if ((mtmp = m_at(zx, zy)) != 0) {
if (mtmp->m_ap_type) {
if (M_AP_TYPE(mtmp)) {
seemimic(mtmp);
(*(int *) num)++;
}
@@ -1633,7 +1633,7 @@ boolean via_warning;
if (via_warning && !warning_of(mtmp))
return -1;
if (mtmp->m_ap_type) {
if (M_AP_TYPE(mtmp)) {
seemimic(mtmp);
found_something = TRUE;
} else if (!canspotmon(mtmp)) {
@@ -1862,7 +1862,7 @@ int default_glyph, which_subset;
/* look for a mimic here posing as furniture;
if we don't find one, we'll have to fake it */
if ((mtmp = m_at(x, y)) != 0
&& mtmp->m_ap_type == M_AP_FURNITURE) {
&& M_AP_TYPE(mtmp) == M_AP_FURNITURE) {
glyph = cmap_to_glyph(mtmp->mappearance);
} else {
/* we have a topology type but we want a screen