From 6ac175f5b15f903884b2211c3fd123db1b7b032a Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Thu, 1 Oct 2020 02:47:44 -0700 Subject: [PATCH] Update unsorted.dm --- code/__HELPERS/unsorted.dm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 4addae3ac4..41f2e1a49a 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -457,21 +457,24 @@ Turf and target are separate in case you want to teleport some distance from a t /atom/proc/GetAllContents(var/T) var/list/processing_list = list(src) + var/i = 0 + var/lim = 1 if(T) . = list() - var/i = 0 - while(i < length(processing_list)) + while(i < lim) var/atom/A = processing_list[++i] //Byond does not allow things to be in multiple contents, or double parent-child hierarchies, so only += is needed //This is also why we don't need to check against assembled as we go along processing_list += A.contents + lim = processing_list.len if(istype(A,T)) . += A else var/i = 0 - while(i < length(processing_list)) + while(i < lim) var/atom/A = processing_list[++i] processing_list += A.contents + lim = processing_list.len return processing_list /atom/proc/GetAllContentsIgnoring(list/ignore_typecache) @@ -480,10 +483,12 @@ Turf and target are separate in case you want to teleport some distance from a t var/list/processing = list(src) . = list() var/i = 0 - while(i < length(processing)) + var/lim = 1 + while(i < lim) var/atom/A = processing[++i] if(!ignore_typecache[A.type]) processing += A.contents + lim = processing.len . += A