Closed Razer2015 closed 3 years ago
The way to do this would be to add a parse_map
function on MapPool
which handles the numbers etc, since it stores the maps in a vector a not a hash map. Though, maybe the better would be to convert MapPool to use a hash map internally, and instead store the map vote numbers in the Extra (generic param, currently ()).
Or just get rid of MapPool entirely and add traits for HashMap<MapInPool
Length consideration:
len("Vote with numbers or names:\n")
= 24len(tab-padded map name)
= 11len("{}\t {}", number, tab-padded map name)
= 3 + 11 = 14\t + (3 options) + \n
= 2 + 3 * 14 = 44So in total, for at most 6 options, you get an upper bound of 24 + 44 * 2 = 112 characters, which is less than 127 characters, so it'll work.
...And that's about as much as I have energy for, for the whole week, likely.
Add support for voting with numbers
!1 2 3
Also possibly add an option for voting with shorter map names? The shortest unambiguous name. For example:
!metro
!metr
!met
Configurable shortest character count to prevent conflicts with other plugins? Or perhaps an option to add reserved commands in blacklist?