deal with player's choice to change processing of a condition */
| 1300 | |
| 1301 | /* deal with player's choice to change processing of a condition */ |
| 1302 | void |
| 1303 | condopt(int idx, boolean *addr, boolean negated) |
| 1304 | { |
| 1305 | int i; |
| 1306 | |
| 1307 | /* sanity check */ |
| 1308 | if ((idx < 0 || idx >= CONDITION_COUNT) |
| 1309 | || (addr && addr != &condtests[idx].choice)) |
| 1310 | return; |
| 1311 | |
| 1312 | if (!addr) { |
| 1313 | /* special: indicates a request to init so |
| 1314 | set the choice values to match the defaults */ |
| 1315 | gc.condmenu_sortorder = 0; |
| 1316 | for (i = 0; i < CONDITION_COUNT; ++i) { |
| 1317 | cond_idx[i] = i; |
| 1318 | condtests[i].choice = condtests[i].enabled; |
| 1319 | } |
| 1320 | qsort((genericptr_t) cond_idx, CONDITION_COUNT, |
| 1321 | sizeof cond_idx[0], cond_cmp); |
| 1322 | } else { |
| 1323 | /* (addr == &condtests[idx].choice) */ |
| 1324 | condtests[idx].enabled = negated ? FALSE : TRUE; |
| 1325 | condtests[idx].choice = condtests[idx].enabled; |
| 1326 | /* avoid lingering false positives if test is no longer run */ |
| 1327 | condtests[idx].test = FALSE; |
| 1328 | } |
| 1329 | } |
| 1330 | |
| 1331 | /* qsort callback routine for sorting the condition index */ |
| 1332 | staticfn int QSORTCALLBACK |
no test coverage detected