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

Function unmakemon

src/makemon.c:1513–1539  ·  view source on GitHub ↗

caller rejects makemon()'s result; always returns Null */

Source from the content-addressed store, hash-verified

1511
1512/* caller rejects makemon()'s result; always returns Null */
1513struct monst *
1514unmakemon(
1515 struct monst *mon,
1516 mmflags_nht mmflags)
1517{
1518 boolean countbirth = ((mmflags & MM_NOCOUNTBIRTH) == 0);
1519 int mndx = monsndx(mon->data);
1520
1521 /* if count has reached the limit of 255, we don't know whether
1522 that just happened when creating this monster or the threshold
1523 had already been reached and further increments were suppressed;
1524 assume the latter */
1525 if (countbirth && svm.mvitals[mndx].born > 0
1526 && svm.mvitals[mndx].born < 255)
1527 svm.mvitals[mndx].born -= 1;
1528 if ((mon->data->geno & G_UNIQ) != 0)
1529 svm.mvitals[mndx].mvflags &= ~G_EXTINCT;
1530
1531 mon->mhp = 0; /* let discard_minvent() know that mon isn't being kept */
1532 /* uncreate any artifact that the monster was provided with; unlike
1533 mongone(), this doesn't protect special items like the Amulet
1534 by dropping them so caller should handle them when applicable */
1535 discard_minvent(mon, TRUE);
1536
1537 mongone(mon);
1538 return (struct monst *) 0;
1539}
1540
1541int
1542mbirth_limit(int mndx)

Callers 1

nastyFunction · 0.85

Calls 2

discard_minventFunction · 0.85
mongoneFunction · 0.85

Tested by

no test coverage detected