Skip to content

Commit

Permalink
Some sanity (to a stupid degree) on flood filling turfs.
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyMarshal committed Jun 6, 2012
1 parent 6c9baab commit 01d9308
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions code/ZAS/Creation.dm
Expand Up @@ -34,6 +34,8 @@ zone
. = ..()

proc/FloodFill(turf/start)
if(!istype(start))
return list()
var
list
open = list(start)
Expand Down
15 changes: 8 additions & 7 deletions code/ZAS/Processing.dm
Expand Up @@ -12,9 +12,15 @@ zone/proc/process()
//Choose a random turf and regenerate the zone from it.
var
turf/sample = pick(contents)
list/new_contents = FloodFill(sample)
list/new_contents
problem = 0

contents.Remove(null) //I can't believe this is needed.
do
sample = pick(contents) //Nor this.
while(!istype(sample))
new_contents = FloodFill(sample)

//If something isn't carried over, there was a complication.
for(var/turf/T in contents)
if(!(T in new_contents))
Expand All @@ -27,15 +33,10 @@ zone/proc/process()
contents -= T
rebuild_turfs += T
T.zone = null
var/zone/Z
for(var/turf/T in rebuild_turfs)
if(!T.zone)
var/list/flood_fill = FloodFill(T)
Z = new /zone()
var/zone/Z = new /zone(T)
Z.air.copy_from(air)
for(var/turf/NT in flood_fill)
Z.AddTurf(NT)

rebuild = 0

//Sometimes explosions will cause the air to be deleted for some reason.
Expand Down

0 comments on commit 01d9308

Please sign in to comment.