From 4eb101982fee3bc71ca1ba0eb8bf920fe8951aae Mon Sep 17 00:00:00 2001 From: WoolyAypa Date: Tue, 13 Dec 2022 18:25:48 -0300 Subject: [PATCH] not 'lazy' enough; safer now --- modular_splurt/code/__HELPERS/_lists.dm | 4 ++-- .../items/lewd_items/chastity_hypno/chastity_hypnosis.dm | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modular_splurt/code/__HELPERS/_lists.dm b/modular_splurt/code/__HELPERS/_lists.dm index dd09e5812d..6dffaa0f32 100644 --- a/modular_splurt/code/__HELPERS/_lists.dm +++ b/modular_splurt/code/__HELPERS/_lists.dm @@ -1,3 +1,3 @@ // Please tell me if there already is a macro for that -#define LAZYFIRST(L) L[1] -#define LAZYLAST(L) L[length(L)] +#define LISTFIRST(L) (length(L) ? L[1] : null) +#define LISTLAST(L) (length(L) ? L[length(L)] : null) diff --git a/modular_splurt/code/game/objects/items/lewd_items/chastity_hypno/chastity_hypnosis.dm b/modular_splurt/code/game/objects/items/lewd_items/chastity_hypno/chastity_hypnosis.dm index aeac93782d..5bb5938e6a 100644 --- a/modular_splurt/code/game/objects/items/lewd_items/chastity_hypno/chastity_hypnosis.dm +++ b/modular_splurt/code/game/objects/items/lewd_items/chastity_hypno/chastity_hypnosis.dm @@ -123,15 +123,15 @@ /obj/item/chastity_hypno/proc/change_mode(genital, direction) switch(direction) if("left") - if(choices[genital] == LAZYFIRST(available_modes)) + if(choices[genital] == LISTFIRST(available_modes)) //choices[genital] = available_modes[length(available_modes)] - choices[genital] = LAZYLAST(available_modes) + choices[genital] = LISTLAST(available_modes) else choices[genital] = available_modes[LAZYFIND(available_modes, choices[genital]) - 1] if("right") - if(choices[genital] == LAZYLAST(available_modes)) + if(choices[genital] == LISTLAST(available_modes)) //choices[genital] = available_modes[1] - choices[genital] = LAZYFIRST(available_modes) + choices[genital] = LISTFIRST(available_modes) else choices[genital] = available_modes[LAZYFIND(available_modes, choices[genital]) + 1]