diff options
author | Tim Angus <tim@ngus.net> | 2005-12-10 03:18:22 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2005-12-10 03:18:22 +0000 |
commit | ef5d1d446e3c078b81882c2eda6525aee7ccfa1e (patch) | |
tree | 16c1e9460317f2ca507f8e1888216816d05f251c /src/game/g_session.c | |
parent | 3b447421efc76ba76fbdae62f893fc6916af5433 (diff) |
* Moved existing src directory out the way whilst I merge ioq3
Diffstat (limited to 'src/game/g_session.c')
-rw-r--r-- | src/game/g_session.c | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/src/game/g_session.c b/src/game/g_session.c deleted file mode 100644 index 1dcb8883..00000000 --- a/src/game/g_session.c +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (C) 1999-2000 Id Software, Inc. -// - -/* - * Portions Copyright (C) 2000-2001 Tim Angus - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the OSML - Open Source Modification License v1.0 as - * described in the file COPYING which is distributed with this source - * code. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - */ - -#include "g_local.h" - - -/* -======================================================================= - - SESSION DATA - -Session data is the only data that stays persistant across level loads -and tournament restarts. -======================================================================= -*/ - -/* -================ -G_WriteClientSessionData - -Called on game shutdown -================ -*/ -void G_WriteClientSessionData( gclient_t *client ) -{ - const char *s; - const char *var; - - s = va( "%i %i %i %i %i %i %i", - client->sess.sessionTeam, - client->sess.spectatorTime, - client->sess.spectatorState, - client->sess.spectatorClient, - client->sess.wins, - client->sess.losses, - client->sess.teamLeader - ); - - var = va( "session%i", client - level.clients ); - - trap_Cvar_Set( var, s ); -} - -/* -================ -G_ReadSessionData - -Called on a reconnect -================ -*/ -void G_ReadSessionData( gclient_t *client ) -{ - char s[ MAX_STRING_CHARS ]; - const char *var; - - // bk001205 - format - int teamLeader; - int spectatorState; - int sessionTeam; - - var = va( "session%i", client - level.clients ); - trap_Cvar_VariableStringBuffer( var, s, sizeof(s) ); - - sscanf( s, "%i %i %i %i %i %i %i", - &sessionTeam, - &client->sess.spectatorTime, - &spectatorState, - &client->sess.spectatorClient, - &client->sess.wins, - &client->sess.losses, - &teamLeader - ); - - // bk001205 - format issues - client->sess.sessionTeam = (team_t)sessionTeam; - client->sess.spectatorState = (spectatorState_t)spectatorState; - client->sess.teamLeader = (qboolean)teamLeader; -} - - -/* -================ -G_InitSessionData - -Called on a first-time connect -================ -*/ -void G_InitSessionData( gclient_t *client, char *userinfo ) -{ - clientSession_t *sess; - const char *value; - - sess = &client->sess; - - // initial team determination - value = Info_ValueForKey( userinfo, "team" ); - if( value[ 0 ] == 's' ) - { - // a willing spectator, not a waiting-in-line - sess->sessionTeam = TEAM_SPECTATOR; - } - else - { - if( g_maxGameClients.integer > 0 && - level.numNonSpectatorClients >= g_maxGameClients.integer ) - sess->sessionTeam = TEAM_SPECTATOR; - else - sess->sessionTeam = TEAM_FREE; - } - - sess->spectatorState = SPECTATOR_FREE; - sess->spectatorTime = level.time; - sess->spectatorClient = -1; - - G_WriteClientSessionData( client ); -} - - -/* -================== -G_WriteSessionData - -================== -*/ -void G_WriteSessionData( void ) -{ - int i; - - //TA: ? - trap_Cvar_Set( "session", va( "%i", 0 ) ); - - for( i = 0 ; i < level.maxclients ; i++ ) - { - if( level.clients[ i ].pers.connected == CON_CONNECTED ) - G_WriteClientSessionData( &level.clients[ i ] ); - } -} |