예제 #1
0
파일: cmd.c 프로젝트: BraXi/CoD4X18-Server
/*
============
Cmd_TokenizeString
============
*/
void Cmd_TokenizeString( const char *text_in ) {
	Cmd_TokenizeString2( text_in, qfalse);
}
예제 #2
0
/*
===================
CL_GetServerCommand

Set up argc/argv for the given command
===================
*/
bool CL_GetServerCommand( int serverCommandNumber )
{
	const char *s;
	const char *cmd;
	static char bigConfigString[BIG_INFO_STRING];
	int argc;

	// if we have irretrievably lost a reliable command, drop the connection
	if ( serverCommandNumber <= clc.serverCommandSequence - MAX_RELIABLE_COMMANDS )
    {
		// when a demo record was started after the client got a whole bunch of
		// reliable commands then the client never got those first reliable commands
		if ( clc.demoplaying )
			return false;

		Com_Error( ERR_DROP, "CL_GetServerCommand: a reliable command was cycled out" );
		return false;
	}

	if ( serverCommandNumber > clc.serverCommandSequence )
    {
		Com_Error( ERR_DROP, "CL_GetServerCommand: requested a command not received" );
		return false;
	}

	s = clc.serverCommands[ serverCommandNumber & ( MAX_RELIABLE_COMMANDS - 1 ) ];
	clc.lastExecutedServerCommand = serverCommandNumber;

	Com_DPrintf( "serverCommand: %i : %s\n", serverCommandNumber, s );

rescan:
	Cmd_TokenizeString2(s, false);
	cmd = Cmd_Argv(0);
	argc = Cmd_Argc();

	if ( !strcmp( cmd, "disconnect" ) )
    {
		// allow server to indicate why they were disconnected
		if ( argc >= 2 )
			Com_Error( ERR_SERVERDISCONNECT, "Server disconnected - %s", Cmd_Argv( 1 ) );
		else
			Com_Error( ERR_SERVERDISCONNECT, "Server disconnected" );
	}

	if ( !strcmp( cmd, "bcs0" ) )
    {
		Com_sprintf( bigConfigString, BIG_INFO_STRING, "cs %s \"%s", Cmd_Argv(1), Cmd_Argv(2) );
		return false;
	}

	if ( !strcmp( cmd, "bcs1" ) )
    {
		s = Cmd_Argv(2);
		if( strlen(bigConfigString) + strlen(s) >= BIG_INFO_STRING )
			Com_Error( ERR_DROP, "bcs exceeded BIG_INFO_STRING" );

		strcat( bigConfigString, s );
		return false;
	}

	if ( !strcmp( cmd, "bcs2" ) )
    {
		s = Cmd_Argv(2);
		if( strlen(bigConfigString) + strlen(s) + 1 >= BIG_INFO_STRING )
			Com_Error( ERR_DROP, "bcs exceeded BIG_INFO_STRING" );

		strcat( bigConfigString, s );
		strcat( bigConfigString, "\"" );
		s = bigConfigString;
		goto rescan;
	}

	if ( !strcmp( cmd, "cs" ) )
    {
		CL_ConfigstringModified();
        // reparse the string, because CL_ConfigstringModified may have done
        // another Cmd_TokenizeString()
		Cmd_TokenizeString2(s, false);
		return true;
	}

	if ( !strcmp( cmd, "map_restart" ) )
    {
		// clear notify lines and outgoing commands before passing
		// the restart to the cgame
		Con_ClearNotify();
        // reparse the string, because Con_ClearNotify() may have done another
        // Cmd_TokenizeString()
		Cmd_TokenizeString2(s, false);
		::memset( cl.cmds, 0, sizeof( cl.cmds ) );
		return true;
	}

	// we may want to put a "connect to other server" command here

	// cgame can now act on the command
	return true;
}
예제 #3
0
파일: cmd.c 프로젝트: BraXi/CoD4X18-Server
/*
============
Cmd_TokenizeStringIgnoreQuotes
============
*/
void Cmd_TokenizeStringIgnoreQuotes( const char *text_in ) {
	Cmd_TokenizeString2( text_in, qtrue );
}
예제 #4
0
파일: cmd.cpp 프로젝트: TheDushan/OpenWolf
/*
============
Cmd_TokenizeStringParseCvar
============
*/
void Cmd_TokenizeStringParseCvar( const char *text_in ) {
	Cmd_TokenizeString2( text_in, false, true );
}