From dc44102d8b890b30f79a0caa47ef27ac4aacd16d Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Fri, 1 Jan 2021 22:39:16 +0000 Subject: [PATCH] fix --- code/modules/client/client_procs.dm | 4 ++-- code/modules/client/preferences_savefile.dm | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 29efa971da..c298d150f8 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -1033,7 +1033,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( if(!length(unlockable_loadout_data)) unlockable_loadout_data = list() unlockable_loadout_data[key] = amount - WRITE_FILE(S["unlockable_loadout"], unlockable_loadout_data) + WRITE_FILE(S["unlockable_loadout"], safe_json_encode(unlockable_loadout_data)) prefs.unlockable_loadout_data = unlockable_loadout_data return TRUE else @@ -1041,7 +1041,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( unlockable_loadout_data[key] += amount else unlockable_loadout_data[key] = amount - WRITE_FILE(S["unlockable_loadout"], unlockable_loadout_data) + WRITE_FILE(S["unlockable_loadout"], safe_json_encode(unlockable_loadout_data)) prefs.unlockable_loadout_data = unlockable_loadout_data return TRUE return FALSE diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 754c33d3d3..0db9fbb66c 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -5,7 +5,7 @@ // You do not need to raise this if you are adding new values that have sane defaults. // Only raise this value when changing the meaning/format/name/layout of an existing value // where you would want the updater procs below to run -#define SAVEFILE_VERSION_MAX 47 +#define SAVEFILE_VERSION_MAX 48 /* SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn @@ -285,6 +285,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car S["loadout"] = safe_json_encode(loadout_data) + if(current_version < 48) //unlockable loadout items but we need to clear bad data from a mistake + S["unlockable_loadout"] = list() + /datum/preferences/proc/load_path(ckey,filename="preferences.sav") if(!ckey) return