From 0994c9dbe7832b394c1abab56d2785124da967cd Mon Sep 17 00:00:00 2001 From: Leshana Date: Sun, 27 May 2018 13:18:11 -0400 Subject: [PATCH] Removes the global lists all_clothing, all_items, all_objs, and all_atoms for performance reasons. - The cost of maintaining these lists is more than the benefit of having them (mostly used only for debugging code) --- code/game/atoms.dm | 2 -- .../machinery/computer3/computers/crew.dm | 2 +- code/game/objects/items.dm | 4 +--- code/game/objects/objs.dm | 2 -- .../fun_secrets/remove_all_clothing.dm | 2 +- .../fun_secrets/remove_internal_clothing.dm | 2 +- code/modules/admin/verbs/SDQL.dm | 6 ++--- code/modules/admin/verbs/debug.dm | 2 +- code/modules/admin/verbs/mapping.dm | 4 ++-- code/modules/admin/verbs/massmodvar.dm | 24 +++++++++---------- code/modules/admin/view_variables/topic.dm | 4 ++-- code/modules/clothing/clothing.dm | 2 -- code/modules/recycling/disposal.dm | 2 +- 13 files changed, 25 insertions(+), 33 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index d75a75fe31..dda3e0a6b5 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1,5 +1,3 @@ -GLOBAL_LIST_BOILERPLATE(all_atoms, /atom) // Use with care, its likely barely better than using world. - /atom layer = TURF_LAYER //This was here when I got here. Why though? var/level = 2 diff --git a/code/game/machinery/computer3/computers/crew.dm b/code/game/machinery/computer3/computers/crew.dm index 085c8e3963..e0112532dd 100644 --- a/code/game/machinery/computer3/computers/crew.dm +++ b/code/game/machinery/computer3/computers/crew.dm @@ -56,7 +56,7 @@ /datum/file/program/crew/proc/scan() - for(var/obj/item/clothing/under/C in all_clothing) + for(var/obj/item/clothing/under/C in world) if((C.has_sensor) && (istype(C.loc, /mob/living/carbon/human))) tracked |= C return 1 diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 1d44bd1ed7..b732e1c546 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -1,5 +1,3 @@ -GLOBAL_LIST_BOILERPLATE(all_items, /obj/item) - /obj/item name = "item" icon = 'icons/obj/items.dmi' @@ -588,7 +586,7 @@ var/list/global/slot_flags_enumeration = list( I.Blend(new /icon('icons/effects/blood.dmi', "itemblood"),ICON_MULTIPLY) //adds blood and the remaining white areas become transparant //not sure if this is worth it. It attaches the blood_overlay to every item of the same type if they don't have one already made. - for(var/obj/item/A in all_items) + for(var/obj/item/A in world) if(A.type == type && !A.blood_overlay) A.blood_overlay = image(I) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index be067b620e..3835b2a24b 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -1,5 +1,3 @@ -GLOBAL_LIST_BOILERPLATE(all_objs, /obj) - /obj layer = OBJ_LAYER plane = OBJ_PLANE diff --git a/code/modules/admin/secrets/fun_secrets/remove_all_clothing.dm b/code/modules/admin/secrets/fun_secrets/remove_all_clothing.dm index 45d6e646c4..28e9497f53 100644 --- a/code/modules/admin/secrets/fun_secrets/remove_all_clothing.dm +++ b/code/modules/admin/secrets/fun_secrets/remove_all_clothing.dm @@ -6,5 +6,5 @@ if(!.) return - for(var/obj/item/clothing/O in all_clothing) + for(var/obj/item/clothing/O in world) qdel(O) diff --git a/code/modules/admin/secrets/fun_secrets/remove_internal_clothing.dm b/code/modules/admin/secrets/fun_secrets/remove_internal_clothing.dm index 9509588c13..73dba4ce4f 100644 --- a/code/modules/admin/secrets/fun_secrets/remove_internal_clothing.dm +++ b/code/modules/admin/secrets/fun_secrets/remove_internal_clothing.dm @@ -6,5 +6,5 @@ if(!.) return - for(var/obj/item/clothing/under/O in all_clothing) + for(var/obj/item/clothing/under/O in world) qdel(O) diff --git a/code/modules/admin/verbs/SDQL.dm b/code/modules/admin/verbs/SDQL.dm index da3e9a6bd5..969e5cd47c 100644 --- a/code/modules/admin/verbs/SDQL.dm +++ b/code/modules/admin/verbs/SDQL.dm @@ -115,7 +115,7 @@ from_objs += m else if(text_starts_with(f, "/obj/item")) - for(var/obj/item/m in all_items) + for(var/obj/item/m in world) if(istype(m, f2)) from_objs += m @@ -125,12 +125,12 @@ from_objs += m else if(text_starts_with(f, "/obj")) - for(var/obj/m in all_objs) + for(var/obj/m in world) if(istype(m, f2)) from_objs += m else if(text_starts_with(f, "/atom")) - for(var/atom/m in all_atoms) + for(var/atom/m in world) if(istype(m, f2)) from_objs += m /* diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 3582aab0c7..50bc79d8fe 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -183,7 +183,7 @@ var/blocked = list(/obj, /mob, /mob/living, /mob/living/carbon, /mob/living/carbon/human, /mob/observer/dead, /mob/living/silicon, /mob/living/silicon/robot, /mob/living/silicon/ai) var/hsbitem = input(usr, "Choose an object to delete.", "Delete:") as null|anything in typesof(/obj) + typesof(/mob) - blocked if(hsbitem) - for(var/atom/O in all_atoms) + for(var/atom/O in world) if(istype(O, hsbitem)) qdel(O) log_admin("[key_name(src)] has deleted all instances of [hsbitem].") diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index 4e106cfbba..04df02e37a 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -296,7 +296,7 @@ var/list/debug_verbs = list ( var/list/atom/atom_list = list() - for(var/atom/A in all_atoms) + for(var/atom/A in world) if(istype(A,type_path)) var/atom/B = A while(!(isturf(B.loc))) @@ -332,7 +332,7 @@ var/list/debug_verbs = list ( var/count = 0 - for(var/atom/A in all_atoms) + for(var/atom/A in world) if(istype(A,type_path)) count++ /* diff --git a/code/modules/admin/verbs/massmodvar.dm b/code/modules/admin/verbs/massmodvar.dm index 7dd21ec190..09178d650e 100644 --- a/code/modules/admin/verbs/massmodvar.dm +++ b/code/modules/admin/verbs/massmodvar.dm @@ -139,7 +139,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if ( istype(A , O.type) ) A.vars[variable] = O.vars[variable] @@ -155,7 +155,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if (A.type == O.type) A.vars[variable] = O.vars[variable] @@ -179,7 +179,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if ( istype(A , O.type) ) A.vars[variable] = O.vars[variable] @@ -194,7 +194,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if (A.type == O.type) A.vars[variable] = O.vars[variable] @@ -223,7 +223,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if ( istype(A , O.type) ) if(variable=="light_range") A.set_light(new_value) @@ -248,7 +248,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if (A.type == O.type) if(variable=="light_range") A.set_light(new_value) @@ -275,7 +275,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if ( istype(A , O.type) ) A.vars[variable] = O.vars[variable] @@ -290,7 +290,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if (A.type == O.type) A.vars[variable] = O.vars[variable] @@ -311,7 +311,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O.type, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if ( istype(A , O.type) ) A.vars[variable] = O.vars[variable] @@ -326,7 +326,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O.type, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if (A.type == O.type) A.vars[variable] = O.vars[variable] @@ -346,7 +346,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if ( istype(A , O.type) ) A.vars[variable] = O.vars[variable] @@ -362,7 +362,7 @@ M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) - for(var/obj/A in all_objs) + for(var/obj/A in world) if (A.type == O.type) A.vars[variable] = O.vars[variable] diff --git a/code/modules/admin/view_variables/topic.dm b/code/modules/admin/view_variables/topic.dm index ec7bbe34a3..7c68737490 100644 --- a/code/modules/admin/view_variables/topic.dm +++ b/code/modules/admin/view_variables/topic.dm @@ -184,7 +184,7 @@ switch(action_type) if("Strict type") var/i = 0 - for(var/obj/Obj in all_objs) + for(var/obj/Obj in world) if(Obj.type == O_type) i++ qdel(Obj) @@ -195,7 +195,7 @@ message_admins("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted)") if("Type and subtypes") var/i = 0 - for(var/obj/Obj in all_objs) + for(var/obj/Obj in world) if(istype(Obj,O_type)) i++ qdel(Obj) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 8ee8a5fa0b..27c7ecbd11 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -1,5 +1,3 @@ -GLOBAL_LIST_BOILERPLATE(all_clothing, /obj/item/clothing) - /obj/item/clothing name = "clothing" siemens_coefficient = 0.9 diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 680c4b8ac4..a9b0b213ed 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -967,7 +967,7 @@ // *** TEST verb //client/verb/dispstop() -// for(var/obj/structure/disposalholder/H in all_objs) +// for(var/obj/structure/disposalholder/H in world) // H.active = 0 // a straight or bent segment