pick a random gender subject to any rolenum/racenum/alignnum constraints */ gender and alignment are not comparable (and also not constrainable) */ If pickhow == PICK_RIGID a gender is returned only if there is */ a single possibility */
| 1143 | /* If pickhow == PICK_RIGID a gender is returned only if there is */ |
| 1144 | /* a single possibility */ |
| 1145 | int |
| 1146 | pick_gend(int rolenum, int racenum, int alignnum, int pickhow) |
| 1147 | { |
| 1148 | int i; |
| 1149 | int gends_ok = 0; |
| 1150 | |
| 1151 | for (i = 0; i < ROLE_GENDERS; i++) { |
| 1152 | if (ok_gend(rolenum, racenum, i, alignnum)) |
| 1153 | gends_ok++; |
| 1154 | } |
| 1155 | if (gends_ok == 0 || (gends_ok > 1 && pickhow == PICK_RIGID)) |
| 1156 | return ROLE_NONE; |
| 1157 | gends_ok = rn2(gends_ok); |
| 1158 | for (i = 0; i < ROLE_GENDERS; i++) { |
| 1159 | if (ok_gend(rolenum, racenum, i, alignnum)) { |
| 1160 | if (gends_ok == 0) |
| 1161 | return i; |
| 1162 | else |
| 1163 | gends_ok--; |
| 1164 | } |
| 1165 | } |
| 1166 | return ROLE_NONE; |
| 1167 | } |
| 1168 | |
| 1169 | /* is alignnum compatible with any rolenum/racenum/gendnum constraints? */ |
| 1170 | /* alignment and gender are not comparable (and also not constrainable) */ |
no test coverage detected