Destroy() cleanups in VOREStation code

* Remove remaining hard del()'s in our code.
* Replace deleted() and gcDestroyed with QDELETED macro.
* Fix some strange calls directly to Del() (capital D)
* Make Destroy() return qdel hints.
* Make a few of the Destroy()'s more comprehensive in cleaning up references.
* In edited Destroy() procs, converted to use qdel_null and qdel_null_list macros when possible for pretty code.
* Removed unused variable `sleevecard`
This commit is contained in:
Leshana
2017-06-10 22:44:03 -04:00
parent cd88f7ca7b
commit e644dbe18a
35 changed files with 83 additions and 84 deletions
+6 -11
View File
@@ -100,16 +100,11 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable
if(human)
human.nif = null
human = null
for(var/S in nifsofts)
if(S)
qdel(S)
if(nif_hud)
qdel(nif_hud)
if(comm)
qdel(comm)
nifsofts.Cut()
..()
qdel_null_list(nifsofts)
qdel_null(nif_hud)
qdel_null(comm)
nifsofts_life.Cut()
return ..()
//Being implanted in some mob
/obj/item/device/nif/proc/implant(var/mob/living/carbon/human/H)
@@ -541,7 +536,7 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable
if(nif)
nif.nif_hud = null
nif = null
..()
return ..()
/obj/item/clothing/glasses/hud/nif_hud/process_hud(M,var/thing)
//Faster checking with local var, and this is called often so I want fast.
+1 -1
View File
@@ -47,7 +47,7 @@
/obj/effect/nif_stat/Destroy()
nifsoft = null
..()
return ..()
/obj/effect/nif_stat/proc/atom_button_text()
name = nifsoft.stat_text()
+6 -6
View File
@@ -50,11 +50,10 @@
//Destructor cleans up the software and nif reference
/datum/nifsoft/Destroy()
if(nif)
uninstall(nif)
uninstall()
nif = null
qdel(stat_line)
stat_line = null
..()
qdel_null(stat_line)
return ..()
//Called when the software is installed in the NIF
/datum/nifsoft/proc/install()
@@ -67,7 +66,8 @@
if(nif)
. = nif.uninstall(src)
nif = null
qdel(src)
if(!QDESTROYING(src))
qdel(src)
//Called every life() tick on a mob on active implants
/datum/nifsoft/proc/life(var/mob/living/carbon/human/human)
@@ -126,7 +126,7 @@
/datum/nifsoft/package/Destroy()
software.Cut()
software = null
..()
return ..()
/////////////////
// A NIFSoft Disk
+2 -2
View File
@@ -12,8 +12,8 @@
arscreen = new(nif)
Destroy()
qdel(arscreen)
..()
qdel_null(arscreen)
return ..()
activate()
if((. = ..()))
@@ -25,11 +25,8 @@
load_settings()
Destroy()
for(var/brain in brainmobs)
var/mob/living/carbon/brain/caught_soul/CS = brain
qdel(CS)
brainmobs.Cut()
..()
qdel_null_list(brainmobs)
return ..()
install()
if((. = ..()))
@@ -249,10 +246,8 @@
soulcatcher = null
if(nif)
nif = null
if(mind && ckey)
src.ghostize()
container = null
..()
return ..()
/mob/living/carbon/brain/caught_soul/Life()
if(!mind)
+3 -2
View File
@@ -43,13 +43,14 @@
nif = newloc
nifsoft = soft
register_device(nif.human)
qdel(camera) //Not supported on internal one.
qdel_null(camera) //Not supported on internal one.
Destroy()
if(nif)
nif.comm = null
nif = null
..()
nifsoft = null
return ..()
//So that only the owner's chat is relayed to others.
/obj/item/device/communicator/commlink/hear_talk(mob/living/M, text, verb, datum/language/speaking)