Makes is_type_in_list() much faster (thanks remie)

This commit is contained in:
MrStonedOne
2016-05-16 10:23:19 -07:00
parent 561bdd08ad
commit e3729033d2
+9 -3
View File
@@ -53,10 +53,16 @@
//Checks for specific types in a list
/proc/is_type_in_list(atom/A, list/L)
if (!L.len)
return 0
if (!isnum(L[L[1]]))
generate_type_list_cache(L)
return L[A.type]
/proc/generate_type_list_cache(L)
for(var/type in L)
if(istype(A, type))
return 1
return 0
for(var/T in typesof(type))
L[T] = 1
//Empties the list by setting the length to 0. Hopefully the elements get garbage collected
/proc/clearlist(list/list)