Fix joining team when starting local team play server

AKA fix joining team in Team Arena single player. Though it also
affects starting Q3 skirmish in team dm or ctf modes.
This commit is contained in:
Zack Middleton 2017-06-02 21:07:25 -05:00
parent bd067540f5
commit 4506ebd5d7

View file

@ -592,8 +592,8 @@ void SetTeam( gentity_t *ent, char *s ) {
// execute the team change
//
// if the player was dead leave the body
if ( client->ps.stats[STAT_HEALTH] <= 0 ) {
// if the player was dead leave the body, but only if they're actually in game
if ( client->ps.stats[STAT_HEALTH] <= 0 && client->pers.connected == CON_CONNECTED ) {
CopyToBodyQue(ent);
}
@ -633,6 +633,11 @@ void SetTeam( gentity_t *ent, char *s ) {
// get and distribute relevent paramters
ClientUserinfoChanged( clientNum );
// client hasn't spawned yet, they sent an early team command
if ( client->pers.connected != CON_CONNECTED ) {
return;
}
ClientBegin( clientNum );
}
@ -1659,6 +1664,14 @@ void ClientCommand( int clientNum ) {
ent = g_entities + clientNum;
if (!ent->client || ent->client->pers.connected != CON_CONNECTED) {
if (ent->client && ent->client->pers.localClient) {
// Handle early team command sent by UI when starting a local
// team play game.
trap_Argv( 0, cmd, sizeof( cmd ) );
if (Q_stricmp (cmd, "team") == 0) {
Cmd_Team_f (ent);
}
}
return; // not fully in game yet
}