fix pull request #636 - the("Capitalized Monster")

Function the() wasn't supposed to be used for monsters because many
of the ones with capitalized names confuse it, but over time multiple
instances of the(mon_nam()) have crept into the code.  Instead of
ripping those out, modify the() to handle that situation better.

Pull request #636 by entrez dealt with this with one extra line of
code, but could end up scanning all the names in mons[] repeatedly
if the("Capitalized string") gets called a lot.  This uses a similar
one line fix but calls a whole new routine that scans through mons[]
once collecting all the relevant special case names.  As a bonus,
it does the same for hallucinatory monster names which name_to_mon()
couldn't handle.

Fixes #626
This commit is contained in:
PatR
2021-11-24 00:24:56 -08:00
parent dc4b98ebdc
commit b2d4b77d3a
5 changed files with 195 additions and 1 deletions

View File

@@ -2270,6 +2270,8 @@ extern void save_oracles(NHFILE *);
extern void restore_oracles(NHFILE *);
extern int doconsult(struct monst *);
extern void rumor_check(void);
extern boolean CapitalMon(const char *);
extern void free_CapMons(void);
/* ### save.c ### */