mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
Ensures areas are allowed to be non unique (#70118)
Did you know that areas can be non unique (unique per area) I didn't, and I wrote mapping code such that we'd make all areas unique This fixes that. It costs 0.1 seconds but without it areas don't work anymore
This commit is contained in:
@@ -15,6 +15,9 @@
|
||||
var/key_len = 0
|
||||
var/list/grid_models = list()
|
||||
var/list/gridSets = list()
|
||||
/// List of area types we've loaded AS A PART OF THIS MAP
|
||||
/// We do this to allow non unique areas, so we'll only load one per map
|
||||
var/list/area/loaded_areas = list()
|
||||
|
||||
var/list/modelCache
|
||||
|
||||
@@ -445,7 +448,6 @@ GLOBAL_LIST_EMPTY(map_model_default)
|
||||
|
||||
// We use static lists here because it's cheaper then passing them around
|
||||
var/static/list/default_list = GLOB.map_model_default
|
||||
var/static/list/area_cache = GLOB.areas_by_type
|
||||
////////////////
|
||||
//Instanciation
|
||||
////////////////
|
||||
@@ -460,14 +462,17 @@ GLOBAL_LIST_EMPTY(map_model_default)
|
||||
if(members[index] != /area/template_noop)
|
||||
if(members_attributes[index] != default_list)
|
||||
world.preloader_setup(members_attributes[index], members[index])//preloader for assigning set variables on atom creation
|
||||
instance = area_cache[members[index]]
|
||||
if (!instance)
|
||||
// Done here because it's cheaper then doing it in the outside check
|
||||
instance = loaded_areas[members[index]]
|
||||
if(!instance)
|
||||
var/area_type = members[index]
|
||||
instance = new area_type(null)
|
||||
if(!instance)
|
||||
CRASH("[area_type] failed to be new'd, what'd you do?")
|
||||
area_cache[area_type] = instance
|
||||
// If this parsed map doesn't have that area already, we check the global cache
|
||||
instance = GLOB.areas_by_type[area_type]
|
||||
// If the global list DOESN'T have this area it's either not a unique area, or it just hasn't been created yet
|
||||
if (!instance)
|
||||
instance = new area_type(null)
|
||||
if(!instance)
|
||||
CRASH("[area_type] failed to be new'd, what'd you do?")
|
||||
loaded_areas[area_type] = instance
|
||||
|
||||
instance.contents.Add(crds)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user