Precalculates special list var names and avoids incorrect vv targets (#79154)

## About The Pull Request

This adds a global list to precalculate lists that need to be handled
special by vv instead of manually updating such a list. @LemonInTheDark
brought up a potential issue with handling all lists in the way special
lists are handled, that modifying a list in vv can in some cases result
in the wrong list being opened for editing. This makes only special
lists have the issue instead of blindly accessing all lists the same
way.
This commit is contained in:
Emmett Gaines
2023-10-24 17:43:46 +01:00
committed by GitHub
parent 6b7e7dd05e
commit 007b7d3f43
2 changed files with 24 additions and 3 deletions
@@ -64,10 +64,15 @@
var/datum/datum_value = value
return datum_value.debug_variable_value(name, level, owner, sanitize, display_flags)
if(islist(value) || hascall(value, "Cut")) // Some special lists arent detectable as a list through istype, so we check if it has a list proc instead
if(islist(value) || GLOB.vv_special_lists[name]) // Some special lists arent detectable as a list through istype
var/list/list_value = value
var/list/items = list()
// This is becuse some lists either dont count as lists or a locate on their ref will return null
var/link_vars = "Vars=[REF(value)]"
if(GLOB.vv_special_lists[name])
link_vars = "Vars=[REF(owner)];special_varname=[name]"
if (!(display_flags & VV_ALWAYS_CONTRACT_LIST) && list_value.len > 0 && list_value.len <= (IS_NORMAL_LIST(list_value) ? VV_NORMAL_LIST_NO_EXPAND_THRESHOLD : VV_SPECIAL_LIST_NO_EXPAND_THRESHOLD))
for (var/i in 1 to list_value.len)
var/key = list_value[i]
@@ -80,9 +85,9 @@
items += debug_variable(key, val, level + 1, sanitize = sanitize)
return "<a href='?_src_=vars;[HrefToken()];Vars=[REF(owner)];special_varname=[name]'>/list ([list_value.len])</a><ul>[items.Join()]</ul>"
return "<a href='?_src_=vars;[HrefToken()];[link_vars]'>/list ([list_value.len])</a><ul>[items.Join()]</ul>"
else
return "<a href='?_src_=vars;[HrefToken()];Vars=[REF(owner)];special_varname=[name]'>/list ([list_value.len])</a>"
return "<a href='?_src_=vars;[HrefToken()];[link_vars]'>/list ([list_value.len])</a>"
if(name in GLOB.bitfields)
var/list/flags = list()