Merge pull request #13480 from Citadel-Station-13/silicons-patch-7

[OH GOD TESTMERGE THIS FIRST] another microoptimization to GetAllContents() because microoptimizations are fun
This commit is contained in:
Putnam3145
2020-10-07 15:09:26 -07:00
committed by GitHub
+9 -5
View File
@@ -457,21 +457,23 @@ 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 +482,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