is gendnum compatible with any rolenum/racenum/alignnum constraints? */ gender and alignment are not comparable (and also not constrainable) */
| 1104 | /* is gendnum compatible with any rolenum/racenum/alignnum constraints? */ |
| 1105 | /* gender and alignment are not comparable (and also not constrainable) */ |
| 1106 | boolean |
| 1107 | ok_gend(int rolenum, int racenum, int gendnum, int alignnum UNUSED) |
| 1108 | { |
| 1109 | int i; |
| 1110 | short allow; |
| 1111 | |
| 1112 | if (gendnum >= 0 && gendnum < ROLE_GENDERS) { |
| 1113 | if (gr.rfilter.mask & genders[gendnum].allow) |
| 1114 | return FALSE; |
| 1115 | allow = genders[gendnum].allow; |
| 1116 | if (IndexOkT(rolenum, roles) |
| 1117 | && !(allow & roles[rolenum].allow & ROLE_GENDMASK)) |
| 1118 | return FALSE; |
| 1119 | if (IndexOkT(racenum, races) |
| 1120 | && !(allow & races[racenum].allow & ROLE_GENDMASK)) |
| 1121 | return FALSE; |
| 1122 | return TRUE; |
| 1123 | } else { |
| 1124 | /* random; check whether any selection is possible */ |
| 1125 | for (i = 0; i < ROLE_GENDERS; i++) { |
| 1126 | if (gr.rfilter.mask & genders[i].allow) |
| 1127 | continue; |
| 1128 | allow = genders[i].allow; |
| 1129 | if (IndexOkT(rolenum, roles) |
| 1130 | && !(allow & roles[rolenum].allow & ROLE_GENDMASK)) |
| 1131 | continue; |
| 1132 | if (IndexOkT(racenum, races) |
| 1133 | && !(allow & races[racenum].allow & ROLE_GENDMASK)) |
| 1134 | continue; |
| 1135 | return TRUE; |
| 1136 | } |
| 1137 | return FALSE; |
| 1138 | } |
| 1139 | } |
| 1140 | |
| 1141 | /* pick a random gender subject to any rolenum/racenum/alignnum constraints */ |
| 1142 | /* gender and alignment are not comparable (and also not constrainable) */ |
no outgoing calls
no test coverage detected