mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-12 02:32:10 +00:00
Save 0.1s in generate_station_area_list (#70933)
`area.contents` loops over everything in the world to collect its list, every time. We need to avoid it where possible. Lemon already working on a PR to cache it. In the distant future we will lint this. This was a useless consumer of it. It cost 0.1s to index contents twice like this.
This commit is contained in:
@@ -425,12 +425,11 @@ Used by the AI doomsday and the self-destruct nuke.
|
|||||||
GLOBAL_LIST_EMPTY(the_station_areas)
|
GLOBAL_LIST_EMPTY(the_station_areas)
|
||||||
|
|
||||||
/datum/controller/subsystem/mapping/proc/generate_station_area_list()
|
/datum/controller/subsystem/mapping/proc/generate_station_area_list()
|
||||||
for(var/area/station/A in world)
|
for(var/area/station/station_area in world)
|
||||||
if (!A.contents.len || !(A.area_flags & UNIQUE_AREA))
|
if (!(station_area.area_flags & UNIQUE_AREA))
|
||||||
continue
|
continue
|
||||||
var/turf/picked = A.contents[1]
|
if (is_station_level(station_area.z))
|
||||||
if (is_station_level(picked.z))
|
GLOB.the_station_areas += station_area.type
|
||||||
GLOB.the_station_areas += A.type
|
|
||||||
|
|
||||||
if(!GLOB.the_station_areas.len)
|
if(!GLOB.the_station_areas.len)
|
||||||
log_world("ERROR: Station areas list failed to generate!")
|
log_world("ERROR: Station areas list failed to generate!")
|
||||||
|
|||||||
Reference in New Issue
Block a user