MCPcopy Index your code
hub / github.com/NetHack/NetHack / count_categories

Function count_categories

src/pickup.c:1510–1536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1508}
1509
1510staticfn int
1511count_categories(struct obj *olist, int qflags)
1512{
1513 char *pack;
1514 boolean counted_category;
1515 int ccount = 0;
1516 struct obj *curr;
1517 boolean do_worn = (qflags & WORN_TYPES) != 0;
1518
1519 pack = flags.inv_order;
1520 do {
1521 counted_category = FALSE;
1522 for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
1523 if (curr->oclass == *pack) {
1524 if (do_worn && !(curr->owornmask
1525 & (W_ARMOR | W_ACCESSORY | W_WEAPONS)))
1526 continue;
1527 if (!counted_category) {
1528 ccount++;
1529 counted_category = TRUE;
1530 }
1531 }
1532 }
1533 pack++;
1534 } while (*pack);
1535 return ccount;
1536}
1537
1538/*
1539 * How much the weight of the given container will change when the given

Callers 1

query_categoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected