From a3576ca586e211046352a78a57f05b1fc76cfa0c Mon Sep 17 00:00:00 2001 From: datlo Date: Mon, 18 May 2020 10:39:18 +0200 Subject: [PATCH] fix action buttons not being removed on refunds --- code/game/gamemodes/wizard/spellbook.dm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/game/gamemodes/wizard/spellbook.dm b/code/game/gamemodes/wizard/spellbook.dm index 2c2bca9b0ea..a7eb5d135e9 100644 --- a/code/game/gamemodes/wizard/spellbook.dm +++ b/code/game/gamemodes/wizard/spellbook.dm @@ -62,27 +62,29 @@ /datum/spellbook_entry/proc/CanRefund(mob/living/carbon/human/user, obj/item/spellbook/book) if(!refundable) - return 0 + return FALSE if(!S) S = new spell_type() for(var/obj/effect/proc_holder/spell/aspell in user.mind.spell_list) if(initial(S.name) == initial(aspell.name)) - return 1 - return 0 + return TRUE + return FALSE /datum/spellbook_entry/proc/Refund(mob/living/carbon/human/user, obj/item/spellbook/book) //return point value or -1 for failure var/area/wizard_station/A = locate() if(!(user in A.contents)) to_chat(user, "You can only refund spells at the wizard lair.") return -1 - if(!S) + if(!S) //This happens when the spell's source is from another spellbook, from loadouts, or adminery, this create a new template temporary spell S = new spell_type() var/spell_levels = 0 for(var/obj/effect/proc_holder/spell/aspell in user.mind.spell_list) if(initial(S.name) == initial(aspell.name)) spell_levels = aspell.spell_level user.mind.spell_list.Remove(aspell) - QDEL_NULL(S) + qdel(aspell) + if(S) //If we created a temporary spell above, delete it now. + qdel(S) return cost * (spell_levels + 1) return -1