diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/lists.dm index 5d7263356a5..0196f326792 100644 --- a/code/__HELPERS/lists.dm +++ b/code/__HELPERS/lists.dm @@ -639,5 +639,4 @@ proc/dd_sortedObjectList(list/incoming) #define LAZYCLEARLIST(L) if(L) L.Cut() // LAZYING PT 2: THE LAZENING -#define LAZYREINITLIST(L) LAZYCLEARLIST(L); LAZYINITLIST(L) -#define LAZYQDELLIST(L) if(L) for(var/o in L) { qdel(o); L.Cut() } +#define LAZYREINITLIST(L) LAZYCLEARLIST(L); LAZYINITLIST(L); diff --git a/code/__HELPERS/qdel.dm b/code/__HELPERS/qdel.dm index e8a11f27a66..2aea6de0dd7 100644 --- a/code/__HELPERS/qdel.dm +++ b/code/__HELPERS/qdel.dm @@ -1,2 +1,5 @@ #define QDEL_IN(item, time) addtimer(GLOBAL_PROC, "qdel", time, FALSE, item) -#define QDEL_NULL(item) if(item) { qdel(item); item = null } \ No newline at end of file +#define QDEL_NULL(item) if(item) { qdel(item); item = null } +#define QDEL_LIST(L) if(L) { for(var/I in L) qdel(I); L.Cut(); } +#define QDEL_LIST_ASSOC(L) if(L) { for(var/I in L) { qdel(L[I]); qdel(I); } L.Cut(); } +#define QDEL_LIST_ASSOC_VAL(L) if(L) { for(var/I in L) qel(L[I]); L.Cut(); } diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 6a3b3aaeaab..cc2458c7cf4 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -65,9 +65,7 @@ add_to_all_human_data_huds() /mob/living/carbon/human/Destroy() - for(var/atom/movable/organelle in bodyparts) - qdel(organelle) - bodyparts.Cut() + QDEL_LIST(bodyparts) return ..() /mob/living/carbon/human/dummy diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 82a6a5e8741..d2d44757705 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -184,8 +184,8 @@ /datum/species/proc/create_organs(var/mob/living/carbon/human/H) //Handles creation of mob organs. - LAZYQDELLIST(H.internal_organs) - LAZYQDELLIST(H.bodyparts) + QDEL_LIST(H.internal_organs) + QDEL_LIST(H.bodyparts) LAZYREINITLIST(H.bodyparts) LAZYREINITLIST(H.bodyparts_by_name)