Fix sector initialization stack overflow crash.

- Replace changes from 8c7371c5d4b900308cecdba5335989e8c9f191fe
    - Removed debugging prints in skybox generation
    - Reverted change to GetConnnectedZLevels to avoid the chicken-or-egg initialization issue of find_z_levels() requiring knowledge of a sector's z-levels during the attempt to determine a sector's z-levels.
    - Make find_z_levels() always called again so that lazy open space initialization works on landable ships again.
- Instead, allow static configuration of sector map_z to override the default behavior of calling GetConnectedZLevels()
This commit is contained in:
Leshana
2020-06-25 10:36:16 -04:00
parent ebe7bd1975
commit 0a461a507b
3 changed files with 5 additions and 11 deletions

View File

@@ -95,8 +95,6 @@ SUBSYSTEM_DEF(skybox)
return skybox_cache["[z]"]
/datum/controller/subsystem/skybox/proc/generate_skybox(z)
to_world("generating skybox for z[z]")
var/datum/skybox_settings/settings = global.using_map.get_skybox_datum(z)
var/image/res = image(settings.icon)
@@ -115,12 +113,10 @@ SUBSYSTEM_DEF(skybox)
if(global.using_map.use_overmap && settings.use_overmap_details)
var/obj/effect/overmap/visitable/O = get_overmap_sector(z)
if(istype(O))
to_world("found sector [O] \ref[O] for z[z]")
var/image/overmap = image(settings.icon)
overmap.overlays += O.generate_skybox()
for(var/obj/effect/overmap/visitable/other in O.loc)
if(other != O)
to_world("found secondary sector [other] \ref[other]")
overmap.overlays += other.get_skybox_representation()
overmap.appearance_flags = RESET_COLOR
res.overlays += overmap
@@ -149,7 +145,7 @@ SUBSYSTEM_DEF(skybox)
var/icon_state = "dyable"
var/color
var/random_color = FALSE
var/use_stars = TRUE
var/star_icon = 'icons/skybox/skybox.dmi'
var/star_state = "stars"

View File

@@ -37,8 +37,6 @@ var/list/z_levels = list()// Each bit re... haha just kidding this is a list of
return HasBelow(turf.z) ? get_step(turf, DOWN) : null
/proc/GetConnectedZlevels(z)
if(z in using_map.map_levels)
return using_map.get_map_levels(z, FALSE) // Connected z levels aren't necessarily attached by multi-z, using_map shound know the details
. = list(z)
for(var/level = z, HasBelow(level), level--)
. |= level-1

View File

@@ -6,7 +6,7 @@
scannable = TRUE
scanner_desc = "!! No Data Available !!"
var/list/map_z = null
var/list/map_z = list()
var/list/extra_z_levels //if you need to manually insist that these z-levels are part of this sector, for things like edge-of-map step trigger transitions rather than multi-z complexes
var/list/initial_generic_waypoints //store landmark_tag of landmarks that should be added to the actual lists below on init.
@@ -31,8 +31,7 @@
if(. == INITIALIZE_HINT_QDEL)
return
if(!map_z) // If map_z is already defined, we don't need to find where we are
find_z_levels() // This populates map_z and assigns z levels to the ship.
find_z_levels() // This populates map_z and assigns z levels to the ship.
register_z_levels() // This makes external calls to update global z level information.
if(!global.using_map.overmap_z)
@@ -60,7 +59,8 @@
. += A
/obj/effect/overmap/visitable/proc/find_z_levels()
map_z = GetConnectedZlevels(z)
if(!LAZYLEN(map_z)) // If map_z is already populated use it as-is, otherwise start with connected z-levels.
map_z = GetConnectedZlevels(z)
if(LAZYLEN(extra_z_levels))
map_z |= extra_z_levels