From 6565f67f4ed996a6b5597c3719c233e7a571dc68 Mon Sep 17 00:00:00 2001 From: Drathek <76988376+Drulikar@users.noreply.github.com> Date: Mon, 24 Jul 2023 08:11:25 -0700 Subject: [PATCH] Fix Some Preferences Not Saving (#3975) # About the pull request This PR increases the size of some settings (namely toggle_prefs) from 16 bits to 24 bits so preferences like TOGGLE_LATE_JOIN_CURRENT_SLOT and TOGGLE_ABILITY_DEACTIVATION_OFF will now actually stick. # Explain why it's good for the game Fixes at least two preferences not saving/loading correctly. # Testing Photographs and Procedure
Screenshots & Videos Put screenshots and videos here with an empty line between the screenshots and the `
` tags.
# Changelog :cl: Drathek fix: Fixed ability deactivation and late join current slot toggles not persisting. fix: Toggle the Ability to Hurt Yourself now says On when you can hurt yourself. /:cl: --- code/modules/client/preferences.dm | 2 +- code/modules/client/preferences_savefile.dm | 22 ++++++++++----------- code/modules/tgui/tgui_number_input.dm | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 5698c30c0acf..16afa8d1b4f2 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -590,7 +590,7 @@ var/const/MAX_SAVE_SLOTS = 10 dat += "
" dat += "

Gameplay Toggles:

" dat += "Toggle Being Able to Hurt Yourself: \ - [toggle_prefs & TOGGLE_IGNORE_SELF ? "On" : "Off"]
" + [toggle_prefs & TOGGLE_IGNORE_SELF ? "Off" : "On"]
" dat += "Toggle Help Intent Safety: \ [toggle_prefs & TOGGLE_HELP_INTENT_SAFETY ? "On" : "Off"]
" dat += "Toggle Middle Mouse Ability Activation: \ diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 0a1b54112f18..0f482fa7f894 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -199,22 +199,22 @@ lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog)) UI_style = sanitize_inlist(UI_style, list("white", "dark", "midnight", "orange", "old"), initial(UI_style)) tgui_say = sanitize_integer(tgui_say, FALSE, TRUE, TRUE) - be_special = sanitize_integer(be_special, 0, 65535, initial(be_special)) + be_special = sanitize_integer(be_special, 0, SHORT_REAL_LIMIT, initial(be_special)) default_slot = sanitize_integer(default_slot, 1, MAX_SAVE_SLOTS, initial(default_slot)) - toggles_chat = sanitize_integer(toggles_chat, 0, 65535, initial(toggles_chat)) - chat_display_preferences = sanitize_integer(chat_display_preferences, 0, 65535, initial(chat_display_preferences)) - toggles_ghost = sanitize_integer(toggles_ghost, 0, 65535, initial(toggles_ghost)) - toggles_langchat = sanitize_integer(toggles_langchat, 0, 65535, initial(toggles_langchat)) - toggles_sound = sanitize_integer(toggles_sound, 0, 65535, initial(toggles_sound)) - toggle_prefs = sanitize_integer(toggle_prefs, 0, 65535, initial(toggle_prefs)) - toggles_flashing= sanitize_integer(toggles_flashing, 0, 65535, initial(toggles_flashing)) - toggles_ert = sanitize_integer(toggles_ert, 0, 65535, initial(toggles_ert)) - toggles_admin = sanitize_integer(toggles_admin, 0, 65535, initial(toggles_admin)) + toggles_chat = sanitize_integer(toggles_chat, 0, SHORT_REAL_LIMIT, initial(toggles_chat)) + chat_display_preferences = sanitize_integer(chat_display_preferences, 0, SHORT_REAL_LIMIT, initial(chat_display_preferences)) + toggles_ghost = sanitize_integer(toggles_ghost, 0, SHORT_REAL_LIMIT, initial(toggles_ghost)) + toggles_langchat = sanitize_integer(toggles_langchat, 0, SHORT_REAL_LIMIT, initial(toggles_langchat)) + toggles_sound = sanitize_integer(toggles_sound, 0, SHORT_REAL_LIMIT, initial(toggles_sound)) + toggle_prefs = sanitize_integer(toggle_prefs, 0, SHORT_REAL_LIMIT, initial(toggle_prefs)) + toggles_flashing= sanitize_integer(toggles_flashing, 0, SHORT_REAL_LIMIT, initial(toggles_flashing)) + toggles_ert = sanitize_integer(toggles_ert, 0, SHORT_REAL_LIMIT, initial(toggles_ert)) + toggles_admin = sanitize_integer(toggles_admin, 0, SHORT_REAL_LIMIT, initial(toggles_admin)) UI_style_color = sanitize_hexcolor(UI_style_color, initial(UI_style_color)) UI_style_alpha = sanitize_integer(UI_style_alpha, 0, 255, initial(UI_style_alpha)) item_animation_pref_level = sanitize_integer(item_animation_pref_level, SHOW_ITEM_ANIMATIONS_NONE, SHOW_ITEM_ANIMATIONS_ALL, SHOW_ITEM_ANIMATIONS_ALL) pain_overlay_pref_level = sanitize_integer(pain_overlay_pref_level, PAIN_OVERLAY_BLURRY, PAIN_OVERLAY_LEGACY, PAIN_OVERLAY_BLURRY) - window_skin = sanitize_integer(window_skin, 0, 65535, initial(window_skin)) + window_skin = sanitize_integer(window_skin, 0, SHORT_REAL_LIMIT, initial(window_skin)) ghost_vision_pref = sanitize_inlist(ghost_vision_pref, list(GHOST_VISION_LEVEL_NO_NVG, GHOST_VISION_LEVEL_MID_NVG, GHOST_VISION_LEVEL_FULL_NVG), GHOST_VISION_LEVEL_MID_NVG) ghost_orbit = sanitize_inlist(ghost_orbit, GLOB.ghost_orbits, initial(ghost_orbit)) playtime_perks = sanitize_integer(playtime_perks, 0, 1, 1) diff --git a/code/modules/tgui/tgui_number_input.dm b/code/modules/tgui/tgui_number_input.dm index 9c447ecd5a03..aa189b1d2039 100644 --- a/code/modules/tgui/tgui_number_input.dm +++ b/code/modules/tgui/tgui_number_input.dm @@ -31,7 +31,7 @@ qdel(number_input) ///A clone of tgui_input_number that defaults to accepting negative inputs too. -/proc/tgui_input_real_number(mob/user, message, title = "Number Input", default = 0, max_value = 16777216, min_value = -16777216, timeout = 0, integer_only = FALSE) +/proc/tgui_input_real_number(mob/user, message, title = "Number Input", default = 0, max_value = SHORT_REAL_LIMIT, min_value = -SHORT_REAL_LIMIT, timeout = 0, integer_only = FALSE) return tgui_input_number(user, message, title, default, max_value, min_value, timeout, integer_only) /** * Creates an asynchronous TGUI number input window with an associated callback.