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

Function inv_weight

src/hack.c:4350–4365  ·  view source on GitHub ↗

returns how far beyond the normal capacity the player is currently. */ inv_weight() is negative if the player is below normal capacity. */

Source from the content-addressed store, hash-verified

4348/* returns how far beyond the normal capacity the player is currently. */
4349/* inv_weight() is negative if the player is below normal capacity. */
4350int
4351inv_weight(void)
4352{
4353 struct obj *otmp = gi.invent;
4354 int wt = 0;
4355
4356 while (otmp) {
4357 if (otmp->oclass == COIN_CLASS)
4358 wt += (int) (((long) otmp->quan + 50L) / 100L);
4359 else if (otmp->otyp != BOULDER || !throws_rocks(gy.youmonst.data))
4360 wt += otmp->owt;
4361 otmp = otmp->nobj;
4362 }
4363 gw.wc = weight_cap();
4364 return (wt - gw.wc);
4365}
4366
4367/*
4368 * Returns 0 if below normal capacity, or the number of "capacity units"

Callers 10

cant_squeeze_thruFunction · 0.85
calc_capacityFunction · 0.85
max_capacityFunction · 0.85
nh_timeoutFunction · 0.85
hurtle_stepFunction · 0.85
try_disarmFunction · 0.85
u_init_carry_attr_boostFunction · 0.85
kick_monsterFunction · 0.85
dokickFunction · 0.85
status_enlightenmentFunction · 0.85

Calls 1

weight_capFunction · 0.85

Tested by

no test coverage detected