extend wizard-mode '#stats' command
Extend #stats beyond just monsters and objects. Have it display memory usage for traps, engravings, light sources, timers, pending shop wall/floor repair, regions, bones tracking, named object types, and dungeon overview. No doubt there are other memory consumers that I've overlooked.
This commit is contained in:
@@ -2119,6 +2119,50 @@ int fd;
|
||||
return load;
|
||||
}
|
||||
|
||||
/* to support '#stats' wizard-mode command */
|
||||
void
|
||||
overview_stats(win, statsfmt, total_count, total_size)
|
||||
winid win;
|
||||
const char *statsfmt;
|
||||
long *total_count, *total_size;
|
||||
{
|
||||
char buf[BUFSZ], hdrbuf[QBUFSZ];
|
||||
long ocount, osize, bcount, bsize, acount, asize;
|
||||
struct cemetery *ce;
|
||||
mapseen *mptr = find_mapseen(&u.uz);
|
||||
|
||||
ocount = bcount = acount = osize = bsize = asize = 0L;
|
||||
for (mptr = mapseenchn; mptr; mptr = mptr->next) {
|
||||
++ocount;
|
||||
osize += (long) sizeof *mptr;
|
||||
for (ce = mptr->final_resting_place; ce; ce = ce->next) {
|
||||
++bcount;
|
||||
bsize += (long) sizeof *ce;
|
||||
}
|
||||
if (mptr->custom_lth) {
|
||||
++acount;
|
||||
asize += (long) (mptr->custom_lth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
Sprintf(hdrbuf, "general, size %ld", (long) sizeof (mapseen));
|
||||
Sprintf(buf, statsfmt, hdrbuf, ocount, osize);
|
||||
putstr(win, 0, buf);
|
||||
if (bcount) {
|
||||
Sprintf(hdrbuf, "cemetery, size %ld",
|
||||
(long) sizeof (struct cemetery));
|
||||
Sprintf(buf, statsfmt, hdrbuf, bcount, bsize);
|
||||
putstr(win, 0, buf);
|
||||
}
|
||||
if (acount) {
|
||||
Sprintf(hdrbuf, "annotations, text");
|
||||
Sprintf(buf, statsfmt, hdrbuf, acount, asize);
|
||||
putstr(win, 0, buf);
|
||||
}
|
||||
*total_count += ocount + bcount + acount;
|
||||
*total_size += osize + bsize + asize;
|
||||
}
|
||||
|
||||
/* Remove all mapseen objects for a particular dnum.
|
||||
* Useful during quest expulsion to remove quest levels.
|
||||
* [No longer deleted, just marked as unreachable. #overview will
|
||||
|
||||
Reference in New Issue
Block a user