summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2008-01-06 18:34:29 +0000
committerAndrey Nazarov <skuller@skuller.net>2008-01-06 18:34:29 +0000
commit79d1509407240c0d549843009dba4b37b64c2a9b (patch)
tree1b36d35d3add67a082262f7355778dacc371a171
parent0746f5d59cbf076310feca52581833a7b45f9663 (diff)
Fixed invalid client ID being displayed by `status' command on GTV servers.
Fixed stupid Sys_Sleep bug on Unix systems. Draw `Loading anticheat...' string in connection screen. Added Sys_GetAntiCheatAPI stub into sys_unix.c for testing purposes.
-rw-r--r--source/cl_main.c2
-rw-r--r--source/mvd_game.c2
-rw-r--r--source/sv_init.c5
-rw-r--r--source/sv_local.h1
-rw-r--r--source/sv_main.c9
-rw-r--r--source/sv_mvd.c2
-rw-r--r--source/sv_user.c2
-rw-r--r--source/sys_unix.c12
-rw-r--r--source/ui_loading.c12
9 files changed, 31 insertions, 16 deletions
diff --git a/source/cl_main.c b/source/cl_main.c
index 65408d8..81d9d55 100644
--- a/source/cl_main.c
+++ b/source/cl_main.c
@@ -1307,6 +1307,7 @@ static void CL_ConnectionlessPacket( void ) {
MSG_FlushTo( &cls.netchan->message );
cls.netchan->Transmit( cls.netchan, 0, NULL );
S_StopAllSounds();
+ cls.connectCount = -1;
Com_Printf( "Loading anticheat, this may take a few moments...\n" );
SCR_UpdateScreen();
if( !Sys_GetAntiCheatAPI() ) {
@@ -1325,6 +1326,7 @@ static void CL_ConnectionlessPacket( void ) {
CL_ClientCommand( "new" );
cls.state = ca_connected;
cls.messageString[0] = 0;
+ cls.connectCount = 0;
return;
}
diff --git a/source/mvd_game.c b/source/mvd_game.c
index 2a6bff1..76fac6d 100644
--- a/source/mvd_game.c
+++ b/source/mvd_game.c
@@ -425,7 +425,7 @@ void MVD_SwitchChannel( udpClient_t *client, mvd_t *mvd ) {
cl->gamedir = mvd->gamedir;
cl->mapname = mvd->configstrings[CS_NAME];
cl->configstrings = ( char * )mvd->configstrings;
- cl->number = mvd->clientNum;
+ cl->slot = mvd->clientNum;
cl->cm = &mvd->cm;
cl->pool = &mvd->pool;
diff --git a/source/sv_init.c b/source/sv_init.c
index 803322d..97fde6b 100644
--- a/source/sv_init.c
+++ b/source/sv_init.c
@@ -272,6 +272,11 @@ void SV_InitGame( qboolean ismvd ){
SV_InitGameProgs();
}
+ // init rate limits
+ SV_RateInit( &svs.ratelimit_status, sv_status_limit->integer, 1000 );
+ SV_RateInit( &svs.ratelimit_badpass, 1, sv_badauth_time->value * 1000 );
+ SV_RateInit( &svs.ratelimit_badrcon, 1, sv_badauth_time->value * 1000 );
+
List_Init( &svs.udp_client_list );
List_Init( &svs.mvd.clients );
List_Init( &svs.tcp_client_list );
diff --git a/source/sv_local.h b/source/sv_local.h
index 339405b..ad20b3d 100644
--- a/source/sv_local.h
+++ b/source/sv_local.h
@@ -216,6 +216,7 @@ typedef struct client_s {
char *gamedir, *mapname;
edict_pool_t *pool;
cm_t *cm;
+ int slot;
// netchan type dependent methods
void (*AddMessage)( struct client_s *, byte *, int, qboolean );
diff --git a/source/sv_main.c b/source/sv_main.c
index 3488a48..6a4b69c 100644
--- a/source/sv_main.c
+++ b/source/sv_main.c
@@ -777,7 +777,7 @@ static void SVC_DirectConnect( void ) {
// this is the only place a client_t is ever initialized
memset( newcl, 0, sizeof( *newcl ) );
number = newcl - svs.udp_client_pool;
- newcl->number = number;
+ newcl->number = newcl->slot = number;
newcl->challenge = challenge; // save challenge for checksumming
newcl->protocol = protocol;
newcl->version = version;
@@ -939,8 +939,7 @@ static void SVC_RemoteCommand( void ) {
Com_Printf( "Rcon from %s:\n%s\n",
NET_AdrToString( &net_from ), string );
- Com_BeginRedirect( RD_PACKET, sv_outputbuf, SV_OUTPUTBUF_LENGTH,
- SV_FlushRedirect );
+ SV_BeginRedirect( RD_PACKET );
Cmd_ExecuteString( string );
@@ -1728,10 +1727,6 @@ void SV_Init( void ) {
sv_badauth_time = Cvar_Get( "sv_badauth_time", "1", 0 );
sv_badauth_time->changed = sv_badauth_time_changed;
- SV_RateInit( &svs.ratelimit_status, sv_status_limit->integer, 1000 );
- SV_RateInit( &svs.ratelimit_badpass, 1, sv_badauth_time->value * 1000 );
- SV_RateInit( &svs.ratelimit_badrcon, 1, sv_badauth_time->value * 1000 );
-
//
// set up default pmove parameters
//
diff --git a/source/sv_mvd.c b/source/sv_mvd.c
index df43b12..2cc6983 100644
--- a/source/sv_mvd.c
+++ b/source/sv_mvd.c
@@ -373,7 +373,7 @@ qboolean SV_MvdCreateDummy( void ) {
memset( newcl, 0, sizeof( *newcl ) );
number = newcl - svs.udp_client_pool;
- newcl->number = number;
+ newcl->number = newcl->slot = number;
newcl->protocol = -1;
newcl->state = cs_connected;
newcl->AddMessage = SV_DummyAddMessage;
diff --git a/source/sv_user.c b/source/sv_user.c
index ebd5acb..8761ebf 100644
--- a/source/sv_user.c
+++ b/source/sv_user.c
@@ -364,7 +364,7 @@ void SV_New_f( void ) {
MSG_WriteLong( sv.spawncount );
MSG_WriteByte( 0 ); // no attract loop
MSG_WriteString( sv_client->gamedir );
- MSG_WriteShort( sv_client->number );
+ MSG_WriteShort( sv_client->slot );
MSG_WriteString( sv_client->mapname );
// send protocol specific stuff
diff --git a/source/sys_unix.c b/source/sys_unix.c
index 19ee92c..7836c7e 100644
--- a/source/sys_unix.c
+++ b/source/sys_unix.c
@@ -674,7 +674,10 @@ void Sys_AddDefaultConfig( void ) {
}
void Sys_Sleep( int msec ) {
- struct timespec req = { 0, msec * 1000000 };
+ struct timespec req;
+
+ req.tv_sec = msec / 1000; msec %= 1000;
+ req.tv_nsec = msec * 1000000;
nanosleep( &req, NULL );
}
@@ -682,6 +685,13 @@ void Sys_Setenv( const char *name, const char *value ) {
setenv( name, value, 1 );
}
+#if USE_ANTICHEAT & 1
+qboolean Sys_GetAntiCheatAPI( void ) {
+ Sys_Sleep( 1500 );
+ return qfalse;
+}
+#endif
+
/*
================
Sys_FillAPI
diff --git a/source/ui_loading.c b/source/ui_loading.c
index 1429c69..8b27c9d 100644
--- a/source/ui_loading.c
+++ b/source/ui_loading.c
@@ -28,14 +28,13 @@ CONNECTION / LOADING SCREEN
=============================================================================
*/
-static clientStatus_t loadingStatus;
-
/*
==============
UI_DrawLoading
==============
*/
void UI_DrawLoading( int realtime ) {
+ clientStatus_t loadingStatus;
char buffer[MAX_STRING_CHARS];
char *s;
int x, y;
@@ -81,12 +80,15 @@ void UI_DrawLoading( int realtime ) {
s = buffer;
break;
case ca_connecting:
- Com_sprintf( buffer, sizeof( buffer ), "Connecting... %i", loadingStatus.connectCount );
- s = buffer;
+ if( loadingStatus.connectCount == -1 ) {
+ s = "Loading anticheat...";
+ } else {
+ Com_sprintf( buffer, sizeof( buffer ), "Connecting... %i", loadingStatus.connectCount );
+ s = buffer;
+ }
break;
case ca_connected:
s = "Receiving server data...";
- UI_DrawString( x, y, NULL, UI_CENTER|UI_DROPSHADOW, s );
break;
case ca_loading:
Com_sprintf( buffer, sizeof( buffer ), "Loading... %s", loadingStatus.loadingString );