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

Function get_mtraits

src/mkobj.c:2200–2222  ·  view source on GitHub ↗

returns a pointer to a new monst structure based on * the one contained within the obj. */

Source from the content-addressed store, hash-verified

2198 * the one contained within the obj.
2199 */
2200struct monst *
2201get_mtraits(struct obj *obj, boolean copyof)
2202{
2203 struct monst *mtmp = (struct monst *) 0;
2204 struct monst *mnew = (struct monst *) 0;
2205
2206 if (has_omonst(obj))
2207 mtmp = OMONST(obj);
2208 if (mtmp) {
2209 if (copyof) {
2210 mnew = newmonst();
2211 *mnew = *mtmp;
2212 mnew->mextra = (struct mextra *) 0;
2213 if (mtmp->mextra)
2214 copy_mextra(mnew, mtmp);
2215 } else {
2216 /* Never insert this returned pointer into mon chains! */
2217 mnew = mtmp;
2218 }
2219 mnew->data = &mons[mnew->mnum];
2220 }
2221 return mnew;
2222}
2223
2224/* make an object named after someone listed in the scoreboard file;
2225 never returns Null */

Callers 5

offer_corpseFunction · 0.85
removed_from_iceboxFunction · 0.85
corpse_revive_typeFunction · 0.85
montraitsFunction · 0.85
its_deadFunction · 0.85

Calls 1

copy_mextraFunction · 0.85

Tested by

no test coverage detected