mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
[MIRROR] Increased cached_icon_states usage and tweaks to unit testing (#11445)
Co-authored-by: Drathek <76988376+Drulikar@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
403a7e0267
commit
14fed02701
@@ -368,18 +368,22 @@
|
||||
return composite
|
||||
|
||||
GLOBAL_LIST_EMPTY(icon_state_lists)
|
||||
/proc/cached_icon_states(var/icon/I)
|
||||
/// Gets the cached icon_state for the provided icon (only cached if its a file).
|
||||
/// mode=0 will only show the sub-states ("open 0,0" and so on)
|
||||
/// mode=1 will show the main state names ("open")
|
||||
/// mode=2 will show all of the states
|
||||
/proc/cached_icon_states(icon/I, mode=1)
|
||||
if(!I)
|
||||
return list()
|
||||
var/key = I
|
||||
var/returnlist = GLOB.icon_state_lists[key]
|
||||
if(!returnlist)
|
||||
returnlist = icon_states(I)
|
||||
returnlist = icon_states(I, mode)
|
||||
if(isfile(I)) // It's something that will stick around
|
||||
GLOB.icon_state_lists[key] = returnlist
|
||||
return returnlist
|
||||
|
||||
/proc/expire_states_cache(var/key)
|
||||
/proc/expire_states_cache(key)
|
||||
if(GLOB.icon_state_lists[key])
|
||||
GLOB.icon_state_lists -= key
|
||||
return TRUE
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
var/state = A.icon_state
|
||||
var/none = !icon
|
||||
if(!none)
|
||||
var/list/states = icon_states(icon)
|
||||
var/list/states = cached_icon_states(icon)
|
||||
if(!(state in states))
|
||||
if(!("" in states))
|
||||
none = TRUE
|
||||
|
||||
Reference in New Issue
Block a user