[MIRROR] Removes 200mb of wasted memory usage (#3472)

* Merge pull request #31835 from MrStonedOne/coiax-is-fired---again

Removes 200mb of wasted memory usage

* Removes 200mb of wasted memory usage
This commit is contained in:
CitadelStationBot
2017-10-17 22:18:19 -05:00
committed by Poojawa
parent 9691c9130f
commit 7f9d13ab42
3 changed files with 8 additions and 4 deletions
+1
View File
@@ -485,6 +485,7 @@
//Picks from the list, with some safeties, and returns the "default" arg if it fails
#define DEFAULTPICK(L, default) ((islist(L) && length(L)) ? pick(L) : default)
#define LAZYINITLIST(L) if (!L) L = list()
#define UNSETEMPTY(L) if (L && !L.len) L = null
#define LAZYREMOVE(L, I) if(L) { L -= I; if(!L.len) { L = null; } }
+3 -1
View File
@@ -4,6 +4,8 @@
//Note: typecache can only replace istype if you know for sure the thing is at least a datum.
GLOBAL_LIST_INIT(typecache_mob, typecacheof(list(/mob)))
GLOBAL_LIST_INIT(typecache_living, typecacheof(list(/mob/living)))
GLOBAL_LIST_INIT(typecache_machine_or_structure, typecacheof(list(/obj/machinery))|typecacheof(list(/obj/structure)))
+4 -3
View File
@@ -117,7 +117,7 @@ Class Procs:
var/panel_open = FALSE
var/state_open = FALSE
var/critical_machine = FALSE //If this machine is critical to station operation and should have the area be excempted from power failures.
var/list/occupant_typecache = list(/mob/living) // turned into typecache in Initialize
var/list/occupant_typecache //if set, turned into typecache in Initialize, other wise, defaults to mob/living typecache
var/atom/movable/occupant = null
var/unsecuring_tool = /obj/item/wrench
var/interact_open = FALSE // Can the machine be interacted with when in maint/when the panel is open.
@@ -141,7 +141,8 @@ Class Procs:
START_PROCESSING(SSfastprocess, src)
power_change()
occupant_typecache = typecacheof(occupant_typecache)
if (occupant_typecache)
occupant_typecache = typecacheof(occupant_typecache)
/obj/machinery/Destroy()
GLOB.machines.Remove(src)
@@ -189,7 +190,7 @@ Class Procs:
density = TRUE
if(!target)
for(var/am in loc)
if(!is_type_in_typecache(am, occupant_typecache))
if(!is_type_in_typecache(am, (occupant_typecache || GLOB.typecache_living)))
continue
var/atom/movable/AM = am
if(AM.has_buckled_mobs())