From 30ca02afb597a23c9b9b00fec2612e16fedcbc5a Mon Sep 17 00:00:00 2001 From: Rohesie Date: Wed, 25 Mar 2020 06:34:35 -0300 Subject: [PATCH] movespeed_modification unlawful list modification fix (#50135) * copy * Spooky suggestion --- code/__HELPERS/_lists.dm | 1 + code/modules/movespeed/_movespeed_modifier.dm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index e90c3c15a2b..a448ca3d711 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -11,6 +11,7 @@ #define LAZYINITLIST(L) if (!L) L = list() #define UNSETEMPTY(L) if (L && !length(L)) L = null +#define LAZYCOPY(L) (L ? L.Copy() : list() ) #define LAZYREMOVE(L, I) if(L) { L -= I; if(!length(L)) { L = null; } } #define LAZYADD(L, I) if(!L) { L = list(); } L += I; #define LAZYOR(L, I) if(!L) { L = list(); } L |= I; diff --git a/code/modules/movespeed/_movespeed_modifier.dm b/code/modules/movespeed/_movespeed_modifier.dm index 75fa6a706a6..0976f4d0671 100644 --- a/code/modules/movespeed/_movespeed_modifier.dm +++ b/code/modules/movespeed/_movespeed_modifier.dm @@ -199,7 +199,7 @@ GLOBAL_LIST_EMPTY(movespeed_modification_cache) /// Get the move speed modifiers list of the mob /mob/proc/get_movespeed_modifiers() - . = movespeed_modification + . = LAZYCOPY(movespeed_modification) for(var/id in movespeed_mod_immunities) . -= id