From f61e22958f390485122d6fa8c80e23496ab1a74a Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Wed, 19 Jul 2017 05:12:17 -0500 Subject: [PATCH 1/5] split typecache filters into two procs --- code/__HELPERS/_lists.dm.rej | 23 +++++++++++++++++++++++ code/game/turfs/turf.dm.rej | 10 ++++++++++ 2 files changed, 33 insertions(+) create mode 100644 code/__HELPERS/_lists.dm.rej create mode 100644 code/game/turfs/turf.dm.rej diff --git a/code/__HELPERS/_lists.dm.rej b/code/__HELPERS/_lists.dm.rej new file mode 100644 index 0000000000..cb63e7e160 --- /dev/null +++ b/code/__HELPERS/_lists.dm.rej @@ -0,0 +1,23 @@ +diff a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm (rejected hunks) +@@ -89,12 +89,18 @@ + return + + //returns a new list with only atoms that are in typecache L +-//if reversed, return a new list with only atoms that aren't in typecache L +-/proc/typecache_filter_list(list/atoms, list/typecache, reversed=FALSE) ++/proc/typecache_filter_list(list/atoms, list/typecache) + . = list() + for (var/thing in atoms) + var/atom/A = thing +- if(typecache[A.type] != reversed) //This assumes typecache[A.type] is either null or TRUE. God help you if it's FALSE ++ if (typecache[A.type]) ++ . += A ++ ++/proc/typecache_filter_list_reverse(list/atoms, list/typecache) ++ . = list() ++ for (var/thing in atoms) ++ var/atom/A = thing ++ if (!typecache[A.type]) + . += A + + //Like typesof() or subtypesof(), but returns a typecache instead of a list diff --git a/code/game/turfs/turf.dm.rej b/code/game/turfs/turf.dm.rej new file mode 100644 index 0000000000..f4c27f5c30 --- /dev/null +++ b/code/game/turfs/turf.dm.rej @@ -0,0 +1,10 @@ +diff a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm (rejected hunks) +@@ -410,7 +410,7 @@ + /turf/proc/empty(turf_type=/turf/open/space, baseturf_type) + // Remove all atoms except observers, landmarks, docking ports + var/static/list/ignored_atoms = typecacheof(list(/mob/dead, /obj/effect/landmark, /obj/docking_port, /atom/movable/lighting_object)) +- var/list/allowed_contents = typecache_filter_list(GetAllContents(),ignored_atoms,reversed=TRUE) ++ var/list/allowed_contents = typecache_filter_list_reverse(GetAllContents(),ignored_atoms) + allowed_contents -= src + for(var/i in 1 to allowed_contents.len) + var/thing = allowed_contents[i] From 0b27e4c11b67fd8c6c89ec74186b28204d0a5f6e Mon Sep 17 00:00:00 2001 From: LetterJay Date: Wed, 19 Jul 2017 13:39:49 -0500 Subject: [PATCH 2/5] Update _lists.dm --- code/__HELPERS/_lists.dm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index 393c5a465d..c24f93d32a 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -88,16 +88,21 @@ L -= V //No return here so that it removes all strings of that type return -//returns a new list with only atoms that are in typecache L -/proc/typecache_filter_list(list/atoms, list/typecache, reversed=FALSE) + +/proc/typecache_filter_list(list/atoms, list/typecache) . = list() for (var/thing in atoms) var/atom/A = thing - if (typecache[A.type] && !reversed) - . += A - else if(reversed) + if (typecache[A.type]) . += A +/proc/typecache_filter_list_reverse(list/atoms, list/typecache) + . = list() + for (var/thing in atoms) + var/atom/A = thing + if (!typecache[A.type]) + . += A + //Like typesof() or subtypesof(), but returns a typecache instead of a list /proc/typecacheof(path, ignore_root_path, only_root_path = FALSE) if(ispath(path)) From b2032ed7f57aa43796092f66fb15bb565525e9db Mon Sep 17 00:00:00 2001 From: LetterJay Date: Wed, 19 Jul 2017 13:40:24 -0500 Subject: [PATCH 3/5] Update turf.dm --- code/game/turfs/turf.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 38247ea887..9ff36bf6c8 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -411,7 +411,7 @@ // Remove all atoms except observers, landmarks, docking ports var/turf/T0 = src var/static/list/ignored_atoms = typecacheof(list(/turf, /mob/dead, /obj/effect/landmark, /obj/docking_port, /atom/movable/lighting_object)) - var/list/allowed_contents = typecache_filter_list(T0.GetAllContents(),ignored_atoms,reversed=TRUE) + var/list/allowed_contents = typecache_filter_list_reverse(GetAllContents(),ignored_atoms) for(var/i in 1 to allowed_contents.len) var/thing = allowed_contents[i] qdel(thing, force=TRUE) From 3be62f3ccdd5d7418362a63025bb5c8b41f02055 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 31 Jul 2017 17:33:13 -0500 Subject: [PATCH 4/5] Update _lists.dm --- code/__HELPERS/_lists.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index 57df4f6d0c..df3daeeff9 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -101,7 +101,7 @@ for (var/thing in atoms) var/atom/A = thing if (!typecache[A.type]) - . += A + . += A //Like typesof() or subtypesof(), but returns a typecache instead of a list /proc/typecacheof(path, ignore_root_path, only_root_path = FALSE) From e8ae703c1661558f6c534857c20d553ceb131d7e Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 31 Jul 2017 18:15:16 -0500 Subject: [PATCH 5/5] Update turf.dm --- code/game/turfs/turf.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 2e7b560af3..924628a27d 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -414,7 +414,7 @@ allowed_contents -= src for(var/i in 1 to allowed_contents.len) var/thing = allowed_contents[i] - qdel(thing, force=TRUE + qdel(thing, force=TRUE) var/turf/newT = ChangeTurf(turf_type, baseturf_type, FALSE, FALSE)