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

Method DefaultBind

source/common/console/c_bind.cpp:527–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525//=============================================================================
526
527void FKeyBindings::DefaultBind(const char *keyname, const char *cmd)
528{
529 int key = GetKeyFromName (keyname);
530 if (key == 0)
531 {
532 Printf ("Unknown key \"%s\"\n", keyname);
533 return;
534 }
535 if (!Binds[key].IsEmpty())
536 { // This key is already bound.
537 return;
538 }
539 for (int i = 0; i < NUM_KEYS; ++i)
540 {
541 if (!Binds[i].IsEmpty() && stricmp (Binds[i].GetChars(), cmd) == 0)
542 { // This command is already bound to a key.
543 return;
544 }
545 }
546 // It is safe to do the bind, so do it.
547 Binds[key] = cmd;
548}
549
550//=============================================================================
551//

Callers 1

CCMDFunction · 0.80

Calls 5

GetKeyFromNameFunction · 0.85
PrintfFunction · 0.85
stricmpFunction · 0.85
IsEmptyMethod · 0.45
GetCharsMethod · 0.45

Tested by

no test coverage detected