Esempio n. 1
0
static void main_ParseCommands( BYTESTREAM_s *pByteStream )
{	
	switch ( NETWORK_ReadByte( pByteStream ))
	{
	case SVRC_BANNED:
				
		main_ShowMessage( "You have been banned from the server!", MB_ICONEXCLAMATION );
		main_SetState( STATE_WAITING );
		main_EnableConnectionButtons( TRUE );		
		return;
	case SVRC_OLDPROTOCOL:
		{
			char	szBuffer[256];

			// Ignore the protocol version.
			NETWORK_ReadByte( pByteStream );
			sprintf( szBuffer, "The server is using a newer version than you are (%s).\nThis version is compatible with %s.", NETWORK_ReadString( pByteStream ), COMPATIBLE_WITH );
			main_ShowMessage( szBuffer, MB_ICONEXCLAMATION );
			main_SetState( STATE_WAITING );
			main_EnableConnectionButtons( TRUE );
			return;
		}
		return;
	case SVRC_INVALIDPASSWORD:

		time( &g_tLastIncorrectLogin );
		main_ShowMessage( "Sorry, the password you gave is incorrect.", MB_ICONEXCLAMATION );
		main_SetState( STATE_WAITING );
		main_EnableConnectionButtons( TRUE );
		return;
	case SVRC_SALT:

		main_SendPassword( NETWORK_ReadString( pByteStream ));		
		return;
	case SVRC_LOGGEDIN:
	
		// Read in info about the server.
		g_iServerProtocolVersion = NETWORK_ReadByte( pByteStream );
		strncpy( g_szHostname, NETWORK_ReadString( pByteStream ), 256 );
		
		for ( int i = 0, num = NETWORK_ReadByte( pByteStream ); i < num; i++ )
			main_ParseUpdate( pByteStream );

		// Read the console history.
		g_iLines = NETWORK_ReadByte( pByteStream );
		for ( int i = 0; i < g_iLines; i++ )
			g_RecentConsoleHistory.push_back( NETWORK_ReadString( pByteStream ));

		// Show the main dialog.
		CreateThread( NULL, 0, main_Show, 0, 0, 0 );		
		break;
	case SVRC_MESSAGE:
		
		// [BB] The string may contain format parameters like %n, so we may not use Printf!
		if ( g_State == STATE_CONNECTED )
			MAIN_Print( true, NETWORK_ReadString( pByteStream ));
		break;
	case SVRC_UPDATE:

		main_ParseUpdate( pByteStream );
		break;
	}
}
Esempio n. 2
0
//*****************************************************************************
//
void VPrintf( bool bTimestamp, const char *pszString, va_list Parms )
{
	char	szOutLine[8192];
	vsprintf_s( szOutLine, pszString, Parms );
	MAIN_Print( bTimestamp, szOutLine );
}
Esempio n. 3
0
//*****************************************************************************
//
void VPrintf( const char *pszString, va_list Parms )
{
	char	szOutLine[8192];
	vsprintf( szOutLine, pszString, Parms );
	MAIN_Print( szOutLine );
}