Fully fixes atom init desyncs (#76179)

## About The Pull Request

The old system was... ok, but the stack trace was unfortuante, and the
potential to double remove was silly.
Let's use a list of source, value instead, to block overremovals and
properly support different load states

## Why It's Good For The Game

Prevents a bug a goodhearted bagilmin showed me where shuttles would
randomly just fail to load.
Calling clear twice should not be a failure

## Changelog
🆑
fix: Maps loaded post init will no longer randomly enter a failed state.
Hopefully.
/🆑
This commit is contained in:
LemonInTheDark
2023-06-21 15:08:45 -04:00
committed by GitHub
parent de91a75c83
commit 61d046d2b6
2 changed files with 40 additions and 29 deletions
+7 -6
View File
@@ -249,9 +249,9 @@
#define MAPLOADING_CHECK_TICK \
if(TICK_CHECK) { \
SSatoms.map_loader_stop(); \
SSatoms.map_loader_stop(REF(src)); \
stoplag(); \
SSatoms.map_loader_begin(); \
SSatoms.map_loader_begin(REF(src)); \
}
// Do not call except via load() above.
@@ -259,7 +259,7 @@
PRIVATE_PROC(TRUE)
// Tell ss atoms that we're doing maploading
// We'll have to account for this in the following tick_checks so it doesn't overflow
SSatoms.map_loader_begin()
SSatoms.map_loader_begin(REF(src))
// Loading used to be done in this proc
// We make the assumption that if the inner procs runtime, we WANT to do cleanup on them, but we should stil tell our parents we failed
@@ -272,7 +272,7 @@
sucessful = _dmm_load(x_offset, y_offset, z_offset, cropMap, no_changeturf, x_lower, x_upper, y_lower, y_upper, placeOnTop, new_z)
// And we are done lads, call it off
SSatoms.map_loader_stop()
SSatoms.map_loader_stop(REF(src))
if(new_z)
for(var/z_index in bounds[MAP_MINZ] to bounds[MAP_MAXZ])
@@ -409,7 +409,7 @@
var/list/cache = modelCache[gset.gridLines[i]]
if(!cache)
SSatoms.map_loader_stop()
SSatoms.map_loader_stop(REF(src))
CRASH("Undefined model key in DMM: [gset.gridLines[i]]")
build_coordinate(cache, locate(true_xcrd, ycrd, zcrd), no_afterchange, placeOnTop, new_z)
@@ -542,7 +542,7 @@
continue
var/list/cache = modelCache[model_key]
if(!cache)
SSatoms.map_loader_stop()
SSatoms.map_loader_stop(REF(src))
CRASH("Undefined model key in DMM: [model_key]")
build_coordinate(cache, locate(xcrd, ycrd, zcrd), no_afterchange, placeOnTop, new_z)
@@ -956,6 +956,7 @@ GLOBAL_LIST_EMPTY(map_model_default)
/datum/parsed_map/Destroy()
..()
SSatoms.map_loader_stop(REF(src)) // Just in case, I don't want to double up here
if(turf_blacklist)
turf_blacklist.Cut()
parsed_bounds.Cut()