MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Key_SetBinding

Function Key_SetBinding

code/client/cl_keys.cpp:929–946  ·  view source on GitHub ↗

=================== Key_SetBinding =================== */

Source from the content-addressed store, hash-verified

927===================
928*/
929void Key_SetBinding( int keynum, const char *binding ) {
930 if ( keynum < 0 || keynum >= MAX_KEYS )
931 return;
932
933 // free old bindings
934 if ( kg.keys[keynames[keynum].upper].binding ) {
935 Z_Free( kg.keys[keynames[keynum].upper].binding );
936 kg.keys[keynames[keynum].upper].binding = NULL;
937 }
938
939 // allocate memory for new binding
940 if ( binding )
941 kg.keys[keynames[keynum].upper].binding = CopyString( binding );
942
943 // consider this like modifying an archived cvar, so the
944 // file write will be triggered at the next oportunity
945 cvar_modifiedFlags |= CVAR_ARCHIVE;
946}
947
948/*
949===================

Callers 5

CL_UISystemCallsFunction · 0.70
Key_Unbind_fFunction · 0.70
Key_Unbindall_fFunction · 0.70
Key_Bind_fFunction · 0.70
trap_Key_SetBindingFunction · 0.50

Calls 2

Z_FreeFunction · 0.50
CopyStringFunction · 0.50

Tested by

no test coverage detected