Merge pull request #777 from ESwordTheCat/7b#vbri1

Micro optimization at GC, new var at machinery, qdel the singularity generator (forgot at refactor) and time check change at sun datum.
This commit is contained in:
Rob Nelson
2014-05-21 16:14:30 -07:00
6 changed files with 22 additions and 15 deletions

View File

@@ -34,6 +34,7 @@ var/global/list/uncollectable_vars=list(
"y",
"z",
)
/datum/controller/garbage_collector
var/list/queue=list()
var/list/destroyed=list()
@@ -82,19 +83,21 @@ var/global/list/uncollectable_vars=list(
destroyed.Add("\ref[A]")
queue.Remove(A)
proc/process()
for(var/i=0;i<min(waiting,GC_COLLECTIONS_PER_TICK);i++)
if(waiting)
Pop()
waiting--
for(var/i=0;i<min(destroyed.len,GC_COLLECTIONS_PER_TICK);i++)
if(destroyed.len)
var/refID=destroyed[1]
var/atom/A = locate(refID)
if(A && A.gc_destroyed && A.gc_destroyed >= world.time - GC_COLLECTION_TIMEOUT)
// Something's still referring to the qdel'd object. Kill it.
del(A)
destroyed.Remove(refID)
/datum/controller/garbage_collector/proc/process()
for (var/i = 0, ++i <= min(waiting, GC_COLLECTIONS_PER_TICK))
if (waiting--)
Pop()
for (var/i = 0, ++i <= min(destroyed.len, GC_COLLECTIONS_PER_TICK))
if (destroyed.len)
var/refID = destroyed[1]
var/atom/A = locate(refID)
if (A && A.gc_destroyed && A.gc_destroyed >= world.timeofday - GC_COLLECTION_TIMEOUT)
// Something's still referring to the qdel'd object. Kill it.
del A
destroyed.Remove(refID)
/**
* NEVER USE THIS FOR ANYTHING OTHER THAN /atom/movable

View File

@@ -311,6 +311,7 @@ datum/controller/game_controller/proc/processMobs()
#endif
if(PROCESS_KILL == Machinery.process())
Machinery.inMachineList = 0
Machinery.removeAtProcessing()
continue

View File

@@ -41,7 +41,7 @@
lastAngle = angle
if (!round(time / nextTime))
if (world.time < nextTime)
return
nextTime += updatePer

View File

@@ -84,7 +84,7 @@
// Like Del(), but for qdel.
// Called BEFORE qdel moves shit.
/atom/proc/Destroy()
gc_destroyed=world.time
gc_destroyed = world.timeofday
/atom/proc/assume_air(datum/gas_mixture/giver)
return null

View File

@@ -114,6 +114,8 @@ Class Procs:
var/panel_open = 0
var/area/myArea
var/inMachineList = 1 // For debugging.
/obj/machinery/New()
addAtProcessing()
return ..()

View File

@@ -28,6 +28,7 @@
log_admin("New singularity made, all touchers. [prints]. Last touched by [fingerprintslast].")
new /obj/machinery/singularity/(get_turf(src), 50)
qdel(src)
/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/weapon/wrench))