for(var/bad_code in world)

Removes a very large amount of world loops.
Adds a macro to painlessly generate a global list, and the needed code to modify the list when an object is made or deleted automatically.
Cleans up some commented out code.
This commit is contained in:
Neerti
2018-04-29 17:55:04 -04:00
parent 81c19c62a3
commit be73b8c36a
103 changed files with 274 additions and 403 deletions

View File

@@ -84,7 +84,7 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
evac = 1
emergency_shuttle_called.Announce(replacetext(using_map.emergency_shuttle_called_message, "%ETA%", "[estimated_time] minute\s"))
for(var/area/A in world)
for(var/area/A in all_areas)
if(istype(A, /area/hallway))
A.readyalert()
@@ -116,7 +116,7 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
if (evac)
emergency_shuttle_recalled.Announce(using_map.emergency_shuttle_recall_message)
for(var/area/A in world)
for(var/area/A in all_areas)
if(istype(A, /area/hallway))
A.readyreset()
evac = 0

View File

@@ -49,67 +49,8 @@ datum/controller/game_controller/proc/setup()
// #endif
datum/controller/game_controller/proc/setup_objects()
// #if !UNIT_TEST
// var/initialized_objects = 0
// #endif
// Set up antagonists.
populate_antag_type_list()
//Set up spawn points.
populate_spawn_points()
/*
admin_notice("<span class='danger'>Initializing Floor Decals</span>", R_DEBUG)
var/list/turfs_with_decals = list()
for(var/obj/effect/floor_decal/D in world)
var/T = D.add_to_turf_decals()
if(T) turfs_with_decals |= T
CHECK_SLEEP_MASTER
for(var/item in turfs_with_decals)
var/turf/T = item
if(T.decals) T.apply_decals()
CHECK_SLEEP_MASTER
floor_decals_initialized = TRUE
sleep(1)
admin_notice("<span class='danger'>Initializing objects</span>", R_DEBUG)
for(var/atom/movable/object in world)
if(!QDELETED(object))
object.initialize()
CHECK_SLEEP_MASTER
sleep(1)
admin_notice("<span class='danger'>Initializing areas</span>", R_DEBUG)
for(var/area/area in all_areas)
area.initialize()
CHECK_SLEEP_MASTER
sleep(1)
admin_notice("<span class='danger'>Initializing atmos machinery connections.</span>", R_DEBUG)
for(var/obj/machinery/atmospherics/machine in machines)
machine.atmos_init()
CHECK_SLEEP_MASTER
admin_notice("<span class='danger'>Initializing pipe networks</span>", R_DEBUG)
for(var/obj/machinery/atmospherics/machine in machines)
machine.build_network()
CHECK_SLEEP_MASTER
admin_notice("<span class='danger'>Initializing atmos machinery.</span>", R_DEBUG)
for(var/obj/machinery/atmospherics/unary/U in machines)
if(istype(U, /obj/machinery/atmospherics/unary/vent_pump))
var/obj/machinery/atmospherics/unary/vent_pump/T = U
T.broadcast_status()
else if(istype(U, /obj/machinery/atmospherics/unary/vent_scrubber))
var/obj/machinery/atmospherics/unary/vent_scrubber/T = U
T.broadcast_status()
CHECK_SLEEP_MASTER
admin_notice("<span class='danger'>Initializing turbolifts</span>", R_DEBUG)
for(var/thing in turbolifts)
var/obj/turbolift_map_holder/lift = thing
if(!QDELETED(lift))
lift.initialize()
CHECK_SLEEP_MASTER
*/

View File

@@ -35,7 +35,7 @@ SUBSYSTEM_DEF(air)
current_cycle = 0
var/simulated_turf_count = 0
for(var/turf/simulated/S in world)
for(var/turf/simulated/S in turfs)
simulated_turf_count++
S.update_air_properties()
CHECK_TICK

View File

@@ -46,7 +46,7 @@ SUBSYSTEM_DEF(atoms)
CHECK_TICK
else
count = 0
for(var/atom/A in world)
for(var/atom/A in world) // This must be world, since this operation adds all the atoms to their specific lists.
if(!A.initialized)
InitAtom(A, mapload_arg)
++count

View File

@@ -30,7 +30,7 @@ SUBSYSTEM_DEF(xenoarch)
. = ..()
/datum/controller/subsystem/xenoarch/proc/SetupXenoarch()
for(var/turf/simulated/mineral/M in world)
for(var/turf/simulated/mineral/M in turfs)
if(!M.density)
continue