From 2e8e14bb1ffe2c452249cfe33d38176606830939 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Mon, 1 Jun 2015 08:05:27 -0700 Subject: [PATCH] Port -tg- shuffle helper proc -tg-'s shuffle proc can handle associative and unassociative lists, whereas ours could only handle unassociative. This caused the holiday controller to break. --- code/__HELPERS/lists.dm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/lists.dm index 07e37e1fa9c..a8e29885ec9 100644 --- a/code/__HELPERS/lists.dm +++ b/code/__HELPERS/lists.dm @@ -155,16 +155,15 @@ proc/listclearnulls(list/list) return output //Randomize: Return the list in a random order -/proc/shuffle(var/list/shufflelist) - if(!shufflelist) +/proc/shuffle(var/list/L) + if(!L) return - var/list/new_list = list() - var/list/old_list = shufflelist.Copy() - while(old_list.len) - var/item = pick(old_list) - new_list += item - old_list -= item - return new_list + L = L.Copy() + + for(var/i=1, i