create a string like " !Bar !Kni" or " !chaotic" that can be put back into an RC file by #saveoptions */
| 1315 | /* create a string like " !Bar !Kni" or " !chaotic" that can be |
| 1316 | put back into an RC file by #saveoptions */ |
| 1317 | char * |
| 1318 | rolefilterstring(char *outbuf, int which) |
| 1319 | { |
| 1320 | int i; |
| 1321 | |
| 1322 | outbuf[0] = outbuf[1] = '\0'; |
| 1323 | switch (which) { |
| 1324 | case RS_ROLE: |
| 1325 | for (i = 0; i < SIZE(roles) - 1; ++i) { |
| 1326 | if (gr.rfilter.roles[i]) |
| 1327 | Sprintf(eos(outbuf), " !%.3s", roles[i].name.m); |
| 1328 | } |
| 1329 | break; |
| 1330 | case RS_RACE: |
| 1331 | for (i = 0; i < SIZE(races) - 1; ++i) { |
| 1332 | if ((gr.rfilter.mask & races[i].selfmask) != 0) |
| 1333 | Sprintf(eos(outbuf), " !%s", races[i].noun); |
| 1334 | } |
| 1335 | break; |
| 1336 | case RS_GENDER: |
| 1337 | for (i = 0; i < SIZE(genders) - 1; ++i) { |
| 1338 | if ((gr.rfilter.mask & genders[i].allow) != 0) |
| 1339 | Sprintf(eos(outbuf), " !%s", genders[i].adj); |
| 1340 | } |
| 1341 | break; |
| 1342 | case RS_ALGNMNT: |
| 1343 | for (i = 0; i < SIZE(aligns) - 1; ++i) { |
| 1344 | if ((gr.rfilter.mask & aligns[i].allow) != 0) |
| 1345 | Sprintf(eos(outbuf), " !%s", aligns[i].adj); |
| 1346 | } |
| 1347 | break; |
| 1348 | default: |
| 1349 | impossible("rolefilterstring: bad role aspect (%d)", which); |
| 1350 | Strcpy(outbuf, " ?"); |
| 1351 | break; |
| 1352 | } |
| 1353 | /* constructed with a leading space; drop it */ |
| 1354 | return &outbuf[1]; |
| 1355 | } |
| 1356 | |
| 1357 | void |
| 1358 | clearrolefilter(int which) |
no test coverage detected