Quake-III-Arena/code/game
Zack Middleton f7c3276fe8 Fix g_teamAutoJoin and g_teamForceBalance
There are various issues caused by not knowing the initial team for
the local client and bots when they connect. This is can be reproduced
by starting a team game from the main menu.

When g_teamAutoJoin is enabled, bots and local client join a random
team at connect and then execute their team command a few frames
later. This may result in the player being killed if they specify a
different team. In Team Arena's Harvester mode this causes harvester
skulls to be spawned at the beginning of the game.

When g_teamForceBalance is enabled, the local client and bots may not
be able to join their desired team. This may result in them being
spectators. If g_teamAutoJoin is also enabled they may be left on
the opposite (red/blue) team they were meant to join.

There is a hack for including bot's team in their player info string
(used by cgame for which team skin to use) before the bot joins
their desired team. Bots aren't guaranteed to join their desired team
(as may happen when both g_teamAutoJoin and g_teamForceBalance are
enabled) so clients may see them as being on the wrong team!

----

Add teampref userinfo option for team preference. If teampref is set
it will be used for attempting to join the team immediately at connect.

Bots now join team at connect using teampref userinfo. So remove
the hack for setting bot's team in player info string before the bot
joins the team.

To avoid the client sending teampref userinfo to all network servers,
the local client uses a g_localTeamPref cvar. The g_localTeamPref
cvar is cleared after it's used so it doesn't get used when starting
another server later. Another reason not to use a teampref userinfo
cvar is there isn't a reliable way to clear it in CGame/UI which are
likely loaded from baseq3 pk3.

Make it so g_teamAutoJoin doesn't affect clients who specify
teampref. If teampref is invalid, the client will join a random team
like g_teamAutoJoin.

Don't apply g_teamForceBalance to the local client or bots. Otherwise
they may be left as spectators when starting team game from menu.

The start server menus use team command and g_localTeamPref to set
the human player's team. This way it's compatible with vanilla Q3
game VMs and the new setting team at connect feature.
2017-06-22 21:56:20 -05:00
..
ai_chat.c Don't use uninitialized ps from BotAI_GetClientState 2017-06-07 19:02:20 -05:00
ai_chat.h * Added STATUS 2005-10-29 01:53:09 +00:00
ai_cmd.c Stop caching sv_maxclients in bot code 2017-06-07 19:00:28 -05:00
ai_cmd.h * Added STATUS 2005-10-29 01:53:09 +00:00
ai_dmnet.c Fix bot team order to kill last player it killed 2016-07-11 05:20:36 -05:00
ai_dmnet.h * Added STATUS 2005-10-29 01:53:09 +00:00
ai_dmq3.c Fix g_teamAutoJoin and g_teamForceBalance 2017-06-22 21:56:20 -05:00
ai_dmq3.h REFACTOR [a vs an] 2012-06-18 16:31:16 +00:00
ai_main.c Don't use uninitialized ps from BotAI_GetClientState 2017-06-07 19:02:20 -05:00
ai_main.h Fix bot's teamleader name field being too short 2014-12-04 16:50:28 -06:00
ai_team.c Don't use uninitialized ps from BotAI_GetClientState 2017-06-07 19:02:20 -05:00
ai_team.h * Added STATUS 2005-10-29 01:53:09 +00:00
ai_vcmd.c Fix more warnings 2014-09-01 13:03:06 +01:00
ai_vcmd.h * Added STATUS 2005-10-29 01:53:09 +00:00
bg_lib.c Avoid 'register' declarations 2016-11-01 16:37:38 +00:00
bg_lib.h - Merge http://svn.icculus.org/tremulous?view=rev&revision=2185, patch by Chris Schwarz 2011-06-15 15:31:37 +00:00
bg_local.h Code cleanup patch by devhc 2011-02-08 18:19:31 +00:00
bg_misc.c Fix a few warnings 2014-08-30 17:29:23 +01:00
bg_pmove.c Fix (unused) watertype checks in PM_WaterMove 2015-07-30 19:33:28 -05:00
bg_public.h REFACTOR [reletive -> relative] 2012-06-18 16:32:03 +00:00
bg_slidemove.c Fix Coverity warning that endVelocity is uninitialized 2017-06-07 19:51:32 -05:00
chars.h http://www.angryflower.com/aposter.html 2011-02-09 05:51:33 +00:00
g_active.c Patches by symlink. 2012-02-06 21:28:40 +00:00
g_arenas.c Bugzilla #4753 2010-10-25 06:39:11 +00:00
g_bot.c Fix g_teamAutoJoin and g_teamForceBalance 2017-06-22 21:56:20 -05:00
g_client.c Fix g_teamAutoJoin and g_teamForceBalance 2017-06-22 21:56:20 -05:00
g_cmds.c Fix g_teamAutoJoin and g_teamForceBalance 2017-06-22 21:56:20 -05:00
g_combat.c Fix some typos in comments 2016-07-26 14:43:41 +02:00
g_items.c Fix more warnings 2014-09-01 13:03:06 +01:00
g_local.h Fix g_teamAutoJoin and g_teamForceBalance 2017-06-22 21:56:20 -05:00
g_main.c Fix g_teamAutoJoin and g_teamForceBalance 2017-06-22 21:56:20 -05:00
g_mem.c add a missing '\n', remove some unwanted ones 2012-06-18 16:16:57 +00:00
g_misc.c Batch of bug fixes for gamecode. Patch compiled and log message written by Tobias Kuehnhammer (#5144) 2011-08-01 11:39:33 +00:00
g_missile.c Fix grenade rotation ends always the orientation (#5053), patch by Eugene C. 2011-06-24 13:15:03 +00:00
g_mover.c Fix a few warnings 2014-08-30 17:29:23 +01:00
g_public.h Refactoring patch by DevHC 2011-05-11 14:21:27 +00:00
g_rankings.c * Added STATUS 2005-10-29 01:53:09 +00:00
g_rankings.h * Added STATUS 2005-10-29 01:53:09 +00:00
g_session.c Fix g_teamAutoJoin and g_teamForceBalance 2017-06-22 21:56:20 -05:00
g_spawn.c REFACTOR 2012-06-18 16:27:00 +00:00
g_svcmds.c Don't start game entity loops at index 1 2017-06-07 20:32:57 -05:00
g_syscalls.asm rename trap_Printf() to trap_Print() in the game module, as that function has nothing to do with printf()-like formatting 2012-06-19 14:51:02 +00:00
g_syscalls.c Fix native trap_BotMutateGoalFuzzyLogic 2014-03-02 22:53:15 -06:00
g_target.c REFACTOR [reletive -> relative] 2012-06-18 16:32:03 +00:00
g_team.c Fix "brought in 1 skulls" Harvester message 2017-06-02 22:11:52 -05:00
g_team.h Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings 2011-07-29 12:27:00 +00:00
g_trigger.c Removed duplicate setting of contents for trigger_hurt. 2011-11-28 17:36:58 +00:00
g_utils.c Fix spawn/freed entity logic (specifically harvester skulls) 2017-06-02 22:11:52 -05:00
g_weapon.c Let's actually use MOD_CHAINGUN! From Ensiform. 2012-06-18 17:12:35 +00:00
inv.h * Added STATUS 2005-10-29 01:53:09 +00:00
match.h * Added STATUS 2005-10-29 01:53:09 +00:00
syn.h * Added STATUS 2005-10-29 01:53:09 +00:00