mon name buffers

Follow suit with what <Someone> did for the object name buffers,
so that this sort of statement can work correctly:

	pline("%s hits %s.", Monnam(mtmp), mon_nam(mtmp2));
This commit is contained in:
nethack.allison
2003-11-06 02:16:22 +00:00
parent cf07cbf556
commit 0834d51482
2 changed files with 17 additions and 6 deletions

View File

@@ -48,6 +48,7 @@ make it possible for the code to recognize your starting pet throughout the
healers notice when a wand of undead turning revives a monster so the
wand is then identified
update display if bestowed a spellbook while unable to see invisible self
use small pool of static buffers for mon_nam() and Monnam()
Platform- and/or Interface-Specific Fixes

View File

@@ -6,9 +6,23 @@
STATIC_DCL void FDECL(do_oname, (struct obj *));
STATIC_DCL void FDECL(getpos_help, (BOOLEAN_P,const char *));
STATIC_DCL char *NDECL(nextmbuf);
extern const char what_is_an_unknown_object[]; /* from pager.c */
#define NUMMBUF 5
/* manage a pool of BUFSZ buffers, so callers don't have to */
STATIC_OVL char *
nextmbuf()
{
static char NEARDATA bufs[NUMMBUF][BUFSZ];
static int bufidx = 0;
bufidx = (bufidx + 1) % NUMMBUF;
return bufs[bufidx];
}
/* the response for '?' help request in getpos() */
STATIC_OVL void
getpos_help(force, goal)
@@ -579,11 +593,7 @@ int suppress;
*/
boolean called;
{
#ifdef LINT /* static char buf[BUFSZ]; */
char buf[BUFSZ];
#else
static char buf[BUFSZ];
#endif
char *buf = nextmbuf();
struct permonst *mdat = mtmp->data;
boolean do_hallu, do_invis, do_it, do_saddle;
boolean name_at_start, has_adjectives;
@@ -606,7 +616,7 @@ boolean called;
!(suppress & SUPPRESS_IT);
do_saddle = !(suppress & SUPPRESS_SADDLE);
buf[0] = 0;
buf[0] = '\0';
/* unseen monsters, etc. Use "it" */
if (do_it) {