Make Team Arena win logic handle more game types/blue team

The Team Arena menu uses red team for single player but q3_ui
(and mods could) use blue. Also handle all the game types, not
just the ones used by Team Arena. Fixes FFA and Team DM.
This commit is contained in:
Zack Middleton 2017-06-02 21:24:57 -05:00
parent 4506ebd5d7
commit 4227d97958

View file

@ -1145,6 +1145,7 @@ void LogExit( const char *string ) {
gclient_t *cl;
#ifdef MISSIONPACK
qboolean won = qtrue;
team_t team = TEAM_RED;
#endif
G_LogPrintf( "Exit: %s\n", string );
@ -1181,7 +1182,10 @@ void LogExit( const char *string ) {
G_LogPrintf( "score: %i ping: %i client: %i %s\n", cl->ps.persistant[PERS_SCORE], ping, level.sortedClients[i], cl->pers.netname );
#ifdef MISSIONPACK
if (g_singlePlayer.integer && g_gametype.integer == GT_TOURNAMENT) {
if (g_singlePlayer.integer && !(g_entities[cl - level.clients].r.svFlags & SVF_BOT)) {
team = cl->sess.sessionTeam;
}
if (g_singlePlayer.integer && g_gametype.integer < GT_TEAM) {
if (g_entities[cl - level.clients].r.svFlags & SVF_BOT && cl->ps.persistant[PERS_RANK] == 0) {
won = qfalse;
}
@ -1192,8 +1196,12 @@ void LogExit( const char *string ) {
#ifdef MISSIONPACK
if (g_singlePlayer.integer) {
if (g_gametype.integer >= GT_CTF) {
won = level.teamScores[TEAM_RED] > level.teamScores[TEAM_BLUE];
if (g_gametype.integer >= GT_TEAM) {
if (team == TEAM_BLUE) {
won = level.teamScores[TEAM_BLUE] > level.teamScores[TEAM_RED];
} else {
won = level.teamScores[TEAM_RED] > level.teamScores[TEAM_BLUE];
}
}
trap_SendConsoleCommand( EXEC_APPEND, (won) ? "spWin\n" : "spLose\n" );
}