\#overview vs temples and altars

Reported by entrez:  it was possible for #overview to show a line of
just "." if a temple was known and its altar was unknown and no other
features such as thrones or fountains were known on the level.

It now lists "M temples and N altars" when both are present and the
case that yielded "." becomes "a temple".  That's an improvement but
there might be edge cases it gets wrong.  A listing of "a temple and
an altar" is ambiguous because there isn't any way to tell whether the
altar it mentions is inside the temple.  That seems acceptable to me.

I think it should include more alignment information about temples and
altars, instead of just adding "to <your god>" when all known altars
are of hero's alignment, but this doesn't attempt to address that.
This commit is contained in:
PatR
2023-10-14 00:01:33 -07:00
parent 9e65cd7d80
commit 55650666ed
2 changed files with 30 additions and 11 deletions
+3
View File
@@ -1258,6 +1258,9 @@ barbed devils have an attack that sticks you to them
balrogs prefer bullwhip if hero is wielding a weapon balrogs prefer bullwhip if hero is wielding a weapon
ice devils have an additional attack, a slowing touch ice devils have an additional attack, a slowing touch
buff scroll of confuse monster and blessed potion of monster detection buff scroll of confuse monster and blessed potion of monster detection
if a temple was entered while blind, #overview could show a line of just "."
when describing altars if no other interesting features on that level
were known
Fixes to 3.7.0-x General Problems Exposed Via git Repository Fixes to 3.7.0-x General Problems Exposed Via git Repository
+27 -11
View File
@@ -3590,16 +3590,30 @@ tunesuffix(
#endif #endif
#define COMMA (i++ > 0 ? ", " : PREFIX) #define COMMA (i++ > 0 ? ", " : PREFIX)
/* "iterate" once; safe to use as ``if (cond) ADDTOBUF(); else whatever;'' */ /* "iterate" once; safe to use as ``if (cond) ADDTOBUF(); else whatever;'' */
#define ADDNTOBUF(nam, var) \ #define ADDTOBUF(nam, var) \
do { \
if (var) \
Sprintf(eos(buf), "%s%s", COMMA, (nam)); \
} while (0)
#define ADDNTOBUF(nam, var) \
do { \ do { \
if (var) \ if (var) \
Sprintf(eos(buf), "%s%s %s%s", COMMA, seen_string((var), (nam)), \ Sprintf(eos(buf), "%s%s %s%s", COMMA, seen_string((var), (nam)), \
(nam), plur(var)); \ (nam), plur(var)); \
} while (0) } while (0)
#define ADDTOBUF(nam, var) \ /* ADD2NTOBUF: for "M temples and N altars"; seen_string() is safe to use
do { \ multiple times within one expression; so is plur() */
if (var) \ #define ADD2NTOBUF(nam, var, nam2, var2) \
Sprintf(eos(buf), "%s%s", COMMA, (nam)); \ do { \
if (var && var2) { \
Sprintf(eos(buf), "%s%s %s%s and %s %s%s", COMMA, \
seen_string((var), (nam)), (nam), plur(var), \
seen_string((var2), (nam2)), (nam2), plur(var2)); \
} else if (var) { \
ADDNTOBUF(nam, var); \
} else if (var2) { \
ADDNTOBUF(nam2, var2); \
} \
} while (0) } while (0)
static void static void
@@ -3692,14 +3706,16 @@ print_mapseen(
Sprintf(eos(buf), "%s%s", COMMA, Sprintf(eos(buf), "%s%s", COMMA,
an(shop_string(mptr->feat.shoptype))); an(shop_string(mptr->feat.shoptype)));
} }
if (mptr->feat.naltar > 0) { if (mptr->feat.naltar > 0 || mptr->feat.ntemple > 0) {
unsigned atmp; unsigned atmp;
/* Temples + non-temple altars get munged into just "altars" */ /* being aware of a temple doesn't guarantee being aware of its
if (mptr->feat.ntemple != mptr->feat.naltar) altar (via entrance message when entering while blinded, or
ADDNTOBUF("altar", mptr->feat.naltar); possibly it being out of view in an irregularly shaped room);
else FIXME: if all temples present have been desecrated, we ought
ADDNTOBUF("temple", mptr->feat.ntemple); to say so */
ADD2NTOBUF("temple", mptr->feat.ntemple,
"altar", mptr->feat.naltar);
/* only print out altar's god if they are all to your god */ /* only print out altar's god if they are all to your god */
atmp = mptr->feat.msalign; /* 0, 1, 2, 3 */ atmp = mptr->feat.msalign; /* 0, 1, 2, 3 */