Fix player queueing for tournament play (#4939)
This commit is contained in:
parent
806a849bf2
commit
31ec563999
4 changed files with 38 additions and 11 deletions
|
@ -602,9 +602,8 @@ void AddTournamentPlayer( void ) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( !nextInLine || client->sess.spectatorTime < nextInLine->sess.spectatorTime ) {
|
||||
if(!nextInLine || client->sess.spectatorNum > nextInLine->sess.spectatorNum)
|
||||
nextInLine = client;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !nextInLine ) {
|
||||
|
@ -617,6 +616,33 @@ void AddTournamentPlayer( void ) {
|
|||
SetTeam( &g_entities[ nextInLine - level.clients ], "f" );
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
RequeueTournamentLoser
|
||||
|
||||
Add client to end of tournament queue
|
||||
=======================
|
||||
*/
|
||||
|
||||
void AddTournamentQueue(gclient_t *client)
|
||||
{
|
||||
int index;
|
||||
gclient_t *curclient;
|
||||
|
||||
for(index = 0; index < level.maxclients; index++)
|
||||
{
|
||||
curclient = &level.clients[index];
|
||||
|
||||
if(curclient->pers.connected != CON_DISCONNECTED)
|
||||
{
|
||||
if(curclient == client)
|
||||
curclient->sess.spectatorNum = 0;
|
||||
else if(curclient->sess.sessionTeam == TEAM_SPECTATOR)
|
||||
curclient->sess.spectatorNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
RemoveTournamentLoser
|
||||
|
@ -716,10 +742,10 @@ int QDECL SortRanks( const void *a, const void *b ) {
|
|||
|
||||
// then spectators
|
||||
if ( ca->sess.sessionTeam == TEAM_SPECTATOR && cb->sess.sessionTeam == TEAM_SPECTATOR ) {
|
||||
if ( ca->sess.spectatorTime < cb->sess.spectatorTime ) {
|
||||
if ( ca->sess.spectatorNum > cb->sess.spectatorNum ) {
|
||||
return -1;
|
||||
}
|
||||
if ( ca->sess.spectatorTime > cb->sess.spectatorTime ) {
|
||||
if ( ca->sess.spectatorNum < cb->sess.spectatorNum ) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue