Adds keybindings sanity. (#51627)

* Adds keybindings sanity.

* Whoops

* clears the key if it's unsed
This commit is contained in:
AnturK
2020-06-15 20:54:18 +08:00
committed by GitHub
parent ca089f21d0
commit 24abb2ebf9
+9 -1
View File
@@ -244,7 +244,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
be_special = SANITIZE_LIST(be_special)
pda_style = sanitize_inlist(pda_style, GLOB.pda_styles, initial(pda_style))
pda_color = sanitize_hexcolor(pda_color, 6, 1, initial(pda_color))
key_bindings = sanitize_islist(key_bindings, list())
key_bindings = sanitize_keybindings(key_bindings)
return TRUE
@@ -555,6 +555,14 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
return TRUE
/proc/sanitize_keybindings(value)
var/list/base_bindings = sanitize_islist(value,list())
for(var/key in base_bindings)
base_bindings[key] = base_bindings[key] & GLOB.keybindings_by_name
if(!length(base_bindings[key]))
base_bindings -= key
return base_bindings
#undef SAVEFILE_VERSION_MAX
#undef SAVEFILE_VERSION_MIN