From cc791ed2bef091b69fc0345cac8b2aa1ffbf47b1 Mon Sep 17 00:00:00 2001 From: Emmett Gaines Date: Sat, 3 Jul 2021 14:31:34 -0400 Subject: [PATCH] Makes GAGS layer limit per icon state, not per config file (#59923) --- code/datums/greyscale/_greyscale_config.dm | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/code/datums/greyscale/_greyscale_config.dm b/code/datums/greyscale/_greyscale_config.dm index 63494590fee..4f8a0c0b671 100644 --- a/code/datums/greyscale/_greyscale_config.dm +++ b/code/datums/greyscale/_greyscale_config.dm @@ -122,19 +122,22 @@ width = source.Width() var/list/datum/greyscale_layer/all_layers = list() - var/list/to_process = list() for(var/state in icon_states) - to_process += icon_states[state] - while(length(to_process)) - var/current = to_process[length(to_process)] - to_process.len-- - if(islist(current)) - to_process += current - else - all_layers += current + var/list/to_process = list(icon_states[state]) + var/list/state_layers = list() - if(length(all_layers) > MAX_SANE_LAYERS) - stack_trace("[DebugName()] has [length(all_layers)] layers which is larger than the max of [MAX_SANE_LAYERS].") + while(length(to_process)) + var/current = to_process[length(to_process)] + to_process.len-- + if(islist(current)) + to_process += current + else + state_layers += current + + all_layers += state_layers + + if(length(state_layers) > MAX_SANE_LAYERS) + stack_trace("[DebugName()] icon state '[state]' has [length(state_layers)] layers which is larger than the max of [MAX_SANE_LAYERS].") var/list/color_groups = list() var/largest_id = 0