From 8a1c28a3027d4babcd4ee3f1a6f4bca281549b92 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Fri, 8 Jun 2012 02:30:05 -0700 Subject: [PATCH] Made the sanity checks on rebuilding zones more rigorous, and less infinite-loopy --- code/ZAS/Processing.dm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/code/ZAS/Processing.dm b/code/ZAS/Processing.dm index 491e7bea8ec..c63b419f28a 100644 --- a/code/ZAS/Processing.dm +++ b/code/ZAS/Processing.dm @@ -11,7 +11,7 @@ zone/proc/process() //Choose a random turf and regenerate the zone from it. var - turf/sample = pick(contents) + turf/simulated/sample = pick(contents) list/new_contents problem = 0 @@ -19,11 +19,22 @@ zone/proc/process() del(space_tiles) contents.Remove(null) //I can't believe this is needed. + if(!contents.len) del src + + var/list/tried_turfs = list() do - sample = pick(contents) //Nor this. - while(!istype(sample) || !sample.CanPass(null, sample, 1.5, 1)) + if(sample) + tried_turfs |= sample + sample = pick(contents - tried_turfs) //Nor this. + while(length(contents - tried_turfs) && (!istype(sample) || !sample.CanPass(null, sample, 1.5, 1))) + + if(!sample) //Not a single valid turf. + for(var/turf/simulated/T in contents) + air_master.tiles_to_update |= T + del src + new_contents = FloodFill(sample) for(var/turf/space/S in new_contents)