Pick a random alignment subject to any rolenum/racenum/gendnum constraints; alignment and gender are not comparable (and also not constrainable). If pickhow == PICK_RIGID an alignment is returned only if there is a single possibility. */
| 1208 | If pickhow == PICK_RIGID an alignment is returned only if there is |
| 1209 | a single possibility. */ |
| 1210 | int |
| 1211 | pick_align(int rolenum, int racenum, int gendnum, int pickhow) |
| 1212 | { |
| 1213 | int i; |
| 1214 | int aligns_ok = 0; |
| 1215 | |
| 1216 | for (i = 0; i < ROLE_ALIGNS; i++) { |
| 1217 | if (ok_align(rolenum, racenum, gendnum, i)) |
| 1218 | aligns_ok++; |
| 1219 | } |
| 1220 | if (aligns_ok == 0 || (aligns_ok > 1 && pickhow == PICK_RIGID)) |
| 1221 | return ROLE_NONE; |
| 1222 | aligns_ok = rn2(aligns_ok); |
| 1223 | for (i = 0; i < ROLE_ALIGNS; i++) { |
| 1224 | if (ok_align(rolenum, racenum, gendnum, i)) { |
| 1225 | if (aligns_ok == 0) |
| 1226 | return i; |
| 1227 | else |
| 1228 | aligns_ok--; |
| 1229 | } |
| 1230 | } |
| 1231 | return ROLE_NONE; |
| 1232 | } |
| 1233 | |
| 1234 | void |
| 1235 | rigid_role_checks(void) |
no test coverage detected