| 810 | } |
| 811 | |
| 812 | int |
| 813 | str2race(const char *str) |
| 814 | { |
| 815 | int i, len; |
| 816 | |
| 817 | /* Is str valid? */ |
| 818 | if (!str || !str[0]) |
| 819 | return ROLE_NONE; |
| 820 | |
| 821 | /* Match as much of str as is provided */ |
| 822 | len = Strlen(str); |
| 823 | for (i = 0; races[i].noun; i++) { |
| 824 | /* Does it match the noun? */ |
| 825 | if (!strncmpi(str, races[i].noun, len)) |
| 826 | return i; |
| 827 | /* check adjective too */ |
| 828 | if (races[i].adj && !strncmpi(str, races[i].adj, len)) |
| 829 | return i; |
| 830 | /* Or the filecode? */ |
| 831 | if (!strcmpi(str, races[i].filecode)) |
| 832 | return i; |
| 833 | } |
| 834 | |
| 835 | if ((len == 1 && (*str == '*' || *str == '@')) |
| 836 | || !strncmpi(str, randomstr, len)) |
| 837 | return ROLE_RANDOM; |
| 838 | |
| 839 | /* Couldn't find anything appropriate */ |
| 840 | return ROLE_NONE; |
| 841 | } |
| 842 | |
| 843 | boolean |
| 844 | validgend(int rolenum, int racenum, int gendnum) |
no test coverage detected