From 29298dfee9fdfd0cdc6531972a2d024734e18fe3 Mon Sep 17 00:00:00 2001 From: oranges Date: Wed, 14 Dec 2016 07:25:27 +0000 Subject: [PATCH] Reorder spacevine change turf qdel spacevines lead to them calling changeturf, lead to them being qdeleted lead to them calling changeturf etc etc This way the turf is changed before the vines are deleted, so the changeturf calls should not be hit. Further protection is added in the form of checking if that vine is actually in the process of being qdeleted, which limits the recursion to the maximum of how many vines are on the tile --- code/game/turfs/simulated/floor/misc_floor.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/game/turfs/simulated/floor/misc_floor.dm b/code/game/turfs/simulated/floor/misc_floor.dm index 203f46e07ba..6189e068261 100644 --- a/code/game/turfs/simulated/floor/misc_floor.dm +++ b/code/game/turfs/simulated/floor/misc_floor.dm @@ -211,7 +211,9 @@ ChangeTurf(src.baseturf) /turf/open/floor/vines/ChangeTurf(turf/open/floor/T) - for(var/obj/structure/spacevine/SV in src) - qdel(SV) . = ..() + //Do this *after* the turf has changed as qdel in spacevines will call changeturf again if it hasn't + for(var/obj/structure/spacevine/SV in src) + if(!qdestroying(SV))//Helps avoid recursive loops + qdel(SV) UpdateAffectingLights()