Ref tracker TLC, makes unit test harddel errors more descriptive (#62725)

This commit is contained in:
LemonInTheDark
2021-11-11 13:49:21 -08:00
committed by GitHub
parent 7472c67bb2
commit 3bb64112e2
5 changed files with 41 additions and 8 deletions
@@ -27,9 +27,18 @@
var/starting_time = world.time
//Time to search the whole game for our ref
DoSearchVar(GLOB, "GLOB") //globals
DoSearchVar(GLOB, "GLOB", search_time = starting_time) //globals
log_reftracker("Finished searching globals")
//Yes we do actually need to do this. The searcher refuses to read weird lists
//And global.vars is a really weird list
var/global_vars = list()
for(var/key in global.vars)
global_vars[key] = global.vars[key]
DoSearchVar(global_vars, "Native Global", search_time = starting_time)
log_reftracker("Finished searching native globals")
for(var/datum/thing in world) //atoms (don't beleive its lies)
DoSearchVar(thing, "World -> [thing.type]", search_time = starting_time)
log_reftracker("Finished searching atoms")
@@ -55,7 +64,7 @@
/datum/proc/DoSearchVar(potential_container, container_name, recursive_limit = 64, search_time = world.time)
#ifdef REFERENCE_TRACKING_DEBUG
if(!found_refs && SSgarbage.should_save_refs)
if(SSgarbage.should_save_refs && !found_refs)
found_refs = list()
#endif
@@ -91,6 +100,7 @@
#ifdef REFERENCE_TRACKING_DEBUG
if(SSgarbage.should_save_refs)
found_refs[varname] = TRUE
continue //End early, don't want these logging
#endif
log_reftracker("Found [type] \ref[src] in [datum_container.type]'s \ref[datum_container] [varname] var. [container_name]")
continue
@@ -110,6 +120,7 @@
#ifdef REFERENCE_TRACKING_DEBUG
if(SSgarbage.should_save_refs)
found_refs[potential_cache] = TRUE
continue //End early, don't want these logging
#endif
log_reftracker("Found [type] \ref[src] in list [container_name].")
continue
@@ -122,6 +133,7 @@
#ifdef REFERENCE_TRACKING_DEBUG
if(SSgarbage.should_save_refs)
found_refs[potential_cache] = TRUE
continue //End early, don't want these logging
#endif
log_reftracker("Found [type] \ref[src] in list [container_name]\[[element_in_list]\]")
continue