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

@@ -76,6 +76,7 @@
var/multiz_render_cap = 8 //how far down open spaces will render
var/multiz_bottom_cap = 16 //how far down open spaces will detect for a bottom
// BSQL things
var/bsql_debug = 0
@@ -583,6 +584,8 @@
if("multiz_render_cap")
multiz_render_cap = text2num(value)
if("multiz_bottom_cap")
multiz_bottom_cap = text2num(value)
if("media_base_url")
media_base_url = value

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

View File

@@ -368,4 +368,7 @@ BSQL_THREAD_LIMIT 50
#BSQL_DEBUG
## The maximum number of z-levels rendered above or below in multi-z
MULTIZ_RENDER_CAP 8
MULTIZ_RENDER_CAP 8
## The maximum number of z-levels checked below in multi-z
MULTIZ_BOTTOM_CAP 16