|
|
@ -44,7 +44,8 @@ CHalfLifeTeamplay::CHalfLifeTeamplay() |
|
|
|
m_szTeamList[0] = 0; |
|
|
|
m_szTeamList[0] = 0; |
|
|
|
|
|
|
|
|
|
|
|
// Cache this because the team code doesn't want to deal with changing this in the middle of a game
|
|
|
|
// Cache this because the team code doesn't want to deal with changing this in the middle of a game
|
|
|
|
strncpy( m_szTeamList, teamlist.string, TEAMPLAY_TEAMLISTLENGTH ); |
|
|
|
strncpy( m_szTeamList, teamlist.string, TEAMPLAY_TEAMLISTLENGTH - 1 ); |
|
|
|
|
|
|
|
m_szTeamList[TEAMPLAY_TEAMLISTLENGTH - 1] = '\0'; |
|
|
|
|
|
|
|
|
|
|
|
edict_t *pWorld = INDEXENT( 0 ); |
|
|
|
edict_t *pWorld = INDEXENT( 0 ); |
|
|
|
if( pWorld && pWorld->v.team ) |
|
|
|
if( pWorld && pWorld->v.team ) |
|
|
@ -54,7 +55,8 @@ CHalfLifeTeamplay::CHalfLifeTeamplay() |
|
|
|
const char *pTeamList = STRING( pWorld->v.team ); |
|
|
|
const char *pTeamList = STRING( pWorld->v.team ); |
|
|
|
if( pTeamList && pTeamList[0] != '\0' ) |
|
|
|
if( pTeamList && pTeamList[0] != '\0' ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
strncpy( m_szTeamList, pTeamList, TEAMPLAY_TEAMLISTLENGTH ); |
|
|
|
strncpy( m_szTeamList, pTeamList, TEAMPLAY_TEAMLISTLENGTH - 1 ); |
|
|
|
|
|
|
|
m_szTeamList[TEAMPLAY_TEAMLISTLENGTH - 1] = '\0'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -183,7 +185,8 @@ const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// copy out the team name from the model
|
|
|
|
// copy out the team name from the model
|
|
|
|
char *mdls = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" ); |
|
|
|
char *mdls = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" ); |
|
|
|
strncpy( pPlayer->m_szTeamName, mdls, TEAM_NAME_LENGTH ); |
|
|
|
strncpy( pPlayer->m_szTeamName, mdls, TEAM_NAME_LENGTH - 1 ); |
|
|
|
|
|
|
|
pPlayer->m_szTeamName[TEAM_NAME_LENGTH - 1] = '\0'; |
|
|
|
|
|
|
|
|
|
|
|
RecountTeams(); |
|
|
|
RecountTeams(); |
|
|
|
|
|
|
|
|
|
|
@ -200,7 +203,8 @@ const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pTeamName = TeamWithFewestPlayers(); |
|
|
|
pTeamName = TeamWithFewestPlayers(); |
|
|
|
} |
|
|
|
} |
|
|
|
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH ); |
|
|
|
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH - 1 ); |
|
|
|
|
|
|
|
pPlayer->m_szTeamName[TEAM_NAME_LENGTH - 1] = '\0'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return pPlayer->m_szTeamName; |
|
|
|
return pPlayer->m_szTeamName; |
|
|
@ -287,8 +291,10 @@ void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTea |
|
|
|
|
|
|
|
|
|
|
|
// copy out the team name from the model
|
|
|
|
// copy out the team name from the model
|
|
|
|
if( pPlayer->m_szTeamName != pTeamName ) |
|
|
|
if( pPlayer->m_szTeamName != pTeamName ) |
|
|
|
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH ); |
|
|
|
{ |
|
|
|
|
|
|
|
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH - 1 ); |
|
|
|
|
|
|
|
pPlayer->m_szTeamName[TEAM_NAME_LENGTH - 1] = '\0'; |
|
|
|
|
|
|
|
} |
|
|
|
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName ); |
|
|
|
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName ); |
|
|
|
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName ); |
|
|
|
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName ); |
|
|
|
|
|
|
|
|
|
|
@ -603,7 +609,8 @@ void CHalfLifeTeamplay::RecountTeams( bool bResendInfo ) |
|
|
|
tm = num_teams; |
|
|
|
tm = num_teams; |
|
|
|
num_teams++; |
|
|
|
num_teams++; |
|
|
|
team_scores[tm] = 0; |
|
|
|
team_scores[tm] = 0; |
|
|
|
strncpy( team_names[tm], pTeamName, MAX_TEAMNAME_LENGTH ); |
|
|
|
strncpy( team_names[tm], pTeamName, MAX_TEAMNAME_LENGTH - 1 ); |
|
|
|
|
|
|
|
team_names[tm][MAX_TEAMNAME_LENGTH - 1] = '\0'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|