Merge pull request #7554 from SamHPurp/more-qdel-nulls

Uses more QDEL_NULLs
This commit is contained in:
Fox McCloud
2017-06-19 21:14:39 -04:00
committed by GitHub
34 changed files with 70 additions and 137 deletions
+1 -3
View File
@@ -43,9 +43,7 @@
/mob/living/carbon/human/proc/remake_hud() //used for preference changes mid-round; can't change hud icons without remaking the hud.
if(hud_used)
qdel(hud_used)
hud_used = null
QDEL_NULL(hud_used)
create_mob_hud()
if(hud_used)
hud_used.show_hud(hud_used.hud_version)
+3 -7
View File
@@ -42,9 +42,7 @@
H.set_species(H.species.primitive_form)
if(H.hud_used)
qdel(H.hud_used)
H.hud_used = null
QDEL_NULL(H.hud_used)
if(H.client)
H.hud_used = new /datum/hud/monkey(H, ui_style2icon(H.client.prefs.UI_style), H.client.prefs.UI_style_color, H.client.prefs.UI_style_alpha)
@@ -89,13 +87,11 @@
H.real_name = H.dna.real_name
H.name = H.real_name
if(H.hud_used)
qdel(H.hud_used)
H.hud_used = null
QDEL_NULL(H.hud_used)
if(H.client)
H.hud_used = new /datum/hud/human(H, ui_style2icon(H.client.prefs.UI_style), H.client.prefs.UI_style_color, H.client.prefs.UI_style_alpha)
to_chat(H, "<B>You are now a [H.species.name].</B>")
return H
return H
+1 -3
View File
@@ -327,9 +327,7 @@ var/round_start_time = 0
//If its actually the end of the round, wait for it to end.
//Otherwise if its a verb it will continue on afterwards.
spawn(300)
if(cinematic)
qdel(cinematic) //end the cinematic
cinematic = null
QDEL_NULL(cinematic) //end the cinematic
if(temp_buckle)
qdel(temp_buckle) //release everybody
@@ -132,8 +132,7 @@
playsound(get_turf(src), 'sound/misc/exit_blood.ogg', 100, 1, -1)
flick("jauntup",animation)
qdel(holder)
holder = null
QDEL_NULL(holder)
if(iscarbon(src))
var/mob/living/carbon/C = src
@@ -171,4 +170,4 @@
return
/obj/effect/dummy/slaughter/singularity_act()
return
return
+2 -4
View File
@@ -338,8 +338,7 @@ You are weak to holy things and starlight. Don't go into space and avoid the Cha
vampire_mind.current.create_attack_log("<span class='danger'>De-vampired</span>")
if(vampire_mind.vampire)
vampire_mind.vampire.remove_vampire_powers()
qdel(vampire_mind.vampire)
vampire_mind.vampire = null
QDEL_NULL(vampire_mind.vampire)
if(issilicon(vampire_mind.current))
to_chat(vampire_mind.current, "<span class='userdanger'>You have been turned into a robot! You can feel your powers fading away...</span>")
else
@@ -455,6 +454,5 @@ You are weak to holy things and starlight. Don't go into space and avoid the Cha
return
static_inventory -= vampire_blood_display
qdel(vampire_blood_display)
vampire_blood_display = null
QDEL_NULL(vampire_blood_display)
show_hud(hud_version)
+1 -2
View File
@@ -78,8 +78,7 @@
if(initial(S.name) == initial(aspell.name))
spell_levels = aspell.spell_level
user.mind.spell_list.Remove(aspell)
qdel(S)
S = null
QDEL_NULL(S)
return cost * (spell_levels+1)
return -1
+2 -4
View File
@@ -198,9 +198,7 @@
if("op")
active2.fields["b_type"] = "O+"
if("del_r2")
if(active2)
qdel(active2)
active2 = null
QDEL_NULL(active2)
if(href_list["scan"])
if(scan)
@@ -565,4 +563,4 @@
#undef MED_DATA_MAINT
#undef MED_DATA_RECORD
#undef MED_DATA_V_DATA
#undef MED_DATA_MEDBOT
#undef MED_DATA_MEDBOT
+3 -6
View File
@@ -156,11 +156,8 @@
for(var/datum/data/record/R in data_core.medical)
if(R.fields["name"] == active1.fields["name"] && R.fields["id"] == active1.fields["id"])
qdel(R)
qdel(active1)
active1 = null
if(active2)
qdel(active2)
active2 = null
QDEL_NULL(active1)
QDEL_NULL(active2)
update_all_mob_security_hud()
screen = SEC_DATA_R_LIST
if("criminal")
@@ -556,4 +553,4 @@
#undef SEC_DATA_R_LIST
#undef SEC_DATA_MAINT
#undef SEC_DATA_RECORD
#undef SEC_DATA_RECORD
+2 -3
View File
@@ -111,8 +111,7 @@
for(var/datum/data/record/R in data_core.medical)
if(R.fields["name"] == active1.fields["name"] && R.fields["id"] == active1.fields["id"])
qdel(R)
qdel(active1)
active1 = null
QDEL_NULL(active1)
screen = SKILL_DATA_R_LIST
if("rank")
if(active1)
@@ -322,4 +321,4 @@
#undef SKILL_DATA_R_LIST
#undef SKILL_DATA_MAINT
#undef SKILL_DATA_RECORD
#undef SKILL_DATA_RECORD
+2 -5
View File
@@ -316,9 +316,7 @@
if(istype(W,/obj/item/device/pda))
var/obj/item/device/pda/P = W
if(P.id)
qdel(P.id)
P.id = null
QDEL_NULL(P.id)
qdel(P)
if(!preserve)
@@ -421,8 +419,7 @@
occupant.ghostize(0) // Players despawned too early may not re-enter the game
else
occupant.ghostize(1)
qdel(occupant)
occupant = null
QDEL_NULL(occupant)
name = initial(name)
+1 -2
View File
@@ -142,8 +142,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
/obj/machinery/hologram/holopad/proc/clear_holo()
// hologram.set_light(0)//Clear lighting. //handled by the lighting controller when its ower is deleted
qdel(hologram)//Get rid of hologram.
hologram = null
QDEL_NULL(hologram)//Get rid of hologram.
if(master.holo == src)
master.holo = null
master = null//Null the master, since no-one is using it now.
+1 -2
View File
@@ -172,8 +172,7 @@
H.item_color = wash_color
H.name = new_softcap_name
H.desc = new_desc
qdel(crayon)
crayon = null
QDEL_NULL(crayon)
if( locate(/mob,contents) )
+1 -2
View File
@@ -440,8 +440,7 @@ steam.start() -- spawns the effect
var/obj/chemholder
Destroy()
qdel(chemholder)
chemholder = null
QDEL_NULL(chemholder)
return ..()
New()
@@ -43,8 +43,7 @@
if(active_dummy)
eject_all()
playsound(get_turf(src), 'sound/effects/pop.ogg', 100, 1, -6)
qdel(active_dummy)
active_dummy = null
QDEL_NULL(active_dummy)
to_chat(usr, "<span class='notice'>You deactivate \the [src].</span>")
var/obj/effect/overlay/T = new/obj/effect/overlay(get_turf(src))
T.icon = 'icons/effects/effects.dmi'
@@ -37,8 +37,7 @@
R.hands.icon_state = "nomod"
R.icon_state = "robot"
R.module.remove_subsystems_and_actions(R)
qdel(R.module)
R.module = null
QDEL_NULL(R.module)
R.camera.network.Remove(list("Engineering", "Medical", "Mining Outpost"))
R.rename_character(R.real_name, R.get_default_name("Default"))
+1 -2
View File
@@ -1288,8 +1288,7 @@ obj/item/toy/cards/deck/syndicate/black
if(stored_minature)
to_chat(user, "<span class='danger'>\The [src] makes a violent grinding noise as it tears apart the miniature figure inside!</span>")
qdel(stored_minature)
stored_minature = null
QDEL_NULL(stored_minature)
playsound(user, 'sound/goonstation/effects/gib.ogg', 20, 1)
cooldown = world.time
+2 -4
View File
@@ -350,8 +350,7 @@
H.key = ghost.key
log_runtime(EXCEPTION("Ghost of name [ghost.name] is bound to [H.real_name], but lacks a client. Deleting ghost."), src)
qdel(ghost)
ghost = null
QDEL_NULL(ghost)
var/tplus = world.time - H.timeofdeath
var/tlimit = 1800 //past this much time the patient is unrecoverable (in deciseconds)
var/tloss = 600 //brain damage starts setting in on the patient after some time left rotting
@@ -500,8 +499,7 @@
H.key = ghost.key
log_runtime(EXCEPTION("Ghost of name [ghost.name] is bound to [H.real_name], but lacks a client. Deleting ghost."), H)
qdel(ghost)
ghost = null
QDEL_NULL(ghost)
var/tplus = world.time - H.timeofdeath
var/tlimit = 1800 //past this much time the patient is unrecoverable (in deciseconds)
var/tloss = 600 //brain damage starts setting in on the patient after some time left rotting
+1 -2
View File
@@ -241,8 +241,7 @@
/obj/item/weapon/wirecutters/attack(mob/living/carbon/C, mob/user)
if(istype(C) && C.handcuffed && istype(C.handcuffed, /obj/item/weapon/restraints/handcuffs/cable))
user.visible_message("<span class='notice'>[user] cuts [C]'s restraints with [src]!</span>")
qdel(C.handcuffed)
C.handcuffed = null
QDEL_NULL(C.handcuffed)
if(C.buckled && C.buckled.buckle_requires_restraints)
C.buckled.unbuckle_mob(C)
C.update_handcuffed()
+6 -12
View File
@@ -102,8 +102,7 @@
if(!( A.anchored ))
A.forceMove(src)
playsound(loc, open_sound, 50, 1)
qdel(connected)
connected = null
QDEL_NULL(connected)
else
playsound(loc, open_sound, 50, 1)
connected = new /obj/structure/m_tray( loc )
@@ -118,8 +117,7 @@
connected.icon_state = "morguet"
connected.dir = dir
else
qdel(connected)
connected = null
QDEL_NULL(connected)
add_fingerprint(user)
update()
return
@@ -155,8 +153,7 @@
A.forceMove(connected.loc)
connected.icon_state = "morguet"
else
qdel(connected)
connected = null
QDEL_NULL(connected)
return
/obj/structure/morgue/Destroy()
@@ -306,8 +303,7 @@
if(!( A.anchored ))
A.forceMove(src)
playsound(loc, open_sound, 50, 1)
qdel(connected)
connected = null
QDEL_NULL(connected)
else if(locked == 0)
playsound(loc, open_sound, 50, 1)
connected = new /obj/structure/c_tray( loc )
@@ -321,8 +317,7 @@
A.forceMove(connected.loc)
connected.icon_state = "cremat"
else
qdel(connected)
connected = null
QDEL_NULL(connected)
add_fingerprint(user)
update()
@@ -355,8 +350,7 @@
A.forceMove(connected.loc)
connected.icon_state = "cremat"
else
qdel(connected)
connected = null
QDEL_NULL(connected)
return
/obj/structure/crematorium/proc/cremate(mob/user as mob)
@@ -139,5 +139,4 @@
to_chat(user, "<span class='notice'>You deploy the roller bed.</span>")
var/obj/structure/stool/bed/roller/R = new /obj/structure/stool/bed/roller(user.loc)
R.add_fingerprint(user)
qdel(held)
held = null
QDEL_NULL(held)
+2 -4
View File
@@ -376,10 +376,8 @@
return 1
/datum/click_intercept/buildmode/proc/deselect_region()
qdel(cornerA)
cornerA = null
qdel(cornerB)
cornerB = null
QDEL_NULL(cornerA)
QDEL_NULL(cornerB)
/datum/click_intercept/buildmode/proc/Reset()//Reset temporary variables
deselect_region()
@@ -163,13 +163,8 @@
to_chat(user, "<span class='danger'>You cannot eject your currently stored AI. Purge it manually.</span>")
return 0
to_chat(user, "<span class='danger'>You purge the remaining scraps of data from your previous AI, freeing it for use.</span>")
if(integrated_ai)
integrated_ai.ghostize()
qdel(integrated_ai)
integrated_ai = null
if(ai_card)
qdel(ai_card)
ai_card = null
QDEL_NULL(integrated_ai)
QDEL_NULL(ai_card)
else if(user)
user.put_in_hands(ai_card)
else
@@ -286,9 +286,7 @@
drink_container.desc = "[recipe_to_use.description]"
flick("bottler_on", src)
spawn(45)
for(var/i = 1, i <= slots.len, i++)
qdel(slots[i])
slots[i] = null
QDEL_LIST_ASSOC_VAL(slots)
bottling = 0
drink_container.forceMove(loc)
updateUsrDialog()
@@ -406,4 +404,4 @@
else if(bottling)
icon_state = "bottler_on"
else
icon_state = "bottler_off"
icon_state = "bottler_off"
+2 -3
View File
@@ -296,8 +296,7 @@
var/datum/plant_gene/core/gene = disk.gene
gene.value = min(gene.value, max_extract_pot)
disk.update_name()
qdel(seed)
seed = null
QDEL_NULL(seed)
update_icon()
if("replace")
if(disk && disk.gene && istype(disk.gene, G.type) && istype(G, /datum/plant_gene/core))
@@ -421,4 +420,4 @@
/obj/item/weapon/storage/box/disks_plantgene/New()
..()
for(var/i in 1 to 7)
new /obj/item/weapon/disk/plantgene(src)
new /obj/item/weapon/disk/plantgene(src)
+6 -12
View File
@@ -373,8 +373,7 @@
var/oldPlantName
if(myseed) // In case there's nothing in the tray beforehand
oldPlantName = myseed.plantname
qdel(myseed)
myseed = null
QDEL_NULL(myseed)
else
oldPlantName = "empty tray"
switch(rand(1,18)) // randomly pick predominative weed
@@ -422,8 +421,7 @@
var/oldPlantName = myseed.plantname
if(myseed.mutatelist.len > 0)
var/mutantseed = pick(myseed.mutatelist)
qdel(myseed)
myseed = null
QDEL_NULL(myseed)
myseed = new mutantseed
else
return
@@ -444,9 +442,7 @@
/obj/machinery/hydroponics/proc/mutateweed() // If the weeds gets the mutagent instead. Mind you, this pretty much destroys the old plant
if( weedlevel > 5 )
if(myseed)
qdel(myseed)
myseed = null
QDEL_NULL(myseed)
var/newWeed = pick(/obj/item/seeds/liberty, /obj/item/seeds/angel, /obj/item/seeds/nettle/death, /obj/item/seeds/kudzu)
myseed = new newWeed
dead = 0
@@ -935,8 +931,7 @@
else if(dead)
dead = 0
to_chat(user, "<span class='notice'>You remove the dead plant from [src].</span>")
qdel(myseed)
myseed = null
QDEL_NULL(myseed)
update_icon()
plant_hud_set_status()
plant_hud_set_health()
@@ -953,8 +948,7 @@
else
to_chat(user, "<span class='notice'>You harvest [myseed.getYield()] items from the [myseed.plantname].</span>")
if(!myseed.get_gene(/datum/plant_gene/trait/repeated_harvest))
qdel(myseed)
myseed = null
QDEL_NULL(myseed)
dead = 0
plant_hud_set_status()
plant_hud_set_health()
@@ -1041,4 +1035,4 @@
else
..()
#undef HYDRO_CYCLES_PER_AGE
#undef HYDRO_CYCLES_PER_AGE
+1 -2
View File
@@ -178,8 +178,7 @@
M = new manual_type()
dat += "<tr><td><A href='?src=[UID()];manual=[manualcount]'>[M.title]</A></td></tr>"
manualcount++
qdel(M)
M = null
QDEL_NULL(M)
dat += "</table>"
dat += "<BR><A href='?src=[UID()];switchscreen=0'>(Return to main menu)</A><BR>"
+1 -2
View File
@@ -1040,8 +1040,7 @@
mark = 0
if(L.mob_size >= MOB_SIZE_LARGE)
L.underlays -= marked_image
qdel(marked_image)
marked_image = null
QDEL_NULL(marked_image)
var/backstab = check_target_facings(user, L)
var/def_check = L.getarmor(type = "bomb")
if(backstab == FACING_INIT_FACING_TARGET_TARGET_FACING_PERPENDICULAR || backstab == FACING_SAME_DIR)
@@ -1205,13 +1205,11 @@ var/list/robot_verbs_default = list(
canmove = 1
scrambledcodes = 1
//Disconnect it's camera so it's not so easily tracked.
if(src.camera)
qdel(src.camera)
src.camera = null
// I'm trying to get the Cyborg to not be listed in the camera list
// Instead of being listed as "deactivated". The downside is that I'm going
// to have to check if every camera is null or not before doing anything, to prevent runtime errors.
// I could change the network to null but I don't know what would happen, and it seems too hacky for me.
QDEL_NULL(src.camera)
// I'm trying to get the Cyborg to not be listed in the camera list
// Instead of being listed as "deactivated". The downside is that I'm going
// to have to check if every camera is null or not before doing anything, to prevent runtime errors.
// I could change the network to null but I don't know what would happen, and it seems too hacky for me.
/mob/living/silicon/robot/proc/ResetSecurityCodes()
set category = "Robot Commands"
@@ -167,9 +167,8 @@
mode = BOT_CLEANING
spawn(50)
if(mode == BOT_CLEANING)
qdel(target)
QDEL_NULL(target)
anchored = 0
target = null
mode = BOT_IDLE
icon_state = "cleanbot[on]"
@@ -222,4 +221,4 @@ text("<A href='?src=[UID()];power=1'>[on ? "On" : "Off"]</A>"))
if(istype(A,/obj/effect/decal/cleanable))
clean(A)
else
..()
..()
@@ -213,8 +213,7 @@
if("PRG_deletechannel")
. = 1
if(channel && ((channel.operator == src) || netadmin_mode))
qdel(channel)
channel = null
QDEL_NULL(channel)
if("PRG_setpassword")
. = 1
if(!channel || ((channel.operator != src) && !netadmin_mode))
@@ -228,4 +227,4 @@
if(newpassword == "nopassword")
channel.password = ""
else
channel.password = newpassword
channel.password = newpassword
@@ -31,12 +31,8 @@
/obj/machinery/lapvend/proc/reset_order()
state = 0
devtype = 0
if(fabricated_laptop)
qdel(fabricated_laptop)
fabricated_laptop = null
if(fabricated_tablet)
qdel(fabricated_tablet)
fabricated_tablet = null
QDEL_NULL(fabricated_laptop)
QDEL_NULL(fabricated_tablet)
dev_cpu = 1
dev_battery = 1
dev_disk = 1
@@ -303,4 +299,4 @@ obj/machinery/lapvend/attackby(obj/item/I, mob/user)
T.time = worldtime2text()
vendor_account.transaction_log.Add(T)
return 1
return 0
return 0
@@ -28,9 +28,8 @@
sleep(10)
to_chat(usr, "<span style='color: #0000ff;'>Disconnecting neural-net interface...</span> <span style='color: #32CD32'><b>Success</b>.</span>")
if(usr.hud_used)
qdel(usr.hud_used)
usr.hud_used = null
QDEL_NULL(usr.hud_used)
usr.create_mob_hud()
usr.regenerate_icons()
@@ -64,9 +63,8 @@
sleep(5)
to_chat(usr, "<span style='color: #0000ff;'>Suit secured, extending neural-net interface...</span>")
if(usr.hud_used)
qdel(usr.hud_used)
usr.hud_used = null
QDEL_NULL(usr.hud_used)
usr.hud_used = new /datum/hud/human(usr, 'icons/mob/screen_ninja.dmi', "#ffffff", 255)
if(usr.hud_used)
usr.hud_used.show_hud(usr.hud_used.hud_version)
@@ -91,4 +89,4 @@
to_chat(usr, "<span style='color: #0000ff;'><b>NOTICE: </b>Suit de-activation protocals aborted.</span>")
else
to_chat(usr, "<span style='color: #ff0000;'><b>FĆAL RrR</b>: ŧer nt recgnized, c-cntr-r䣧-ç äcked.")
return
return
+1 -2
View File
@@ -43,8 +43,7 @@
if(targloc == curloc)
if(target) //if the target is right on our location we go straight to bullet_act()
target.bullet_act(BB, BB.def_zone)
qdel(BB)
BB = null
QDEL_NULL(BB)
return 1
BB.preparePixelProjectile(target, targloc, user, params, spread)
+1 -2
View File
@@ -377,8 +377,7 @@
user.visible_message(user, "<span class='warning'>[user] is drilling through the [src]'s lock!</span>",
"<span class='notice'>You start drilling through the [src]'s lock!</span>")
if(do_after(user, 100 * W.toolspeed, target = src))
qdel(equipment_system.lock_system)
equipment_system.lock_system = null
QDEL_NULL(equipment_system.lock_system)
user.visible_message(user, "<span class='warning'>[user] has destroyed the [src]'s lock!</span>",
"<span class='notice'>You destroy the [src]'s lock!</span>")
else