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

Function count_obj

src/wizcmds.c:1134–1151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1132}
1133
1134staticfn void
1135count_obj(struct obj *chain, long *total_count, long *total_size,
1136 boolean top, boolean recurse)
1137{
1138 long count, size;
1139 struct obj *obj;
1140
1141 for (count = size = 0, obj = chain; obj; obj = obj->nobj) {
1142 if (top) {
1143 count++;
1144 size += size_obj(obj);
1145 }
1146 if (recurse && obj->cobj)
1147 count_obj(obj->cobj, total_count, total_size, TRUE, TRUE);
1148 }
1149 *total_count += count;
1150 *total_size += size;
1151}
1152
1153DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE_WARNING follows wiz_show_stats */
1154

Callers 3

obj_chainFunction · 0.85
mon_invent_chainFunction · 0.85
contained_statsFunction · 0.85

Calls 1

size_objFunction · 0.85

Tested by

no test coverage detected