impr: Store settings and achievements immediately
This commit is contained in:
parent
6a9e07729f
commit
ca17054a1e
@ -340,6 +340,8 @@ namespace hex {
|
||||
void write(const UnlocalizedString &unlocalizedCategory, const UnlocalizedString &unlocalizedName, const std::common_type_t<T> &value) {
|
||||
impl::getSetting(unlocalizedCategory, unlocalizedName, value) = value;
|
||||
impl::runOnChangeHandlers(unlocalizedCategory, unlocalizedName, value);
|
||||
|
||||
impl::store();
|
||||
}
|
||||
|
||||
using OnChangeCallback = std::function<void(const SettingsValue &)>;
|
||||
|
@ -234,17 +234,6 @@ namespace hex::init {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool storeSettings() {
|
||||
try {
|
||||
ContentRegistry::Settings::impl::store();
|
||||
AchievementManager::storeProgress();
|
||||
} catch (std::exception &e) {
|
||||
log::error("Failed to store configuration! {}", e.what());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Run all exit tasks, and print to console
|
||||
void runExitTasks() {
|
||||
for (const auto &[name, task, async] : init::getExitTasks()) {
|
||||
@ -264,7 +253,6 @@ namespace hex::init {
|
||||
|
||||
std::vector<Task> getExitTasks() {
|
||||
return {
|
||||
{ "Saving settings", storeSettings, false },
|
||||
{ "Prepare exit", prepareExit, false },
|
||||
{ "Unloading plugins", unloadPlugins, false },
|
||||
{ "Deleting old files", deleteOldFiles, false },
|
||||
|
@ -18,6 +18,7 @@ namespace hex::plugin::builtin {
|
||||
// Add newly unlocked achievements to the display queue
|
||||
EventAchievementUnlocked::subscribe(this, [this](const Achievement &achievement) {
|
||||
m_achievementUnlockQueue.push_back(&achievement);
|
||||
AchievementManager::storeProgress();
|
||||
});
|
||||
|
||||
RequestOpenWindow::subscribe(this, [this](const std::string &name) {
|
||||
|
Loading…
Reference in New Issue
Block a user