mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-10 07:49:57 -04:00
Only save the one keybind that changed instead of all keybinds
This commit is contained in:
parent
9e7d19bfd1
commit
1457d1207c
16
src/Input.c
16
src/Input.c
@ -337,24 +337,16 @@ static void KeyBind_Load(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void KeyBind_Save(void) {
|
||||
void KeyBind_Set(KeyBind binding, int key) {
|
||||
cc_string name; char nameBuffer[STRING_SIZE];
|
||||
cc_string value;
|
||||
int i;
|
||||
|
||||
String_InitArray(name, nameBuffer);
|
||||
for (i = 0; i < KEYBIND_COUNT; i++) {
|
||||
name.length = 0;
|
||||
String_Format1(&name, "key-%c", keybindNames[i]);
|
||||
|
||||
value = String_FromReadonly(Input_Names[KeyBinds[i]]);
|
||||
Options_SetString(&name, &value);
|
||||
}
|
||||
}
|
||||
String_Format1(&name, "key-%c", keybindNames[binding]);
|
||||
value = String_FromReadonly(Input_Names[key]);
|
||||
Options_SetString(&name, &value);
|
||||
|
||||
void KeyBind_Set(KeyBind binding, int key) {
|
||||
KeyBinds[binding] = key;
|
||||
KeyBind_Save();
|
||||
Event_RaiseBind(&InputEvents.BindChanged, binding, KeyBind_IsPressed(binding));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user