From 779958e2f5f157f883cbcd80a8d91889b84f060c Mon Sep 17 00:00:00 2001 From: Zephyr <12817816+ZephyrTFA@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:34:50 -0700 Subject: [PATCH] map votes are now simple, and tell you what the effective tallies were (#87218) :cl: qol: map votes are now winner take all instead of weighted. /:cl: --- code/controllers/subsystem/map_vote.dm | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/map_vote.dm b/code/controllers/subsystem/map_vote.dm index 7d0be38f920..44aa82172f3 100644 --- a/code/controllers/subsystem/map_vote.dm +++ b/code/controllers/subsystem/map_vote.dm @@ -79,15 +79,33 @@ SUBSYSTEM_DEF(map_vote) send_map_vote_notice("No valid maps.") return - var/winner = pick_weight(filter_cache_to_valid_maps()) + var/winner + var/winner_amount = 0 + for(var/map in valid_maps) + if(!winner_amount) + winner = map + winner_amount = map_vote_cache[map] + continue + if(map_vote_cache[map] <= winner_amount) + continue + winner = map + winner_amount = map_vote_cache[map] + + ASSERT(winner, "No winner found in map vote.") set_next_map(config.maplist[winner]) - send_map_vote_notice("Map Selected - [span_bold(next_map_config.map_name)]") + var/list/messages = list("Map Selected - [span_bold(next_map_config.map_name)]") + messages += "Tallies at the time of selection:" + messages += tally_printout // do not reset tallies if only one map is even possible if(length(valid_maps) > 1) map_vote_cache[winner] = CONFIG_GET(number/map_vote_minimum_tallies) write_cache() update_tally_printout() + else + messages += "Only one map was possible, tallies were not reset." + + send_map_vote_notice(arglist(messages)) /// Returns a list of all map options that are invalid for the current population. /datum/controller/subsystem/map_vote/proc/get_valid_map_vote_choices()