| 329 | } |
| 330 | |
| 331 | const char * |
| 332 | rank_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 | |
| 360 | staticfn const char * |
| 361 | rank(void) |
no test coverage detected