From 22ecd68cf2c8f99d2f9f8e69d5474d19e7eb8f45 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 20 May 2012 21:22:11 +0000 Subject: [PATCH] In CheckTeamLeader, make sure to only set one client as team leader. Reported by Tobias Kuehnhammer. --- code/game/g_main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/code/game/g_main.c b/code/game/g_main.c index be150026..6c0ffad7 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -1644,11 +1644,14 @@ void CheckTeamLeader( int team ) { break; } } - for ( i = 0 ; i < level.maxclients ; i++ ) { - if (level.clients[i].sess.sessionTeam != team) - continue; - level.clients[i].sess.teamLeader = qtrue; - break; + + if (i >= level.maxclients) { + for ( i = 0 ; i < level.maxclients ; i++ ) { + if (level.clients[i].sess.sessionTeam != team) + continue; + level.clients[i].sess.teamLeader = qtrue; + break; + } } } }