diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/lists.dm index c47011461e61..7ba181bb0757 100644 --- a/code/__HELPERS/lists.dm +++ b/code/__HELPERS/lists.dm @@ -683,12 +683,11 @@ #define UNSETEMPTY(L) if (L && !L.len) L = null #define LAZYREMOVE(L, I) if(L) { L -= I; if(!L.len) { L = null; } } #define LAZYADD(L, I) if(!L) { L = list(); } L += I; -#define LAZYADDOR(L, I) if(!L) { L = list(); } L |= I; +/// Adds I to L, initializing L if necessary, if I is not already in L +#define LAZYDISTINCTADD(L, I) if(!L) { L = list(); } L |= I; #define LAZYACCESS(L, I) (L ? (isnum(I) ? (I > 0 && I <= L.len ? L[I] : null) : L[I]) : null) #define LAZYLEN(L) length(L) // Despite how pointless this looks, it's still needed in order to convey that the list is specificially a 'Lazy' list. #define LAZYCLEARLIST(L) if(L) L.Cut() -/// Adds I to L, initializing L if necessary, if I is not already in L -#define LAZYDISTINCTADD(L, I) if(!L) { L = list(); } L |= I; // LAZYING PT 2: THE LAZENING #define LAZYREINITLIST(L) LAZYCLEARLIST(L); LAZYINITLIST(L); diff --git a/code/datums/looping_sounds/looping_sound.dm b/code/datums/looping_sounds/looping_sound.dm index dc6282440ac6..5c329ddccaeb 100644 --- a/code/datums/looping_sounds/looping_sound.dm +++ b/code/datums/looping_sounds/looping_sound.dm @@ -56,7 +56,7 @@ /datum/looping_sound/proc/start(atom/add_thing) GLOB.looping_sounds += src if(add_thing) - LAZYADDOR(output_atoms, add_thing) + LAZYDISTINCTADD(output_atoms, add_thing) if(!muted) return muted = FALSE diff --git a/code/game/objects/items/weapons/storage/storage_base.dm b/code/game/objects/items/weapons/storage/storage_base.dm index 3664566b0fbf..e6e459e20e71 100644 --- a/code/game/objects/items/weapons/storage/storage_base.dm +++ b/code/game/objects/items/weapons/storage/storage_base.dm @@ -205,7 +205,7 @@ user.client.screen += closer user.client.screen += contents user.s_active = src - LAZYADDOR(mobs_viewing, user) + LAZYDISTINCTADD(mobs_viewing, user) /** * Hides the current container interface from `user`.