mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
[MIRROR] Micro optimizations: Now much less exhaustive [MDB IGNORE] (#9541)
* Micro optimizations: Now much less exhaustive (#62844) * Micro optimizations: Now much less exhaustive Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
This commit is contained in:
@@ -169,8 +169,7 @@
|
||||
/proc/typecache_filter_list(list/atoms, list/typecache)
|
||||
RETURN_TYPE(/list)
|
||||
. = list()
|
||||
for(var/thing in atoms)
|
||||
var/atom/atom_checked = thing
|
||||
for(var/atom/atom_checked as anything in atoms)
|
||||
if (typecache[atom_checked.type])
|
||||
. += atom_checked
|
||||
|
||||
@@ -178,16 +177,16 @@
|
||||
/proc/typecache_filter_list_reverse(list/atoms, list/typecache)
|
||||
RETURN_TYPE(/list)
|
||||
. = list()
|
||||
for(var/atom/atom as anything in atoms)
|
||||
if(!typecache[atom.type])
|
||||
. += atom
|
||||
for(var/atom/atom_checked as anything in atoms)
|
||||
if(!typecache[atom_checked.type])
|
||||
. += atom_checked
|
||||
|
||||
///similar to typecache_filter_list and typecache_filter_list_reverse but it supports an inclusion list and and exclusion list
|
||||
/proc/typecache_filter_multi_list_exclusion(list/atoms, list/typecache_include, list/typecache_exclude)
|
||||
. = list()
|
||||
for(var/atom/atom as anything in atoms)
|
||||
if(typecache_include[atom.type] && !typecache_exclude[atom.type])
|
||||
. += atom
|
||||
for(var/atom/atom_checked as anything in atoms)
|
||||
if(typecache_include[atom_checked.type] && !typecache_exclude[atom_checked.type])
|
||||
. += atom_checked
|
||||
|
||||
///Like typesof() or subtypesof(), but returns a typecache instead of a list
|
||||
/proc/typecacheof(path, ignore_root_path, only_root_path = FALSE)
|
||||
|
||||
@@ -352,10 +352,9 @@
|
||||
///wrapper for flick_overlay(), flicks to everyone who can see the target atom
|
||||
/proc/flick_overlay_view(image/image_to_show, atom/target, duration)
|
||||
var/list/viewing = list()
|
||||
for(var/viewer in viewers(target))
|
||||
var/mob/viewer_mob = viewer
|
||||
if(viewer_mob.client)
|
||||
viewing += viewer_mob.client
|
||||
for(var/mob/viewer as anything in viewers(target))
|
||||
if(viewer.client)
|
||||
viewing += viewer.client
|
||||
flick_overlay(image_to_show, viewing, duration)
|
||||
|
||||
///Get active players who are playing in the round
|
||||
@@ -584,7 +583,7 @@
|
||||
/proc/find_obstruction_free_location(range, atom/center, area/specific_area)
|
||||
var/list/possible_loc = list()
|
||||
|
||||
for(var/turf/found_turf in RANGE_TURFS(range, center))
|
||||
for(var/turf/found_turf as anything in RANGE_TURFS(range, center))
|
||||
// We check if both the turf is a floor, and that it's actually in the area.
|
||||
// We also want a location that's clear of any obstructions.
|
||||
if (specific_area && !istype(get_area(found_turf), specific_area))
|
||||
|
||||
Reference in New Issue
Block a user