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

Function cmp_init_mongen_order

src/makemon.c:1759–1777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1757static boolean mongen_order_init = FALSE;
1758
1759staticfn int QSORTCALLBACK
1760cmp_init_mongen_order(const void *p1, const void *p2)
1761{
1762 int i1 = *((int *) p1), i2 = *((int *) p2);
1763 #if 0
1764 /* This will cause these to be moved last in the mlet sort order */
1765 int offset1 = ((mons[i1].geno & (G_NOGEN | G_UNIQ)) != 0) ? 99 : 0,
1766 offset2 = ((mons[i2].geno & (G_NOGEN | G_UNIQ)) != 0) ? 99 : 0;
1767#else
1768 int offset1 = 0, offset2 = 0;
1769#endif
1770
1771 /* incorporate the mlet into the sort values for comparison */
1772 int difficulty1 =
1773 ((mons[i1].difficulty + offset1) | ((int) mons[i1].mlet << 8)),
1774 difficulty2 =
1775 ((mons[i2].difficulty + offset2) | ((int) mons[i2].mlet << 8));
1776 return difficulty1 - difficulty2;
1777}
1778
1779#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
1780staticfn void check_mongen_order(void);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected