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

Function copy_oextra

src/mkobj.c:416–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414}
415
416void
417copy_oextra(struct obj *obj2, struct obj *obj1)
418{
419 if (!obj2 || !obj1 || !obj1->oextra)
420 return;
421
422 if (!obj2->oextra)
423 obj2->oextra = newoextra();
424 if (has_oname(obj1))
425 oname(obj2, ONAME(obj1), ONAME_SKIP_INVUPD);
426 if (has_omonst(obj1)) {
427 if (!OMONST(obj2))
428 newomonst(obj2);
429 assert(has_omonst(obj2));
430 (void) memcpy((genericptr_t) OMONST(obj2),
431 (genericptr_t) OMONST(obj1), sizeof (struct monst));
432 OMONST(obj2)->mextra = (struct mextra *) 0;
433 OMONST(obj2)->nmon = (struct monst *) 0;
434#if 0
435 OMONST(obj2)->m_id = next_ident();
436#endif
437 if (OMONST(obj1)->mextra)
438 copy_mextra(OMONST(obj2), OMONST(obj1));
439 }
440 if (has_omailcmd(obj1)) {
441 new_omailcmd(obj2, OMAILCMD(obj1));
442 }
443 if (has_omid(obj1)) {
444 if (!OMID(obj2))
445 newomid(obj2);
446 OMID(obj2) = OMID(obj1);
447 }
448}
449
450/*
451 * Split stack so that its size gets reduced by num. The quantity num is

Callers 2

splitobjFunction · 0.85
bill_dummy_objectFunction · 0.85

Calls 7

onameFunction · 0.85
next_identFunction · 0.85
copy_mextraFunction · 0.85
newoextraFunction · 0.70
newomonstFunction · 0.70
new_omailcmdFunction · 0.70
newomidFunction · 0.70

Tested by

no test coverage detected