make overlay lists not persist when empty (#53787)

This commit is contained in:
Kyle Spier-Swenson
2020-09-17 18:24:44 -07:00
committed by GitHub
parent fc4201ebda
commit dce0d461d8

View File

@@ -56,6 +56,8 @@ SUBSYSTEM_DEF(overlays)
continue continue
STAT_START_STOPWATCH STAT_START_STOPWATCH
COMPILE_OVERLAYS(A) COMPILE_OVERLAYS(A)
UNSETEMPTY(A.add_overlays)
UNSETEMPTY(A.remove_overlays)
STAT_STOP_STOPWATCH STAT_STOP_STOPWATCH
STAT_LOG_ENTRY(stats, A.type) STAT_LOG_ENTRY(stats, A.type)
if(mc_check) if(mc_check)
@@ -122,9 +124,8 @@ SUBSYSTEM_DEF(overlays)
#define QUEUE_FOR_COMPILE flags_1 |= OVERLAY_QUEUED_1; SSoverlays.queue += src; #define QUEUE_FOR_COMPILE flags_1 |= OVERLAY_QUEUED_1; SSoverlays.queue += src;
/atom/proc/cut_overlays() /atom/proc/cut_overlays()
LAZYINITLIST(remove_overlays) LAZYINITLIST(remove_overlays)
LAZYINITLIST(add_overlays)
remove_overlays = overlays.Copy() remove_overlays = overlays.Copy()
add_overlays.Cut() add_overlays = null
//If not already queued for work and there are overlays to remove //If not already queued for work and there are overlays to remove
if(NOT_QUEUED_ALREADY && remove_overlays.len) if(NOT_QUEUED_ALREADY && remove_overlays.len)
@@ -134,7 +135,7 @@ SUBSYSTEM_DEF(overlays)
if(!overlays) if(!overlays)
return return
overlays = build_appearance_list(overlays) overlays = build_appearance_list(overlays)
LAZYINITLIST(add_overlays) //always initialized after this point LAZYINITLIST(add_overlays)
LAZYINITLIST(remove_overlays) LAZYINITLIST(remove_overlays)
var/a_len = add_overlays.len var/a_len = add_overlays.len
var/r_len = remove_overlays.len var/r_len = remove_overlays.len
@@ -147,6 +148,7 @@ SUBSYSTEM_DEF(overlays)
//If not already queued and there is work to be done //If not already queued and there is work to be done
if(NOT_QUEUED_ALREADY && (fa_len != a_len || fr_len != r_len )) if(NOT_QUEUED_ALREADY && (fa_len != a_len || fr_len != r_len ))
QUEUE_FOR_COMPILE QUEUE_FOR_COMPILE
UNSETEMPTY(add_overlays)
/atom/proc/add_overlay(list/overlays) /atom/proc/add_overlay(list/overlays)
if(!overlays) if(!overlays)