MCPcopy Create free account
hub / github.com/ZDoom/Raze / C_DoCommand

Function C_DoCommand

source/common/console/c_dispatch.cpp:193–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191// CODE --------------------------------------------------------------------
192
193void C_DoCommand (const char *cmd, int keynum)
194{
195 FConsoleCommand *com;
196 const char *end;
197 const char *beg;
198
199 // Skip any beginning whitespace
200 while (*cmd > 0 && *cmd <= ' ')
201 cmd++;
202
203 // Find end of the command name
204 if (*cmd == '\"')
205 {
206 for (end = beg = cmd+1; *end && *end != '\"'; ++end)
207 ;
208 }
209 else
210 {
211 beg = cmd;
212 for (end = cmd+1; *end > ' ' || *end < 0; ++end)
213 ;
214 }
215
216 const size_t len = end - beg;
217
218 if (ParsingKeyConf)
219 {
220 int i;
221
222 for (i = countof(KeyConfCommands)-1; i >= 0; --i)
223 {
224 if (strnicmp (beg, KeyConfCommands[i], len) == 0 &&
225 KeyConfCommands[i][len] == 0)
226 {
227 break;
228 }
229 }
230 if (i < 0)
231 {
232 Printf ("Invalid command for KEYCONF: %s\n", beg);
233 return;
234 }
235 }
236
237 // Check if this is an action
238 if (*beg == '+' || *beg == '-')
239 {
240 auto button = buttonMap.FindButton(beg + 1, int(end - beg - 1));
241 if (button != nullptr)
242 {
243 if (*beg == '+')
244 {
245 button->PressKey (keynum);
246 if (button->PressHandler) button->PressHandler();
247 }
248 else
249 {
250 button->ReleaseKey (keynum);

Callers 9

EveryCheatToggleFunction · 0.85
Cheat_ResponderFunction · 0.85
ProcessOptionsMethod · 0.85
RunGameFunction · 0.85
M_SetSpecialMenuFunction · 0.85
AddCommandStringFunction · 0.85
C_HandleKeyFunction · 0.85
ScreenJobResponderFunction · 0.85
CCMDFunction · 0.85

Calls 15

PrintfFunction · 0.85
FindNameInHashTableFunction · 0.85
FindCVarSubFunction · 0.85
FindButtonMethod · 0.80
PressKeyMethod · 0.80
ReleaseKeyMethod · 0.80
argcMethod · 0.80
CmdSetMethod · 0.80
LenMethod · 0.80
localizeMethod · 0.80
GetHumanStringMethod · 0.80
GetHumanStringDefaultMethod · 0.80

Tested by

no test coverage detected