From 5bcc90d3c1b33ea94667a21304a73c10d4ecd800 Mon Sep 17 00:00:00 2001 From: Emmett Gaines Date: Sun, 5 Nov 2017 03:06:42 -0500 Subject: [PATCH 1/2] removes search_contents_for proc (#32411) --- code/datums/helper_datums/teleport.dm | 5 +++-- code/game/atoms.dm | 26 -------------------------- code/game/gamemodes/nuclear/nuclear.dm | 6 ++++-- 3 files changed, 7 insertions(+), 30 deletions(-) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index 300417b6d0..5d04d1c7c0 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -152,13 +152,14 @@ if(istype(teleatom, /obj/item/storage/backpack/holding)) precision = rand(1,100) - var/list/bagholding = teleatom.search_contents_for(/obj/item/storage/backpack/holding) + var/static/list/bag_cache = typecacheof(/obj/item/storage/backpack/holding) + var/list/bagholding = typecache_filter_list(teleatom.GetAllContents(), bag_cache) if(bagholding.len) precision = max(rand(1,100)*bagholding.len,100) if(isliving(teleatom)) var/mob/living/MM = teleatom to_chat(MM, "The bluespace interface on your bag of holding interferes with the teleport!") - return 1 + return TRUE // Safe location finder diff --git a/code/game/atoms.dm b/code/game/atoms.dm index f20b13e1a3..fe603dd7cd 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -244,32 +244,6 @@ else if(src in container) return 1 -/* - * atom/proc/search_contents_for(path,list/filter_path=null) - * Recursevly searches all atom contens (including contents contents and so on). - * - * ARGS: path - search atom contents for atoms of this type - * list/filter_path - if set, contents of atoms not of types in this list are excluded from search. - * - * RETURNS: list of found atoms - */ - -/atom/proc/search_contents_for(path,list/filter_path=null) - var/list/found = list() - for(var/atom/A in src) - if(istype(A, path)) - found += A - if(filter_path) - var/pass = 0 - for(var/type in filter_path) - pass |= istype(A, type) - if(!pass) - continue - if(A.contents.len) - found += A.search_contents_for(path,filter_path) - return found - - /atom/proc/examine(mob/user) //This reformat names to get a/an properly working on item descriptions when they are bloody var/f_name = "\a [src]." diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index ecfb6289ec..630a5929d7 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -91,9 +91,11 @@ var/obj/item/device/nuclear_challenge/challenge = new /obj/item/device/nuclear_challenge synd_mind.current.put_in_hands(challenge, TRUE) - var/list/foundIDs = synd_mind.current.search_contents_for(/obj/item/card/id) + var/static/id_cache = typecacheof(/obj/item/card/id) + var/list/foundIDs = typecache_filter_list(synd_mind.current.GetAllContents(), id_cache) if(foundIDs.len) - for(var/obj/item/card/id/ID in foundIDs) + for(var/i in 1 to foundIDs.len) + var/obj/item/card/id/ID = foundIDs[i] ID.name = "lead agent card" ID.access += ACCESS_SYNDICATE_LEADER else