split typecache filters into two procs
This commit is contained in:
@@ -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
|
||||
@@ -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]
|
||||
Reference in New Issue
Block a user