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

Function str2gend

src/role.c:879–904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

877}
878
879int
880str2gend(const char *str)
881{
882 int i, len;
883
884 /* Is str valid? */
885 if (!str || !str[0])
886 return ROLE_NONE;
887
888 /* Match as much of str as is provided */
889 len = Strlen(str);
890 for (i = 0; i < ROLE_GENDERS; i++) {
891 /* Does it match the adjective? */
892 if (!strncmpi(str, genders[i].adj, len))
893 return i;
894 /* Or the filecode? */
895 if (!strcmpi(str, genders[i].filecode))
896 return i;
897 }
898 if ((len == 1 && (*str == '*' || *str == '@'))
899 || !strncmpi(str, randomstr, len))
900 return ROLE_RANDOM;
901
902 /* Couldn't find anything appropriate */
903 return ROLE_NONE;
904}
905
906boolean
907validalign(int rolenum, int racenum, int alignnum)

Callers 5

early_optionsFunction · 0.85
process_optionsFunction · 0.85
optfn_genderFunction · 0.85
setrolefilterFunction · 0.85
plnamesuffixFunction · 0.85

Calls 1

strncmpiFunction · 0.70

Tested by

no test coverage detected