mextra tweaks (trunk only)

Add new_mname/free_mname functions to make monster name handling be
more like the other extended data and to hide mextra details a bit more.
Add some casts where int and unsigned are being intermixed.  Simplify
christen_monst(); it ought to be changed to have type `void' but I wanted
to avoid modifying another ten or so files.
This commit is contained in:
nethack.rankin
2006-01-08 06:19:42 +00:00
parent 0bdb1fba28
commit 039e051323
6 changed files with 80 additions and 74 deletions

View File

@@ -1853,14 +1853,15 @@ STATIC_OVL int
size_monst(mtmp)
struct monst *mtmp;
{
int sz = sizeof(struct monst);
int sz = (int)sizeof (struct monst);
if (mtmp->mextra) {
if (MNAME(mtmp)) sz += strlen(MNAME(mtmp))+1;
if (EGD(mtmp)) sz += sizeof(struct egd);
if (EPRI(mtmp)) sz += sizeof(struct epri);
if (ESHK(mtmp)) sz += sizeof(struct eshk);
if (EMIN(mtmp)) sz += sizeof(struct emin);
if (EDOG(mtmp)) sz += sizeof(struct edog);
if (MNAME(mtmp)) sz += (int)strlen(MNAME(mtmp)) + 1;
if (EGD(mtmp)) sz += (int)sizeof (struct egd);
if (EPRI(mtmp)) sz += (int)sizeof (struct epri);
if (ESHK(mtmp)) sz += (int)sizeof (struct eshk);
if (EMIN(mtmp)) sz += (int)sizeof (struct emin);
if (EDOG(mtmp)) sz += (int)sizeof (struct edog);
}
return sz;
}
@@ -1964,6 +1965,7 @@ wiz_migrate_mons()
struct permonst *ptr;
struct monst *mtmp;
d_level tolevel;
getlin("How many random monsters to migrate? [0]", inbuf);
if (*inbuf == '\033') return 0;
mcount = atoi(inbuf);