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

Function init_dummyobj

src/mkobj.c:3346–3370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3344 obj.h that take an obj pointer to work; used when applying a stethoscope
3345 toward a mimic mimicking an object */
3346struct obj *
3347init_dummyobj(struct obj *obj, short otyp, long oquan)
3348{
3349 if (obj) {
3350 *obj = cg.zeroobj;
3351 obj->otyp = otyp;
3352 obj->oclass = objects[otyp].oc_class;
3353 /* obj->dknown = 0; */
3354 /* suppress known except for amulets (needed for fakes & real AoY) */
3355 obj->known = (obj->oclass == AMULET_CLASS)
3356 ? obj->known
3357 /* default is "on" for types which don't use it */
3358 : !objects[otyp].oc_uses_known;
3359 obj->quan = oquan ? oquan : 1L;
3360 obj->corpsenm = NON_PM; /* suppress statue and figurine details */
3361 if (obj->otyp == LEASH)
3362 obj->leashmon = 0; /* overloads corpsenm, avoid NON_PM */
3363 if (obj->otyp == BOULDER)
3364 obj->next_boulder = 0; /* overloads corpsenm, avoid NON_PM */
3365 /* but suppressing fruit details leads to "bad fruit #0" */
3366 if (obj->otyp == SLIME_MOLD)
3367 obj->spe = svc.context.current_fruit;
3368 }
3369 return obj;
3370}
3371
3372/* obj sanity check: check objects inside container */
3373staticfn void

Callers 1

use_stethoscopeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected