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

Function title_to_mon

src/botl.c:366–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366int
367title_to_mon(
368 const char *str,
369 int *rank_indx,
370 int *title_length)
371{
372 int i, j;
373
374 /* Loop through each of the roles */
375 for (i = 0; roles[i].name.m; i++) {
376 /* loop through each of the rank titles for role #i */
377 for (j = 0; j < 9; j++) {
378 if (roles[i].rank[j].m
379 && str_start_is(str, roles[i].rank[j].m, TRUE)) {
380 if (rank_indx)
381 *rank_indx = j;
382 if (title_length)
383 *title_length = Strlen(roles[i].rank[j].m);
384 return roles[i].mnum;
385 }
386 if (roles[i].rank[j].f
387 && str_start_is(str, roles[i].rank[j].f, TRUE)) {
388 if (rank_indx)
389 *rank_indx = j;
390 if (title_length)
391 *title_length = Strlen(roles[i].rank[j].f);
392 return roles[i].mnum;
393 }
394 }
395 }
396 if (title_length)
397 *title_length = 0;
398 return NON_PM;
399}
400
401void
402max_rank_sz(void)

Callers 1

name_to_monplusFunction · 0.85

Calls 1

str_start_isFunction · 0.85

Tested by

no test coverage detected