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

Function count_worn_stuff

src/do_wear.c:1732–1766  ·  view source on GitHub ↗

assign values to Narmorpieces and Naccessories */

Source from the content-addressed store, hash-verified

1730
1731/* assign values to Narmorpieces and Naccessories */
1732staticfn void
1733count_worn_stuff(
1734 struct obj **which, /* caller wants this when count is 1 */
1735 boolean accessorizing)
1736{
1737 struct obj *otmp;
1738
1739 Narmorpieces = Naccessories = 0;
1740
1741#define MOREWORN(x,wtyp) do { if (x) { wtyp++; otmp = x; } } while (0)
1742 otmp = 0;
1743 MOREWORN(uarmh, Narmorpieces);
1744 MOREWORN(uarms, Narmorpieces);
1745 MOREWORN(uarmg, Narmorpieces);
1746 MOREWORN(uarmf, Narmorpieces);
1747 /* for cloak/suit/shirt, we only count the outermost item so that it
1748 can be taken off without confirmation if final count ends up as 1 */
1749 if (uarmc)
1750 MOREWORN(uarmc, Narmorpieces);
1751 else if (uarm)
1752 MOREWORN(uarm, Narmorpieces);
1753 else if (uarmu)
1754 MOREWORN(uarmu, Narmorpieces);
1755 if (!accessorizing)
1756 *which = otmp; /* default item iff Narmorpieces is 1 */
1757
1758 otmp = 0;
1759 MOREWORN(uleft, Naccessories);
1760 MOREWORN(uright, Naccessories);
1761 MOREWORN(uamul, Naccessories);
1762 MOREWORN(ublindf, Naccessories);
1763 if (accessorizing)
1764 *which = otmp; /* default item iff Naccessories is 1 */
1765#undef MOREWORN
1766}
1767
1768/* take off one piece or armor or one accessory;
1769 shared by dotakeoff('T') and doremring('R') */

Callers 2

dotakeoffFunction · 0.85
doremringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected