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

Function copy_mextra

src/mon.c:2596–2646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2594}
2595
2596void
2597copy_mextra(struct monst *mtmp2, struct monst *mtmp1)
2598{
2599 if (!mtmp2 || !mtmp1 || !mtmp1->mextra)
2600 return;
2601
2602 if (!mtmp2->mextra)
2603 mtmp2->mextra = newmextra();
2604 if (MGIVENNAME(mtmp1)) {
2605 new_mgivenname(mtmp2, (int) strlen(MGIVENNAME(mtmp1)) + 1);
2606 Strcpy(MGIVENNAME(mtmp2), MGIVENNAME(mtmp1));
2607 }
2608 if (EGD(mtmp1)) {
2609 if (!EGD(mtmp2))
2610 newegd(mtmp2);
2611 assert(has_egd(mtmp2));
2612 *EGD(mtmp2) = *EGD(mtmp1);
2613 }
2614 if (EPRI(mtmp1)) {
2615 if (!EPRI(mtmp2))
2616 newepri(mtmp2);
2617 assert(has_epri(mtmp2));
2618 *EPRI(mtmp2) = *EPRI(mtmp1);
2619 }
2620 if (ESHK(mtmp1)) {
2621 if (!ESHK(mtmp2))
2622 neweshk(mtmp2);
2623 assert(has_eshk(mtmp2));
2624 *ESHK(mtmp2) = *ESHK(mtmp1);
2625 }
2626 if (EMIN(mtmp1)) {
2627 if (!EMIN(mtmp2))
2628 newemin(mtmp2);
2629 assert(has_emin(mtmp2));
2630 *EMIN(mtmp2) = *EMIN(mtmp1);
2631 }
2632 if (EDOG(mtmp1)) {
2633 if (!EDOG(mtmp2))
2634 newedog(mtmp2);
2635 assert(has_edog(mtmp2));
2636 *EDOG(mtmp2) = *EDOG(mtmp1);
2637 }
2638 if (EBONES(mtmp1)) {
2639 if (!EBONES(mtmp2))
2640 newebones(mtmp2);
2641 assert(has_ebones(mtmp2));
2642 *EBONES(mtmp2) = *EBONES(mtmp1);
2643 }
2644 if (has_mcorpsenm(mtmp1))
2645 MCORPSENM(mtmp2) = MCORPSENM(mtmp1);
2646}
2647
2648void
2649dealloc_mextra(struct monst *m)

Callers 3

copy_oextraFunction · 0.85
save_mtraitsFunction · 0.85
get_mtraitsFunction · 0.85

Calls 8

newmextraFunction · 0.70
new_mgivennameFunction · 0.70
newegdFunction · 0.70
newepriFunction · 0.70
neweshkFunction · 0.70
neweminFunction · 0.70
newedogFunction · 0.70
newebonesFunction · 0.70

Tested by

no test coverage detected