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

@@ -2272,7 +2272,7 @@ int final;
: surface(u.ux, u.uy)); /* catchall; shouldn't happen */
you_are(buf, from_what(WWALKING));
}
if (Upolyd && (u.uundetected || youmonst.m_ap_type != M_AP_NOTHING))
if (Upolyd && (u.uundetected || U_AP_TYPE != M_AP_NOTHING))
youhiding(TRUE, final);
/* internal troubles, mostly in the order that prayer ranks them */
@@ -3094,16 +3094,16 @@ int msgflag; /* for variant message phrasing */
char *bp, buf[BUFSZ];
Strcpy(buf, "hiding");
if (youmonst.m_ap_type != M_AP_NOTHING) {
if (U_AP_TYPE != M_AP_NOTHING) {
/* mimic; hero is only able to mimic a strange object or gold
or hallucinatory alternative to gold, so we skip the details
for the hypothetical furniture and monster cases */
bp = eos(strcpy(buf, "mimicking"));
if (youmonst.m_ap_type == M_AP_OBJECT) {
if (U_AP_TYPE == M_AP_OBJECT) {
Sprintf(bp, " %s", an(simple_typename(youmonst.mappearance)));
} else if (youmonst.m_ap_type == M_AP_FURNITURE) {
} else if (U_AP_TYPE == M_AP_FURNITURE) {
Strcpy(bp, " something");
} else if (youmonst.m_ap_type == M_AP_MONSTER) {
} else if (U_AP_TYPE == M_AP_MONSTER) {
Strcpy(bp, " someone");
} else {
; /* something unexpected; leave 'buf' as-is */