is alignnum compatible with any rolenum/racenum/gendnum constraints? */ alignment and gender are not comparable (and also not constrainable) */
| 1169 | /* is alignnum compatible with any rolenum/racenum/gendnum constraints? */ |
| 1170 | /* alignment and gender are not comparable (and also not constrainable) */ |
| 1171 | boolean |
| 1172 | ok_align(int rolenum, int racenum, int gendnum UNUSED, int alignnum) |
| 1173 | { |
| 1174 | int i; |
| 1175 | short allow; |
| 1176 | |
| 1177 | if (alignnum >= 0 && alignnum < ROLE_ALIGNS) { |
| 1178 | if (gr.rfilter.mask & aligns[alignnum].allow) |
| 1179 | return FALSE; |
| 1180 | allow = aligns[alignnum].allow; |
| 1181 | if (IndexOkT(rolenum, roles) |
| 1182 | && !(allow & roles[rolenum].allow & ROLE_ALIGNMASK)) |
| 1183 | return FALSE; |
| 1184 | if (IndexOkT(racenum, races) |
| 1185 | && !(allow & races[racenum].allow & ROLE_ALIGNMASK)) |
| 1186 | return FALSE; |
| 1187 | return TRUE; |
| 1188 | } else { |
| 1189 | /* random; check whether any selection is possible */ |
| 1190 | for (i = 0; i < ROLE_ALIGNS; i++) { |
| 1191 | if (gr.rfilter.mask & aligns[i].allow) |
| 1192 | continue; |
| 1193 | allow = aligns[i].allow; |
| 1194 | if (IndexOkT(rolenum, roles) |
| 1195 | && !(allow & roles[rolenum].allow & ROLE_ALIGNMASK)) |
| 1196 | continue; |
| 1197 | if (IndexOkT(racenum, races) |
| 1198 | && !(allow & races[racenum].allow & ROLE_ALIGNMASK)) |
| 1199 | continue; |
| 1200 | return TRUE; |
| 1201 | } |
| 1202 | return FALSE; |
| 1203 | } |
| 1204 | } |
| 1205 | |
| 1206 | /* Pick a random alignment subject to any rolenum/racenum/gendnum constraints; |
| 1207 | alignment and gender are not comparable (and also not constrainable). |
no outgoing calls
no test coverage detected