Fix settings being applied a second time with wrong data (#308)

This commit is contained in:
Julian Murgia
2021-07-15 09:41:29 +02:00
committed by GitHub
parent 9dcfd2869e
commit 958c8b441b
3 changed files with 5 additions and 11 deletions

View File

@@ -192,7 +192,8 @@ func save_settings():
["There was an issue writing settings %s" % save_path])
# Load the game settings from the settings file
func load_settings():
# **Returns** The Resource structure loaded from settings file
func load_settings() -> Resource:
var save_settings_path: String = settings_folder.plus_file(SETTINGS_TEMPLATE)
var file: File = File.new()
if not file.file_exists(save_settings_path):
@@ -201,7 +202,5 @@ func load_settings():
["Settings file %s doesn't exist" % save_settings_path,
"Setting default settings."])
save_settings()
return
var settings_resource: Resource = load(save_settings_path)
escoria._on_settings_loaded(settings_resource)
return load(save_settings_path)

View File

@@ -385,5 +385,4 @@ func _on_settings_loaded(p_settings: ESCSaveSettings) -> void:
linear2db(settings.music_volume)
)
TranslationServer.set_locale(settings.text_lang)
# music_volume_changed()

View File

@@ -3,16 +3,12 @@ extends Control
signal back_button_pressed
onready var settings_changed = false
onready var backup_settings
func _ready():
initialize_options(escoria.settings)
var backup_settings
func show():
backup_settings = escoria.settings.duplicate()
initialize_options(backup_settings)
initialize_options(escoria.settings)
visible = true