MCPcopy Create free account
hub / github.com/NetHack/NetHack / misc_stats

Function misc_stats

src/wizcmds.c:1283–1399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1281}
1282
1283staticfn void
1284misc_stats(
1285 winid win,
1286 long *total_count, long *total_size)
1287{
1288 char buf[BUFSZ], hdrbuf[QBUFSZ];
1289 long count, size;
1290 int idx;
1291 struct trap *tt;
1292 struct damage *sd; /* shop damage */
1293 struct kinfo *k; /* delayed killer */
1294 struct cemetery *bi; /* bones info */
1295
1296 /* traps and engravings are output unconditionally;
1297 * others only if nonzero
1298 */
1299 count = size = 0L;
1300 for (tt = gf.ftrap; tt; tt = tt->ntrap) {
1301 ++count;
1302 size += (long) sizeof *tt;
1303 }
1304 *total_count += count;
1305 *total_size += size;
1306 Sprintf(hdrbuf, "traps, size %ld", (long) sizeof (struct trap));
1307 Sprintf(buf, template, hdrbuf, count, size);
1308 putstr(win, 0, buf);
1309
1310 count = size = 0L;
1311 engr_stats("engravings, size %ld+text", hdrbuf, &count, &size);
1312 *total_count += count;
1313 *total_size += size;
1314 Sprintf(buf, template, hdrbuf, count, size);
1315 putstr(win, 0, buf);
1316
1317 count = size = 0L;
1318 light_stats("light sources, size %ld", hdrbuf, &count, &size);
1319 if (count || size) {
1320 *total_count += count;
1321 *total_size += size;
1322 Sprintf(buf, template, hdrbuf, count, size);
1323 putstr(win, 0, buf);
1324 }
1325
1326 count = size = 0L;
1327 timer_stats("timers, size %ld", hdrbuf, &count, &size);
1328 if (count || size) {
1329 *total_count += count;
1330 *total_size += size;
1331 Sprintf(buf, template, hdrbuf, count, size);
1332 putstr(win, 0, buf);
1333 }
1334
1335 count = size = 0L;
1336 for (sd = svl.level.damagelist; sd; sd = sd->next) {
1337 ++count;
1338 size += (long) sizeof *sd;
1339 }
1340 if (count || size) {

Callers 1

wiz_show_statsFunction · 0.85

Calls 4

engr_statsFunction · 0.85
light_statsFunction · 0.85
timer_statsFunction · 0.85
region_statsFunction · 0.85

Tested by

no test coverage detected