summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2006-05-06 17:18:02 +0000
committerTim Angus <tim@ngus.net>2006-05-06 17:18:02 +0000
commitbb7bd83aaec4504b4fb90919cccaaf4d9a7b418d (patch)
treea99058fef0dbf93af48dab4581b9f785d93e68ff /src/server
parentbd9d761dd958aef00218de084bae00eb9bf788a4 (diff)
* Merged ioq3-r775
- SDL_GammaRamp stuff - Anisotropic texture filtering - q3testesque r_flares - cl_guid - Security fixes
Diffstat (limited to 'src/server')
-rw-r--r--src/server/sv_ccmds.c31
-rw-r--r--src/server/sv_client.c4
-rw-r--r--src/server/sv_init.c2
-rw-r--r--src/server/sv_main.c2
4 files changed, 28 insertions, 11 deletions
diff --git a/src/server/sv_ccmds.c b/src/server/sv_ccmds.c
index 55ee62fd..0e016056 100644
--- a/src/server/sv_ccmds.c
+++ b/src/server/sv_ccmds.c
@@ -35,12 +35,12 @@ These commands can only be entered from stdin or by a remote operator datagram
/*
==================
-SV_GetPlayerByName
+SV_GetPlayerByHandle
-Returns the player with name from Cmd_Argv(1)
+Returns the player with player id or name from Cmd_Argv(1)
==================
*/
-static client_t *SV_GetPlayerByName( void ) {
+static client_t *SV_GetPlayerByHandle( void ) {
client_t *cl;
int i;
char *s;
@@ -58,6 +58,23 @@ static client_t *SV_GetPlayerByName( void ) {
s = Cmd_Argv(1);
+ // Check whether this is a numeric player handle
+ for(i = 0; s[i] >= '0' && s[i] <= '9'; i++);
+
+ if(!s[i])
+ {
+ int plid = atoi(s);
+
+ // Check for numeric playerid match
+ if(plid >= 0 && plid < sv_maxclients->integer)
+ {
+ cl = &svs.clients[plid];
+
+ if(cl->state)
+ return cl;
+ }
+ }
+
// check for a name match
for ( i=0, cl=svs.clients ; i < sv_maxclients->integer ; i++,cl++ ) {
if ( !cl->state ) {
@@ -218,7 +235,7 @@ static void SV_MapRestart_f( void ) {
delay = 5;
}
if( delay && !Cvar_VariableValue("g_doWarmup") ) {
- sv.restartTime = svs.time + delay * 1000;
+ sv.restartTime = sv.time + delay * 1000;
SV_SetConfigstring( CS_WARMUP, va("%i", sv.restartTime) );
return;
}
@@ -355,7 +372,7 @@ static void SV_Kick_f( void ) {
return;
}
- cl = SV_GetPlayerByName();
+ cl = SV_GetPlayerByHandle();
if ( !cl ) {
return;
}
@@ -390,7 +407,7 @@ static void SV_Ban_f( void ) {
return;
}
- cl = SV_GetPlayerByName();
+ cl = SV_GetPlayerByHandle();
if (!cl) {
return;
@@ -675,7 +692,7 @@ static void SV_DumpUser_f( void ) {
return;
}
- cl = SV_GetPlayerByName();
+ cl = SV_GetPlayerByHandle();
if ( !cl ) {
return;
}
diff --git a/src/server/sv_client.c b/src/server/sv_client.c
index 92a91bb7..fe7cc905 100644
--- a/src/server/sv_client.c
+++ b/src/server/sv_client.c
@@ -340,7 +340,7 @@ void SV_DropClient( client_t *drop, const char *reason ) {
return; // already dropped
}
- if ( !drop->gentity || !(drop->gentity->r.svFlags & SVF_BOT) ) {
+ if (drop->netchan.remoteAddress.type != NA_BOT) {
// see if we already have a challenge for this ip
challenge = &svs.challenges[0];
@@ -630,7 +630,7 @@ void SV_WriteDownloadToClient( client_t *cl , msg_t *msg )
Com_Printf( "clientDownload: %d : begining \"%s\"\n", cl - svs.clients, cl->downloadName );
missionPack = FS_idPak(cl->downloadName, "missionpack");
- idPack = missionPack || FS_idPak(cl->downloadName, "baseq3");
+ idPack = missionPack || FS_idPak(cl->downloadName, BASEGAME);
if ( !sv_allowDownload->integer || idPack ||
( cl->downloadSize = FS_SV_FOpenFileRead( cl->downloadName, &cl->download ) ) <= 0 ) {
diff --git a/src/server/sv_init.c b/src/server/sv_init.c
index d0a6a3c0..76cb8297 100644
--- a/src/server/sv_init.c
+++ b/src/server/sv_init.c
@@ -634,7 +634,7 @@ void SV_FinalMessage( char *message ) {
if (cl->state >= CS_CONNECTED) {
// don't send a disconnect to a local client
if ( cl->netchan.remoteAddress.type != NA_LOOPBACK ) {
- SV_SendServerCommand( cl, "print \"%s\"\n", message );
+ SV_SendServerCommand( cl, "print \"%s\n\"\n", message );
SV_SendServerCommand( cl, "disconnect" );
}
// force a snapshot to be sent
diff --git a/src/server/sv_main.c b/src/server/sv_main.c
index b40d173f..2e3135b6 100644
--- a/src/server/sv_main.c
+++ b/src/server/sv_main.c
@@ -834,7 +834,7 @@ void SV_Frame( int msec ) {
return;
}
- if( sv.restartTime && svs.time >= sv.restartTime ) {
+ if( sv.restartTime && sv.time >= sv.restartTime ) {
sv.restartTime = 0;
Cbuf_AddText( "map_restart 0\n" );
return;