returns a pointer to a new monst structure based on * the one contained within the obj. */
| 2198 | * the one contained within the obj. |
| 2199 | */ |
| 2200 | struct monst * |
| 2201 | get_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 */ |
no test coverage detected