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

Function rank_of

src/botl.c:331–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331const char *
332rank_of(int lev, short monnum, boolean female)
333{
334 const struct Role *role;
335 int i;
336
337 /* Find the role */
338 for (role = roles; role->name.m; role++)
339 if (monnum == role->mnum)
340 break;
341 if (!role->name.m)
342 role = &gu.urole;
343
344 /* Find the rank */
345 for (i = xlev_to_rank((int) lev); i >= 0; i--) {
346 if (female && role->rank[i].f)
347 return role->rank[i].f;
348 if (role->rank[i].m)
349 return role->rank[i].m;
350 }
351
352 /* Try the role name, instead */
353 if (female && role->name.f)
354 return role->name.f;
355 else if (role->name.m)
356 return role->name.m;
357 return "Player";
358}
359
360staticfn const char *
361rank(void)

Callers 15

updateStatsMethod · 0.85
update_valFunction · 0.85
get_mplnameFunction · 0.85
namefloorobjFunction · 0.85
do_name.cFile · 0.85
convert_argFunction · 0.85
livelog_newformFunction · 0.85
xkilledFunction · 0.85
trapnameFunction · 0.85
rankFunction · 0.85
background_enlightenmentFunction · 0.85

Calls 1

xlev_to_rankFunction · 0.85

Tested by

no test coverage detected