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

Function getoptstr

src/options.c:733–754  ·  view source on GitHub ↗

fetch saved option string for a particular option phase */

Source from the content-addressed store, hash-verified

731
732/* fetch saved option string for a particular option phase */
733staticfn char *
734getoptstr(int optidx, int ophase)
735{
736 int roleoptindx = opt2roleopt(optidx);
737
738 if (ophase == num_opt_phases) { /* any source */
739 int phase;
740
741 /* find non-Null, in order optvals[][play_opt], [cmdline_opt],
742 [environ_opt], [rc_file_opt], [syscf_opt], [builtin_opt] */
743 for (phase = num_opt_phases - 1; phase >= 0; --phase)
744 if (roleoptvals[roleoptindx][phase]) {
745 ophase = phase;
746 break;
747 }
748 }
749 if ((roleoptindx >= 0 && roleoptindx < MAX_ROLEOPT
750 && ophase >= 0 && ophase < num_opt_phases))
751 return roleoptvals[roleoptindx][ophase];
752 panic("bad index roleoptvals[%d][%d]", roleoptindx, ophase);
753 /*NOTREACHED*/
754}
755
756/* to track some unparsed option settings in case #saveoptions needs them */
757staticfn void

Callers 2

parse_role_optFunction · 0.85
get_cnf_role_optFunction · 0.85

Calls 2

opt2roleoptFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected