water description tweaks

Fix a comment typo and add a couple of extra comments.  The two minor
code changes don't affect behavior but might improve clarity.
This commit is contained in:
PatR
2022-02-09 11:55:08 -08:00
parent 445573a01f
commit cfcfc3429f
+10 -8
View File
@@ -960,7 +960,7 @@ add_cmap_descr(
coord cc, /* map location */ coord cc, /* map location */
const char *x_str, /* description of defsyms[idx] */ const char *x_str, /* description of defsyms[idx] */
const char *prefix, /* text to insert in front of first match */ const char *prefix, /* text to insert in front of first match */
boolean *hit_trap, /* intput/output: True if a trap has been described */ boolean *hit_trap, /* input/output: True if a trap has been described */
const char **firstmatch, /* output: pointer to 1st matching description */ const char **firstmatch, /* output: pointer to 1st matching description */
char *out_str) /* input/output: current description gets appended */ char *out_str) /* input/output: current description gets appended */
{ {
@@ -1218,17 +1218,19 @@ do_screen_description(coord cc, boolean looked, int sym, char *out_str,
for (hit_trap = FALSE, i = 0; i < MAXPCHARS; i++) { for (hit_trap = FALSE, i = 0; i < MAXPCHARS; i++) {
/* /*
* Index hackery: we want * Index hackery: we want
* "a pool or a moat or a wall of water or molten lava" * "a pool or a moat or a wall of water or lava"
* rather than * rather than
* "a pool or a moat or molten lava or a wall of water" * "a pool or a moat or lava or a wall of water"
* but S_lava comes before S_water so 'i' reaches it sooner. * but S_lava comes before S_water so 'i' reaches it sooner.
* Use 'alt_i' for the rest of the loop to behave as if their
* places were swapped.
*/ */
alt_i = i; alt_i = ((i != S_water && i != S_lava) ? i /* as-is */
if (alt_i == S_water || alt_i == S_lava) : (S_water + S_lava) - i); /* swap water and lava */
alt_i = (S_water + S_lava) - alt_i;
x_str = defsyms[alt_i].explanation; x_str = defsyms[alt_i].explanation;
if (sym == (looked ? g.showsyms[alt_i] : defsyms[alt_i].sym) if (!*x_str) /* cmap includes beams, shield effects, swallow +*/
&& *x_str) { continue; /*+ boundaries, and explosions; skip all of those */
if (sym == (looked ? g.showsyms[alt_i] : defsyms[alt_i].sym)) {
int article; /* article==2 => "the", 1 => "an", 0 => (none) */ int article; /* article==2 => "the", 1 => "an", 0 => (none) */
/* check if dark part of a room was already included above */ /* check if dark part of a room was already included above */