memory #stats

obj->oextra->omonst might contain monst->mextra plus mextra->edog, &c.
That was being ignored when summing up memory allocated for objects.
This commit is contained in:
PatR
2018-12-28 15:06:45 -08:00
parent fc504dfa89
commit 5846aee283
+6 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1545128652 2018/12/18 10:24:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.322 $ */ /* NetHack 3.6 cmd.c $NHDT-Date: 1546038393 2018/12/28 23:06:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.323 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -3664,18 +3664,18 @@ STATIC_OVL int
size_obj(otmp) size_obj(otmp)
struct obj *otmp; struct obj *otmp;
{ {
int sz = (int) sizeof(struct obj); int sz = (int) sizeof (struct obj);
if (otmp->oextra) { if (otmp->oextra) {
sz += (int) sizeof(struct oextra); sz += (int) sizeof (struct oextra);
if (ONAME(otmp)) if (ONAME(otmp))
sz += (int) strlen(ONAME(otmp)) + 1; sz += (int) strlen(ONAME(otmp)) + 1;
if (OMONST(otmp)) if (OMONST(otmp))
sz += (int) sizeof(struct monst); sz += size_monst(OMONST(otmp), FALSE);
if (OMID(otmp)) if (OMID(otmp))
sz += (int) sizeof(unsigned); sz += (int) sizeof (unsigned);
if (OLONG(otmp)) if (OLONG(otmp))
sz += (int) sizeof(long); sz += (int) sizeof (long);
if (OMAILCMD(otmp)) if (OMAILCMD(otmp))
sz += (int) strlen(OMAILCMD(otmp)) + 1; sz += (int) strlen(OMAILCMD(otmp)) + 1;
} }