purge turfs list

This commit is contained in:
Sood
2017-02-10 14:38:19 -08:00
parent c131facf4e
commit ae23a0c991
16 changed files with 32 additions and 54 deletions

View File

@@ -103,7 +103,7 @@ Class Procs:
var/simulated_turf_count = 0
for(var/turf/simulated/S in turfs)
for(var/turf/simulated/S in world)
simulated_turf_count++
if(!(simulated_turf_count % 50000))
sleep(world.tick_lag)

View File

@@ -13,7 +13,6 @@ var/global/list/living_mob_list = list() //List of all alive mobs, including c
var/global/list/dead_mob_list = list() //List of all dead mobs, including clientless. Excludes /mob/new_player
var/list/observers = new/list()
var/global/list/areas = list()
var/global/list/turfs = list()
var/global/list/chemical_reactions_list //list of all /datum/chemical_reaction datums. Used during chemical reactions
var/global/list/chemical_reagents_list //list of all /datum/reagent datums indexed by reagent id. Used by chemistry stuff
@@ -66,4 +65,4 @@ var/global/list/sec_hud_users = list() //list of all entities using a security H
to_chat(world, .)
*/
var/global/list/escape_list = list()
var/global/list/escape_list = list()

File diff suppressed because one or more lines are too long

View File

@@ -71,7 +71,7 @@ Message ends."}
proc/count()
for(var/turf/T in turfs)
for(var/turf/T in world)
if(T.z != map.zMainStation)
continue

View File

@@ -100,7 +100,7 @@ In short:
/datum/universal_state/hell/OverlayAndAmbientSet()
set waitfor = FALSE
for(var/turf/T in turfs)
for(var/turf/T in world)
if(istype(T, /turf/space))
T.overlays += image(icon = T.icon, icon_state = "hell01")
else

View File

@@ -139,7 +139,7 @@
/datum/universal_state/supermatter_cascade/OverlayAndAmbientSet()
set waitfor = FALSE
convert_all_parallax()
for(var/turf/T in turfs)
for(var/turf/T in world)
if(istype(T, /turf/space))
T.overlays += image(icon = T.icon, icon_state = "end01")
else

View File

@@ -23,7 +23,7 @@
to_chat(world, "<span class='sinister' style='font-size:22pt'>You feel a sudden chill in the air...</span>")
// Yes, this will lag. No, there's nothing I can do about it.
for(var/turf/T in turfs)
for(var/turf/T in world)
OnTurfChange(T)
/client/proc/smissmas()
@@ -34,4 +34,4 @@
var/confirm = alert(src, "Are you sure? This will tamper with the universal state of all things!", "Confirm", "Yes", "No")
if(confirm != "Yes")
return
SetUniversalState(/datum/universal_state/christmas)
SetUniversalState(/datum/universal_state/christmas)

View File

@@ -1,7 +1,7 @@
/proc/wormhole_event()
spawn()
var/list/pick_turfs = list()
for(var/turf/simulated/floor/T in turfs)
for(var/turf/simulated/floor/T in world)
if(T.z == map.zMainStation)
pick_turfs += T

View File

@@ -2932,7 +2932,7 @@
message_admins("[key_name_admin(usr)] made the floor LAVA! It'll last [length] seconds and it will deal [damage] damage to everyone.", 1)
var/count = 0
var/list/lavaturfs = list()
for(var/turf/simulated/floor/F in turfs)
for(var/turf/simulated/floor/F in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)

View File

@@ -1495,7 +1495,7 @@ client/proc/delete_all_bomberman()
for(var/obj/structure/softwall/O in bombermangear)
qdel(O)
for(var/turf/unsimulated/wall/bomberman/T in turfs)
for(var/turf/unsimulated/wall/bomberman/T in world)
T.ChangeTurf(/turf/simulated/wall)

View File

@@ -302,7 +302,7 @@ var/intercom_range_display_status = 0
/obj/machinery/door
)
for(var/turf/T in turfs)
for(var/turf/T in world)
for(var/basetype in acceptable_types)
var/list/badtiles[0]
if(istype(T,basetype))

View File

@@ -170,7 +170,7 @@
else if(istype(O, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)
@@ -209,7 +209,7 @@
else if(istype(O, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)
@@ -237,7 +237,7 @@
else if(istype(O, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)
@@ -283,7 +283,7 @@
else if(istype(O, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)
@@ -318,7 +318,7 @@
else if(istype(O, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)
@@ -349,7 +349,7 @@
else if(istype(O, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)
@@ -368,7 +368,7 @@
else if(istype(O, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)
@@ -394,7 +394,7 @@
else if(istype(O.type, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)
@@ -413,7 +413,7 @@
else if(istype(O.type, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)
@@ -438,7 +438,7 @@
else if(istype(O, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)
@@ -458,7 +458,7 @@
else if(istype(O, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)
@@ -484,7 +484,7 @@
else if(istype(O, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000)) sleep(world.tick_lag)
if ( istype(A , O.type) )
@@ -502,7 +502,7 @@
else if(istype(O, /turf))
var/count = 0
for(var/turf/A in turfs)
for(var/turf/A in world)
count++
if(!(count % 50000)) sleep(world.tick_lag)
if (A.type == O.type)

View File

@@ -44,9 +44,6 @@ Example of the second method:
var/z = location ? location.z : world.maxz //z coordinate
for(var/turf/T in block(locate(1,1,z), locate(world.maxx, world.maxy, z)))
turfs.Add(T)
if(accessable_z_levels.len >= z)
zLevel = accessable_z_levels[z]

View File

@@ -15,12 +15,12 @@
dynamic_lighting = new_dynamic_lighting
if (new_dynamic_lighting)
for (var/turf/T in turfs)
for (var/turf/T in world)
if (T.dynamic_lighting)
T.lighting_build_overlay()
else
for (var/turf/T in turfs)
for (var/turf/T in world)
if (T.lighting_overlay)
T.lighting_clear_overlay()

View File

@@ -141,13 +141,8 @@ var/savefile/panicfile
send2mainirc("Server starting up on [config.server? "byond://[config.server]" : "byond://[world.address]:[world.port]"]")
send2maindiscord("**Server starting up** on `[config.server? "byond://[config.server]" : "byond://[world.address]:[world.port]"]`. Map is **[map.nameLong]**")
spawn(1)
turfs = new/list(maxx*maxy*maxz)
world.log << "DEBUG: TURFS LIST LENGTH [turfs.len]"
build_turfs_list()
spawn(9)
Master.Setup()
spawn(10)
Master.Setup()
for(var/plugin_type in typesof(/plugin))
var/plugin/P = new plugin_type()
@@ -502,12 +497,3 @@ proc/establish_old_db_connection()
return 1
#undef FAILED_DB_CONNECTION_CUTOFF
/world/proc/build_turfs_list()
var/count = 0
for(var/Z = 1 to world.maxz)
for(var/turf/T in block(locate(1,1,Z), locate(world.maxx, world.maxy, Z)))
if(!(count % 50000))
sleep(world.tick_lag)
count++
T.initialize()
turfs[count] = T

View File

@@ -202,7 +202,7 @@ proc/get_base_turf(var/z)
proc/change_base_turf(var/choice,var/new_base_path,var/update_old_base = 0)
if(update_old_base)
var/count = 0
for(var/turf/T in turfs)
for(var/turf/T in world)
count++
if(!(count % 50000))
sleep(world.tick_lag)