mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 19:45:23 -04:00
Fix changed keybinds not saving. (Thanks Cheesse)
This commit is contained in:
parent
43752348bf
commit
f9de4ac85c
@ -80,6 +80,13 @@ namespace ClassicalSharp {
|
||||
public static List<string> OptionsChanged = new List<string>();
|
||||
const string Filename = "options.txt";
|
||||
|
||||
static bool IsChangedOption(string key) {
|
||||
for (int i = 0; i < OptionsChanged.Count; i++) {
|
||||
if (Utils.CaselessEquals(key, OptionsChanged[i])) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool TryGetValue(string key, out string value) {
|
||||
value = null;
|
||||
int i = FindOption(key);
|
||||
@ -157,7 +164,7 @@ namespace ClassicalSharp {
|
||||
SetOption(key, value);
|
||||
}
|
||||
|
||||
if (!OptionsChanged.Contains(key)) {
|
||||
if (!IsChangedOption(key)) {
|
||||
OptionsChanged.Add(key);
|
||||
}
|
||||
}
|
||||
@ -204,7 +211,7 @@ namespace ClassicalSharp {
|
||||
// remove all the unchanged options
|
||||
for (int i = OptionsKeys.Count - 1; i >= 0; i--) {
|
||||
string key = OptionsKeys[i];
|
||||
if (OptionsChanged.Contains(key)) continue;
|
||||
if (IsChangedOption(key)) continue;
|
||||
RemoveOption(i);
|
||||
}
|
||||
|
||||
@ -220,7 +227,7 @@ namespace ClassicalSharp {
|
||||
if (sepIndex == line.Length) continue;
|
||||
string value = line.Substring(sepIndex, line.Length - sepIndex);
|
||||
|
||||
if (!OptionsChanged.Contains(key)) {
|
||||
if (!IsChangedOption(key)) {
|
||||
SetOption(key, value);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user