MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Hotkeys_AddNewHotkey

Function Hotkeys_AddNewHotkey

src/InputHandler.c:112–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112static void Hotkeys_AddNewHotkey(int trigger, cc_uint8 modifiers, const cc_string* text, cc_uint8 flags) {
113 struct HotkeyData hKey;
114 hKey.trigger = trigger;
115 hKey.mods = modifiers;
116 hKey.textIndex = HotkeysText.count;
117 hKey.flags = flags;
118
119 if (HotkeysText.count == HOTKEYS_MAX_COUNT) {
120 Chat_AddRaw("&cCannot define more than 256 hotkeys");
121 return;
122 }
123
124 HotkeysList[HotkeysText.count] = hKey;
125 StringsBuffer_Add(&HotkeysText, text);
126 /* sort so that hotkeys with largest modifiers are first */
127 Hotkeys_QuickSort(0, HotkeysText.count - 1);
128}
129
130static void Hotkeys_RemoveText(int index) {
131 struct HotkeyData* hKey = HotkeysList;

Callers 1

Hotkeys_AddFunction · 0.85

Calls 3

Chat_AddRawFunction · 0.85
StringsBuffer_AddFunction · 0.85
Hotkeys_QuickSortFunction · 0.85

Tested by

no test coverage detected