Merge pull request #6304 from CHOMPStation2/upstream-merge-14936

[MIRROR] Little Weakref Refactor
This commit is contained in:
Nadyr
2023-06-09 22:27:56 -04:00
committed by GitHub
42 changed files with 286 additions and 179 deletions

View File

@@ -382,15 +382,15 @@ GLOBAL_LIST_EMPTY(icon_state_lists)
GLOBAL_LIST_EMPTY(cached_examine_icons)
/proc/set_cached_examine_icon(var/atom/A, var/icon/I, var/expiry = 12000)
GLOB.cached_examine_icons[weakref(A)] = I
GLOB.cached_examine_icons[WEAKREF(A)] = I
if(expiry)
addtimer(CALLBACK(GLOBAL_PROC, .proc/uncache_examine_icon, weakref(A)), expiry, TIMER_UNIQUE)
addtimer(CALLBACK(GLOBAL_PROC, .proc/uncache_examine_icon, WEAKREF(A)), expiry, TIMER_UNIQUE)
/proc/get_cached_examine_icon(var/atom/A)
var/weakref/WR = weakref(A)
var/datum/weakref/WR = WEAKREF(A)
return GLOB.cached_examine_icons[WR]
/proc/uncache_examine_icon(var/weakref/WR)
/proc/uncache_examine_icon(var/datum/weakref/WR)
GLOB.cached_examine_icons -= WR
/proc/adjust_brightness(var/color, var/value)