summaryrefslogtreecommitdiff
path: root/src/cgame/cg_servercmds.c
diff options
context:
space:
mode:
authorM. Kristall <mkpdev@gmail.com>2011-09-26 04:58:34 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:18:15 +0000
commit453405b5b1319523b5da0d2055f820cc9613a731 (patch)
tree2a4241ed3771659fa9ad5999f077ae245fb6c2e1 /src/cgame/cg_servercmds.c
parentdbf4212733c894a7e477b633ba528851feb6fa61 (diff)
* Fix some (most) commands not unregistering when disconnecting
Diffstat (limited to 'src/cgame/cg_servercmds.c')
-rw-r--r--src/cgame/cg_servercmds.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index 90254a2c..7d970e5b 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -1230,28 +1230,28 @@ static void CG_PoisonCloud_f( void )
}
}
-static char registeredCmds[ 8192 ]; // cmd1\0cmd2\0cmdn\0\0
+static char registeredCmds[ 8192 ]; // cmd1\0cmd2\0cmdn\0\0
+static size_t gcmdsOffset;
static void CG_GameCmds_f( void )
{
int i;
int c = trap_Argc( );
const char *cmd;
size_t len;
- size_t offset = strlen( registeredCmds );
for( i = 1; i < c; i++ )
{
cmd = CG_Argv( i );
len = strlen( cmd ) + 1;
- if( len + offset >= sizeof( registeredCmds ) - 1 )
+ if( len + gcmdsOffset >= sizeof( registeredCmds ) - 1 )
{
- CG_Printf( "AddCommand: too many commands (%d > %d)\n",
- len + offset, sizeof( registeredCmds ) - 1 );
+ CG_Printf( "AddCommand: too many commands (%d >= %d)\n",
+ len + gcmdsOffset, sizeof( registeredCmds ) - 1 );
return;
}
trap_AddCommand( cmd );
- strcpy( registeredCmds + offset, cmd );
- offset += len + 1;
+ strcpy( registeredCmds + gcmdsOffset, cmd );
+ gcmdsOffset += len;
}
}
@@ -1265,6 +1265,7 @@ void CG_UnregisterCommands( void )
offset += len + 1;
}
memset( registeredCmds, 0, 2 );
+ gcmdsOffset = 0;
}
static consoleCommand_t svcommands[ ] =