MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / FindArg

Function FindArg

Descent3/args.cpp:106–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106int FindArg(const char *which) {
107 if (which == nullptr)
108 return 0;
109
110 auto which_matches = [which = SkipArgPrefix(which)](char *arg) -> bool {
111 return strcasecmp(which, SkipArgPrefix(arg)) == 0;
112 };
113
114 for (int i = 1; i <= TotalArgs; i++) {
115 if (which_matches(GameArgs[i])) {
116 mprintf(0, "FindArg: Found [%s] at argument index (%d).", which, i);
117 return i;
118 }
119 }
120
121 mprintf(0, "FindArg: Did not find [%s] on command line.", which);
122 return 0;
123}
124
125// Returns index of argument sought, or 0 if not found
126int FindArgChar(const char *which, char singleCharArg) {

Callers 15

GameSequencerFunction · 0.70
EndLevelFunction · 0.70
InitControlsFunction · 0.70
ResumeControlsFunction · 0.70
DoControllerMovementFunction · 0.70
MultiStartServerFunction · 0.70
FindArgCharFunction · 0.70
ifFunction · 0.70
SaveLevelFunction · 0.70
AutoConnectPXOFunction · 0.70
AutoConnectLANIPFunction · 0.70

Calls 1

SkipArgPrefixFunction · 0.85

Tested by

no test coverage detected