MCPcopy Index your code
hub / github.com/NetHack/NetHack / rolefilterstring

Function rolefilterstring

src/role.c:1317–1355  ·  view source on GitHub ↗

create a string like " !Bar !Kni" or " !chaotic" that can be put back into an RC file by #saveoptions */

Source from the content-addressed store, hash-verified

1315/* create a string like " !Bar !Kni" or " !chaotic" that can be
1316 put back into an RC file by #saveoptions */
1317char *
1318rolefilterstring(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
1357void
1358clearrolefilter(int which)

Callers 1

parse_role_optFunction · 0.85

Calls 2

eosFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected