WIP: Display centreprints when can't join or switch teams, refactor & fix selectteam and join
A centreprint is displayed when there's no free slots, but there's no message at all when teams are locked and the player tries to join with +jump
or the join
command, or when they try to switch teams. There is a console message, but it's only printed when selectteam is called and doesn't actually say the teams are locked.
Similar situation for g_changeteam_banned
There's an issue where the player is able to switch to a team (without actually joining) using F5 menu_showteamselect
or F6 team_auto
when blocked from joining by g_maxplayers.
selectteam foo
switches a spectator to a team without joining even when not blocked by g_maxplayers.
In both cases a notification is printed in chat saying the player is joining, even though they're still spectating.
The code is hard to add to or fix without refactoring as the UI calls and the checks for what is allowed are intermixed and spread over several functions.