daddy compiler please stop hating me

This commit is contained in:
Putnam
2020-01-11 22:17:18 -08:00
parent 0c64ea1351
commit 5dc5ddaa76
+23 -12
View File
@@ -143,18 +143,18 @@ SUBSYSTEM_DEF(vote)
// https://en.wikipedia.org/wiki/Majority_judgment
var/list/scores_by_choice = list()
for(var/choice in choices)
scores_by_choice += choice
scores_by_choice[choice] = list()
scores_by_choice += "[choice]"
scores_by_choice["[choice]"] = list()
for(var/ckey in voted)
var/list/this_vote = voted[ckey]
var/list/pretty_vote = list()
for(var/choice in choices)
if(choice in this_vote && choice in scores_by_choice)
sorted_insert(scores_by_choice[choice],this_vote[choice],/proc/cmp_numeric_asc)
if("[choice]" in this_vote && "[choice]" in scores_by_choice)
sorted_insert(scores_by_choice["[choice]"],this_vote["[choice]"],/proc/cmp_numeric_asc)
// START BALLOT GATHERING
pretty_vote += choice
if(this_vote[choice] in GLOB.vote_score_options)
pretty_vote[choice] = GLOB.vote_score_options[this_vote[choice]]
pretty_vote += "[choice]"
if(this_vote["[choice]"] in GLOB.vote_score_options)
pretty_vote["[choice]"] = GLOB.vote_score_options[this_vote["[choice]"]]
SSblackbox.record_feedback("associative","voting_ballots",1,pretty_vote)
// END BALLOT GATHERING
for(var/score_name in scores_by_choice)
@@ -190,13 +190,13 @@ SUBSYSTEM_DEF(vote)
/datum/controller/subsystem/vote/proc/calculate_scores(var/blackbox_text)
var/list/scores_by_choice = list()
for(var/choice in choices)
scores_by_choice += choice
scores_by_choice[choice] = list()
scores_by_choice += "[choice]"
scores_by_choice["[choice]"] = list()
for(var/ckey in voted)
var/list/this_vote = voted[ckey]
for(var/choice in choices)
if(choice in this_vote && choice in scores_by_choice)
sorted_insert(scores_by_choice[choice],this_vote[choice],/proc/cmp_numeric_asc)
if("[choice]" in this_vote && "[choice]" in scores_by_choice)
sorted_insert(scores_by_choice["[choice]"],this_vote["[choice]"],/proc/cmp_numeric_asc)
var/middle_score = round(GLOB.vote_score_options.len/2,1)
for(var/score_name in scores_by_choice)
var/list/score = scores_by_choice[score_name]
@@ -654,9 +654,20 @@ SUBSYSTEM_DEF(vote)
SSpersistence.saved_votes[usr.ckey][mode] = list()
voted[usr.ckey] = SSpersistence.saved_votes[usr.ckey][mode]
if(islist(voted[usr.ckey]))
saved += usr.ckey
var/malformed = FALSE
if(vote_system == SCORE_VOTING)
for(var/thing in voted[usr.ckey])
if(!(thing in choices))
malformed = TRUE
if(!malformed)
saved += usr.ckey
else
to_chat(usr,"Your saved vote was malformed! Start over!")
SSpersistence.saved_votes[usr.ckey] -= mode
voted -= usr.ckey
else
to_chat(usr,"Your saved vote was malformed! Start over!")
voted -= usr.ckey
else
if(vote_system == SCORE_VOTING)
submit_vote(round(text2num(href_list["vote"])),round(text2num(href_list["score"])))