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

Function toggle_bool_option

src/options.c:9277–9297  ·  view source on GitHub ↗

toggle any (settable in-game) boolean option by name */

Source from the content-addressed store, hash-verified

9275
9276/* toggle any (settable in-game) boolean option by name */
9277int
9278toggle_bool_option(const char *p)
9279{
9280 int i;
9281 int ret = ECMD_FAIL;
9282
9283 for (i = 0; i < OPTCOUNT; i++)
9284 if (!strncmpi(allopt[i].name, p, strlen(p))
9285 && allopt[i].opttyp == BoolOpt
9286 && allopt[i].setwhere == set_in_game
9287 && allopt[i].addr != 0) {
9288 char buf[BUFSZ];
9289
9290 Sprintf(buf, "%s%s", *allopt[i].addr ? "!" : "", allopt[i].name);
9291 if (parseoptions(buf, FALSE, FALSE))
9292 ret = ECMD_OK;
9293
9294 reset_needed_visuals();
9295 }
9296 return ret;
9297}
9298
9299int
9300add_autopickup_exception(const char *mapping)

Callers 1

dotoggleoptionFunction · 0.85

Calls 3

parseoptionsFunction · 0.85
reset_needed_visualsFunction · 0.85
strncmpiFunction · 0.70

Tested by

no test coverage detected