Automatically reset game setting's value if it has the same value as global's

This commit is contained in:
redphx
2025-01-30 16:10:51 +07:00
parent 96de61c301
commit fe418e6918
8 changed files with 83 additions and 53 deletions

View File

@@ -198,7 +198,6 @@ export class SettingsManager {
}
const value = getGamePref(this.targetGameId, key, true)!;
if ('setValue' in $elm) {
($elm as any).setValue(value);
} else {
@@ -227,8 +226,8 @@ export class SettingsManager {
continue;
}
const oldValue = getGamePref(oldGameId, key, true, true);
const newValue = getGamePref(this.targetGameId, key, true, true);
const oldValue = getGamePref(oldGameId, key, true);
const newValue = getGamePref(this.targetGameId, key, true);
if (oldValue === newValue) {
continue;
@@ -314,8 +313,7 @@ export class SettingsManager {
// Only switch to game settings if it's not empty
const gameSettings = STORAGE.Stream.getGameSettings(id);
const customSettings = gameSettings && !gameSettings.isEmpty();
const selectedId = customSettings ? id : -1;
const selectedId = (gameSettings && !gameSettings.isEmpty()) ? id : -1;
setGameIdPref(selectedId);