Skip to content

Commit

Permalink
Merges LAZYDISTINCTADD and LAZYADDOR (ParadiseSS13#22138)
Browse files Browse the repository at this point in the history
* kills off LAZYDISTINCTADD

* Changes it to Distinct Add...
  • Loading branch information
Contrabang authored Aug 28, 2023
1 parent ab04ec8 commit e754819
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions code/__HELPERS/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion code/datums/looping_sounds/looping_sound.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/storage/storage_base.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit e754819

Please sign in to comment.