From 2e8e14bb1ffe2c452249cfe33d38176606830939 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Mon, 1 Jun 2015 08:05:27 -0700 Subject: [PATCH 1/2] 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 Date: Mon, 1 Jun 2015 08:23:31 -0700 Subject: [PATCH 2/2] Fix incorrect uses of the shuffle proc. Even before the -tg- proc port, it didn't do inline modification of the list. --- code/game/gamemodes/wizard/raginmages.dm | 2 +- code/modules/admin/verbs/one_click_antag.dm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/gamemodes/wizard/raginmages.dm b/code/game/gamemodes/wizard/raginmages.dm index f726b1c2a22..39563a0cbae 100644 --- a/code/game/gamemodes/wizard/raginmages.dm +++ b/code/game/gamemodes/wizard/raginmages.dm @@ -94,7 +94,7 @@ making_mage = 0 return else - shuffle(candidates) + candidates = shuffle(candidates) for(var/mob/i in candidates) if(!i || !i.client) continue //Dont bother removing them from the list since we only grab one wizard diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm index 1cfd5174c17..f9940bec995 100644 --- a/code/modules/admin/verbs/one_click_antag.dm +++ b/code/modules/admin/verbs/one_click_antag.dm @@ -167,7 +167,7 @@ client/proc/one_click_antag() sleep(300) if(candidates.len) - shuffle(candidates) + candidates = shuffle(candidates) for(var/mob/i in candidates) if(!i || !i.client) continue //Dont bother removing them from the list since we only grab one wizard