Revert "Revert "Multi-z infinite loop fixes (#30996)" (#31000)" (#31002)

This reverts commit 07e41392ef.
This commit is contained in:
kane-f
2021-10-07 01:36:15 +01:00
committed by GitHub
parent a600a1694a
commit 1c63d87b37
4 changed files with 23 additions and 1 deletions

View File

@@ -25,8 +25,12 @@
/proc/GetConnectedZlevels(z)
. = list(z)
for(var/level = z, HasBelow(level), level = map.zLevels[level].z_below)
if((level != z) && (level in .)) // No infinite loops
break
. |= level
for(var/level = z, HasAbove(level), level = map.zLevels[level].z_above)
if((level != z) && (level in .)) // No infinite loops
break
. |= level
/proc/AreConnectedZLevels(var/zA, var/zB)
@@ -38,8 +42,12 @@
return list()
. = list(turf.z)
for(var/level = turf.z, HasBelow(level) && isvisiblespace(GetBelow(locate(turf.x,turf.y,level))), level = map.zLevels[level].z_below)
if((level != turf.z) && (level in .)) // No infinite loops
break
. |= level
for(var/level = turf.z, HasAbove(level) && isvisiblespace(GetAbove(locate(turf.x,turf.y,level))), level = map.zLevels[level].z_above)
if((level != turf.z) && (level in .)) // No infinite loops
break
. |= level
/proc/AreOpenConnectedZLevels(var/zA, var/zB)

View File

@@ -31,7 +31,11 @@
return
var/turf/bottom = null
var/depth = 0
for(bottom = GetBelow(src); isopenspace(bottom); bottom = GetBelow(bottom))
depth++
if(depth > config.multiz_bottom_cap) // To stop getting caught on this in infinite loops
break
if(istype(bottom,/turf/space))
return
@@ -64,7 +68,11 @@
return
bottom = null
depth = 0
for(bottom = GetBelow(src); isopenspace(bottom); bottom = GetBelow(bottom))
depth++
if(depth > config.multiz_bottom_cap) // To stop getting caught on this in infinite loops
break
if(istype(bottom,/turf/space))
return