CapMons[] entries for hallucinatory monster names

Simplify the handling of capitalized hallucinatory monster names
which should be described as "the Bogon" rather than just "Bogon".
Instead of inserting an ESC character to indicate "this entry
should be freed when done", keep track of how many of the entries
come from mons[] (which always come first and shouldn't be freed)
and just free the rest.  So one instance of inserting an ESC and a
couple of skipping it when present and one of testing for it when
freeing are removed.

Also, the check for bogusmons classification code was testing
whether the name started with a letter (or with '@', an obscure
special case for letter()) rather than for the actual type codes
used in dat/bogusmons.txt.  If '@' becomes used as a classification
code (so far it isn't one) any entries using it could have been
misclassified and would be misspelled because it would stay as the
first character.  And existing entry "/r/tard" was also subject to
misclassification, but since it doesn't start with a capital letter
either with or without leading '/' that had no noticeable effect.
If the leading slash was followed by a capital letter there would
have been a different sort of misspelling with that slash missing
in the copy kept in CapMons[].  I knew all that when I first used
letter() but have decided that it is better to extract 'bogon_types'
from bogusmon() in order for the handling to be more consistent.
This commit is contained in:
PatR
2021-11-30 03:28:10 -08:00
parent a2df8ee587
commit 7d84ea0605
2 changed files with 33 additions and 31 deletions

View File

@@ -2194,11 +2194,15 @@ obj_pmname(struct obj *obj)
return "two-legged glorkum-seeker";
}
/* used by bogusmon(next) and also by init_CapMons(rumors.c);
bogon_is_pname(below) checks a hard-coded subset of these rather than
use this list */
const char bogon_codes[] = "-_+|="; /* see dat/bonusmon.txt */
/* fake monsters used to be in a hard-coded array, now in a data file */
char *
bogusmon(char *buf, char *code)
{
static const char bogon_codes[] = "-_+|="; /* see dat/bonusmon.txt */
char *mnam = buf;
if (code)