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

Function contained_gold

src/shk.c:3045–3061  ·  view source on GitHub ↗

count amount of gold inside container 'obj' and any nested containers */

Source from the content-addressed store, hash-verified

3043
3044/* count amount of gold inside container 'obj' and any nested containers */
3045long
3046contained_gold(
3047 struct obj *obj,
3048 boolean even_if_unknown) /* T: all gold; F: limit to known contents */
3049{
3050 struct obj *otmp;
3051 long value = 0L;
3052
3053 /* accumulate contained gold */
3054 for (otmp = obj->cobj; otmp; otmp = otmp->nobj)
3055 if (otmp->oclass == COIN_CLASS)
3056 value += otmp->quan;
3057 else if (Has_contents(otmp) && (otmp->cknown || even_if_unknown))
3058 value += contained_gold(otmp, even_if_unknown);
3059
3060 return value;
3061}
3062
3063staticfn void
3064dropped_container(

Callers 7

check_shop_objFunction · 0.85
hidden_goldFunction · 0.85
really_kick_objectFunction · 0.85
billableFunction · 0.85
addtobillFunction · 0.85
stolen_valueFunction · 0.85
sellobjFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected