From ba7c0fab92ad8dd77d59552b69ea3ddd03c8dacb Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Wed, 2 Feb 2022 23:43:44 -0600 Subject: [PATCH] Fixes being able to vote for maps which are outside their configured population range (#64619) * fixes map voting? * this is worth checking as well * additional logging --- code/controllers/subsystem/mapping.dm | 7 +++++++ code/controllers/subsystem/vote.dm | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 6409b2aee7c..0a19cc60089 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -388,6 +388,13 @@ GLOBAL_LIST_EMPTY(the_station_areas) message_admins("Failed to set new map with next_map.json for [VM.map_name]! Using default as backup!") return + if (VM.config_min_users > 0 && GLOB.clients.len < VM.config_min_users) + message_admins("[VM.map_name] was chosen for the next map, despite there being less current players than its set minimum population range!") + log_game("[VM.map_name] was chosen for the next map, despite there being less current players than its set minimum population range!") + if (VM.config_max_users > 0 && GLOB.clients.len > VM.config_max_users) + message_admins("[VM.map_name] was chosen for the next map, despite there being more current players than its set maximum population range!") + log_game("[VM.map_name] was chosen for the next map, despite there being more current players than its set maximum population range!") + next_map_config = VM return TRUE diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index 250479d85d7..db748175540 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -183,6 +183,10 @@ SUBSYSTEM_DEF(vote) var/datum/map_config/VM = config.maplist[map] if(!VM.votable || (VM.map_name in SSpersistence.blocked_maps)) continue + if (VM.config_min_users > 0 && GLOB.clients.len < VM.config_min_users) + continue + if (VM.config_max_users > 0 && GLOB.clients.len > VM.config_max_users) + continue maps += VM.map_name shuffle_inplace(maps) for(var/valid_map in maps)