From 590abafc0ef0155d2411037c5abd62a6030c7f91 Mon Sep 17 00:00:00 2001
From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Date: Thu, 29 Dec 2022 15:07:34 +0000
Subject: [PATCH] Speeds up prefs menu by 10x. Not hyperbole. (#20034)
---
code/modules/client/preference/preferences.dm | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm
index 938790da62a..ec840706857 100644
--- a/code/modules/client/preference/preferences.dm
+++ b/code/modules/client/preference/preferences.dm
@@ -158,7 +158,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
user << browse_rsc(active_character.preview_icon_front, "previewicon.png")
user << browse_rsc(active_character.preview_icon_side, "previewicon2.png")
- var/dat = ""
+ var/list/dat = list()
dat += "
"
dat += "Character Settings"
dat += "Game Preferences"
@@ -525,6 +525,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
dat += "[cat] |
"
for(var/kb in keybindings_by_cat["[GLOB.keybindings_groups[cat]]"])
var/datum/keybinding/KB = kb
+ var/kb_uid = KB.UID() // Cache this to reduce proc jumps
var/override_keys = (keybindings_overrides && keybindings_overrides[KB.name])
var/list/keys = override_keys || KB.keys
var/keys_buttons = ""
@@ -532,11 +533,11 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
var/disp_key = key
if(override_keys)
disp_key = "[disp_key]"
- keys_buttons += "[disp_key] "
+ keys_buttons += "[disp_key] "
dat += ""
dat += "| [KB.name] | "
- dat += "[keys_buttons][(length(keys) < 5) ? "+ | " : ""]"
- dat += "Reset to Default Clear | "
+ dat += "[keys_buttons][(length(keys) < 5) ? "+ | " : ""]"
+ dat += "Reset to Default Clear | "
if(KB.category == KB_CATEGORY_EMOTE_CUSTOM)
var/datum/keybinding/custom/custom_emote_keybind = kb
if(custom_emote_keybind.donor_exclusive && !(user.client.donator_level || user.client.holder || unlock_content))
@@ -552,8 +553,8 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
dat += "[custom_emote_keybind.default_emote_text] | "
else
dat += "\"[active_character.real_name] [emote_text]\" | "
- dat += "Change Text | "
- dat += "Reset to Default | "
+ dat += "Change Text | "
+ dat += "Reset to Default | "
dat += "
|
"
dat += ""
dat += "
|
"
@@ -570,8 +571,8 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
dat += ""
var/datum/browser/popup = new(user, "preferences", "Character Setup
", 820, 720)
- popup.set_content(dat)
- popup.open(0)
+ popup.set_content(dat.Join(""))
+ popup.open(FALSE)
/datum/preferences/proc/open_load_dialog(mob/user)
var/dat = ""