Merge pull request #2072 from Citadel-Station-13/upstream-merge-29367
[MIRROR] split typecache filters into two procs
This commit is contained in:
@@ -89,16 +89,21 @@
|
||||
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)
|
||||
/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
|
||||
|
||||
/proc/typecacheof(path, ignore_root_path, only_root_path = FALSE)
|
||||
if(ispath(path))
|
||||
var/list/types = list()
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
diff a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm (rejected hunks)
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
//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)
|
||||
+/proc/typecache_filter_list(list/atoms, list/typecache, reversed=FALSE)
|
||||
. = list()
|
||||
for (var/thing in atoms)
|
||||
var/atom/A = thing
|
||||
|
||||
@@ -407,10 +407,10 @@
|
||||
if(!SSticker.HasRoundStarted())
|
||||
add_blueprints(AM)
|
||||
|
||||
/turf/proc/empty(turf_type=/turf/open/space, baseturf_type)
|
||||
/turf/proc/empty(turf_type=/turf/open/space, baseturf_type, delmobs = TRUE, forceop = FALSE)
|
||||
// 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(),delmobs? ignored_atoms : ignored_atoms + typecacheof(list(/mob)))
|
||||
allowed_contents -= src
|
||||
for(var/i in 1 to allowed_contents.len)
|
||||
var/thing = allowed_contents[i]
|
||||
|
||||
10
code/game/turfs/turf.dm.rej
Normal file
10
code/game/turfs/turf.dm.rej
Normal file
@@ -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