Skip to content

Commit

Permalink
Fix: use Escoria plugin version from plugin.cfg in savegames (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
StraToN authored Feb 15, 2022
1 parent 9071fdc commit 2384127
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 293 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ func save_game_crash():
# - p_savename: name of the savegame
func _do_save_game(p_savename: String) -> ESCSaveGame:
var save_game = ESCSaveGame.new()
save_game.escoria_version = escoria.ESCORIA_VERSION

var plugin_config = ConfigFile.new()
plugin_config.load("res://addons/escoria-core/plugin.cfg")
save_game.escoria_version = plugin_config.get_value("plugin", "version")

save_game.game_version = escoria.project_settings_manager.get_setting(
escoria.project_settings_manager.GAME_VERSION
)
Expand Down Expand Up @@ -383,7 +387,10 @@ func load_game(id: int):
# Save the game settings in the settings file.
func save_settings():
var settings_res := ESCSaveSettings.new()
settings_res.escoria_version = escoria.ESCORIA_VERSION
var plugin_config = ConfigFile.new()
plugin_config.load("res://addons/escoria-core/plugin.cfg")

settings_res.escoria_version = plugin_config.get_value("plugin", "version")
settings_res.text_lang = escoria.settings.text_lang
settings_res.voice_lang = escoria.settings.voice_lang
settings_res.speech_enabled = escoria.settings.speech_enabled
Expand Down
3 changes: 0 additions & 3 deletions addons/escoria-core/game/escoria.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ enum GAME_STATE {
}


# Escoria version number
const ESCORIA_VERSION = "0.1.0"

# Audio bus indices.
const BUS_MASTER = "Master"
const BUS_SFX = "SFX"
Expand Down
17 changes: 9 additions & 8 deletions addons/escoria-core/ui_library/menus/load_save/load/load_game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ func refresh_savegames():
$VBoxContainer/ScrollContainer/slots.remove_child(slot)

var saves_list = escoria.save_manager.get_saves_list()
for i in saves_list.size():
var save_data = saves_list[i+1]
var new_slot = slot_ui_scene.instance()
$VBoxContainer/ScrollContainer/slots.add_child(
new_slot
)
new_slot.set_slot_name_date(save_data["name"], save_data["date"])
new_slot.connect("pressed", self, "_on_slot_pressed", [i+1])
for i in range(saves_list.keys().max() + 1):
if saves_list.has(i):
var save_data = saves_list[i]
var new_slot = slot_ui_scene.instance()
$VBoxContainer/ScrollContainer/slots.add_child(
new_slot
)
new_slot.set_slot_name_date(save_data["name"], save_data["date"])
new_slot.connect("pressed", self, "_on_slot_pressed", [i])
13 changes: 7 additions & 6 deletions addons/escoria-core/ui_library/menus/load_save/save/save_game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ func refresh_savegames():
_slots.remove_child(slot)

var saves_list = escoria.save_manager.get_saves_list()
for i in saves_list.size():
var save_data = saves_list[i+1]
var new_slot = slot_ui_scene.instance()
_slots.add_child(new_slot)
new_slot.set_slot_name_date(save_data["name"], save_data["date"])
new_slot.connect("pressed", self, "_on_slot_pressed", [i+1])
for i in range(saves_list.keys().max() + 1):
if saves_list.has(i):
var save_data = saves_list[i]
var new_slot = slot_ui_scene.instance()
_slots.add_child(new_slot)
new_slot.set_slot_name_date(save_data["name"], save_data["date"])
new_slot.connect("pressed", self, "_on_slot_pressed", [i])

var datetime = OS.get_datetime()
var datetime_string = "%02d/%02d/%02d %02d:%02d" % [
Expand Down
91 changes: 0 additions & 91 deletions saves/save_001.tres

This file was deleted.

86 changes: 0 additions & 86 deletions saves/save_002.tres

This file was deleted.

97 changes: 0 additions & 97 deletions saves/save_003.tres

This file was deleted.

0 comments on commit 2384127

Please sign in to comment.