From b235fceca69d22b10a34412fea3d41d144eee1c8 Mon Sep 17 00:00:00 2001 From: Tad Hardesty Date: Wed, 9 May 2018 08:30:29 -0700 Subject: [PATCH] Fix wallets appearing to still contain a removed ID (#37719) --- code/game/objects/items/storage/wallets.dm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/code/game/objects/items/storage/wallets.dm b/code/game/objects/items/storage/wallets.dm index 94d9759a68..ee001b7185 100644 --- a/code/game/objects/items/storage/wallets.dm +++ b/code/game/objects/items/storage/wallets.dm @@ -38,16 +38,20 @@ /obj/item/storage/wallet/Exited(atom/movable/AM) . = ..() - refreshID() + // The loc has not actually changed yet when this proc is called, so call + // refreshID and have it ignore the outgoing atom. + refreshID(AM) -/obj/item/storage/wallet/proc/refreshID() - if(!(front_id in src)) +/obj/item/storage/wallet/proc/refreshID(atom/movable/removed) + LAZYCLEARLIST(combined_access) + if(!(front_id in src) || front_id == removed) front_id = null for(var/obj/item/card/id/I in contents) - LAZYINITLIST(combined_access) - LAZYCLEARLIST(combined_access) + if(I == removed) + continue if(!front_id) front_id = I + LAZYINITLIST(combined_access) combined_access |= I.access update_icon()