From 7d7d32beacb6e59ea83a3652e47e8fccca11af4f Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Sat, 22 Apr 2023 00:14:35 -0700 Subject: [PATCH] We need to go back (Typecaches) (#74914) --- code/__HELPERS/_lists.dm | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index 6cf60b72d41..4a4bc828cf8 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -301,14 +301,14 @@ if(only_root_path) for(var/current_path in pathlist) .[current_path] = TRUE - return - - for(var/current_path in pathlist) - for(var/subpath in typesof(current_path)) - .[subpath] = TRUE - - if(ignore_root_path) - . -= pathlist + else if(ignore_root_path) + for(var/current_path in pathlist) + for(var/subtype in subtypesof(current_path)) + .[subtype] = TRUE + else + for(var/current_path in pathlist) + for(var/subpath in typesof(current_path)) + .[subpath] = TRUE /** * Like typesof() or subtypesof(), but returns a typecache instead of a list. @@ -350,21 +350,14 @@ if(only_root_path) for(var/current_path in pathlist) .[current_path] = pathlist[current_path] - - if(!clear_nulls) - return - - for(var/cached_path in .) - if (isnull(.[cached_path])) - . -= cached_path - return - - for(var/current_path in pathlist) - for(var/subpath in typesof(current_path)) - .[subpath] = pathlist[current_path] - - if(ignore_root_path) - . -= pathlist + else if(ignore_root_path) + for(var/current_path in pathlist) + for(var/subtype in subtypesof(current_path)) + .[subtype] = pathlist[current_path] + else + for(var/current_path in pathlist) + for(var/subpath in typesof(current_path)) + .[subpath] = pathlist[current_path] if(!clear_nulls) return