• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CONSOLE_Print函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CONSOLE_Print函数的典型用法代码示例。如果您正苦于以下问题:C++ CONSOLE_Print函数的具体用法?C++ CONSOLE_Print怎么用?C++ CONSOLE_Print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CONSOLE_Print函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SEND_W3GS_GAMEINFO

BYTEARRAY CGameProtocol :: SEND_W3GS_GAMEINFO( bool TFT, unsigned char war3Version, BYTEARRAY mapGameType, BYTEARRAY mapFlags, BYTEARRAY mapWidth, BYTEARRAY mapHeight, string gameName, string hostName, uint32_t upTime, string mapPath, BYTEARRAY mapCRC, uint32_t slotsTotal, uint32_t slotsOpen, uint16_t port, uint32_t hostCounter, uint32_t entryKey )
{
	unsigned char ProductID_ROC[]	= {          51, 82, 65, 87 };	// "WAR3"
	unsigned char ProductID_TFT[]	= {          80, 88, 51, 87 };	// "W3XP"
	unsigned char Version[]			= { war3Version,  0,  0,  0 };
	unsigned char Unknown[]			= {           1,  0,  0,  0 };

	BYTEARRAY packet;

	if( mapGameType.size( ) == 4 && mapFlags.size( ) == 4 && mapWidth.size( ) == 2 && mapHeight.size( ) == 2 && !gameName.empty( ) && !hostName.empty( ) && !mapPath.empty( ) && mapCRC.size( ) == 4 )
	{
		// make the stat string

		BYTEARRAY StatString;
		UTIL_AppendByteArrayFast( StatString, mapFlags );
		StatString.push_back( 0 );
		UTIL_AppendByteArrayFast( StatString, mapWidth );
		UTIL_AppendByteArrayFast( StatString, mapHeight );
		UTIL_AppendByteArrayFast( StatString, mapCRC );
		UTIL_AppendByteArrayFast( StatString, mapPath );
		UTIL_AppendByteArrayFast( StatString, hostName );
		StatString.push_back( 0 );
		StatString = UTIL_EncodeStatString( StatString );

		// make the rest of the packet

		packet.push_back( W3GS_HEADER_CONSTANT );						// W3GS header constant
		packet.push_back( W3GS_GAMEINFO );								// W3GS_GAMEINFO
		packet.push_back( 0 );											// packet length will be assigned later
		packet.push_back( 0 );											// packet length will be assigned later

		if( TFT )
			UTIL_AppendByteArray( packet, ProductID_TFT, 4 );			// Product ID (TFT)
		else
			UTIL_AppendByteArray( packet, ProductID_ROC, 4 );			// Product ID (ROC)

		UTIL_AppendByteArray( packet, Version, 4 );						// Version
		UTIL_AppendByteArray( packet, hostCounter, false );				// Host Counter
		UTIL_AppendByteArray( packet, entryKey, false );				// Entry Key
		UTIL_AppendByteArrayFast( packet, gameName );					// Game Name
		packet.push_back( 0 );											// ??? (maybe game password)
		UTIL_AppendByteArrayFast( packet, StatString );					// Stat String
		packet.push_back( 0 );											// Stat String null terminator (the stat string is encoded to remove all even numbers i.e. zeros)
		UTIL_AppendByteArray( packet, slotsTotal, false );				// Slots Total
		UTIL_AppendByteArrayFast( packet, mapGameType );				// Game Type
		UTIL_AppendByteArray( packet, Unknown, 4 );						// ???
		UTIL_AppendByteArray( packet, slotsOpen, false );				// Slots Open
		UTIL_AppendByteArray( packet, upTime, false );					// time since creation
		UTIL_AppendByteArray( packet, port, false );					// port
		AssignLength( packet );
	}
	else
		CONSOLE_Print( "[GAMEPROTO] invalid parameters passed to SEND_W3GS_GAMEINFO" );

	// DEBUG_Print( "SENT W3GS_GAMEINFO" );
	// DEBUG_Print( packet );
	return packet;
}
开发者ID:ProDotaTrY,项目名称:ghostcb,代码行数:58,代码来源:gameprotocol.cpp


示例2: SetPdPin

/***************************************************************************//**
 * @brief Sets the output value of PD_n pin.
 *
 * @param param[0] - value to be set for PD_n pin.
 *
 * @return None.
*******************************************************************************/
void SetPdPin(double* param, char paramNo) // "pdPin=" command
{
    unsigned char status = 0;

    /* Check if the parameter is valid */
    if(paramNo >= 1)
    {
        if(param[0] < 0)
        {
            param[0] = 0;
        }
        else
        {
            if(param[0] > 1)
            {
                param[0] = 1;
            }
        }

        status = (unsigned char) param[0];

        if (status == 0)
        {
            AD5570_PD_LOW;
            pd_n = 0;
        }
        else
        {
            if (status == 1)
            {
                AD5570_PD_HIGH;
                pd_n = 1;
            }
        }
        /* Send feedback to user */
        CONSOLE_Print("%s%d\r\n",(char*)cmdList[6], status);
     }
     else
     {
        /* Display error messages */
        CONSOLE_Print("Invalid parameter!\r\n");
        CONSOLE_Print("%s%s\r\n", (char*)cmdList[6], (char*)cmdDescription[6]);
        CONSOLE_Print("Example: %s\r\n", (char*)cmdExample[6]);
     }
}
开发者ID:DannyDeGaspari,项目名称:no-OS,代码行数:52,代码来源:Command.c


示例3: DoReset

/***************************************************************************//**
 * @brief Resets the device.
 *
 * @return None.
*******************************************************************************/
void DoReset(double* param, char paramNo) /*!< "reset!" command */
{
   /*!< Resets the device(software reset). */
    measureSetting = 0;
    ADXL362_SoftwareReset();

    /*!< Send feedback to user */
    CONSOLE_Print("Device was reset.\r\n");
}
开发者ID:070411209,项目名称:no-OS,代码行数:14,代码来源:Command.c


示例4: SEND_W3GS_START_LAG

BYTEARRAY CGameProtocol :: SEND_W3GS_START_LAG( vector<CGamePlayer *> players, bool loadInGame )
{
	BYTEARRAY packet;

	unsigned char NumLaggers = 0;

	for( vector<CGamePlayer *> :: iterator i = players.begin( ); i != players.end( ); i++ )
	{
		if( loadInGame )
		{
			if( !(*i)->GetFinishedLoading( ) )
				NumLaggers++;
		}
		else
		{
			if( (*i)->GetLagging( ) )
				NumLaggers++;
		}
	}

	if( NumLaggers > 0 )
	{
		packet.push_back( W3GS_HEADER_CONSTANT );	// W3GS header constant
		packet.push_back( W3GS_START_LAG );			// W3GS_START_LAG
		packet.push_back( 0 );						// packet length will be assigned later
		packet.push_back( 0 );						// packet length will be assigned later
		packet.push_back( NumLaggers );

		for( vector<CGamePlayer *> :: iterator i = players.begin( ); i != players.end( ); i++ )
		{
			if( loadInGame )
			{
				if( !(*i)->GetFinishedLoading( ) )
				{
					packet.push_back( (*i)->GetPID( ) );
					UTIL_AppendByteArray( packet, (uint32_t)0, false );
				}
			}
			else
			{
				if( (*i)->GetLagging( ) )
				{
					packet.push_back( (*i)->GetPID( ) );
					UTIL_AppendByteArray( packet, GetTicks( ) - (*i)->GetStartedLaggingTicks( ), false );
				}
			}
		}

		AssignLength( packet );
	}
	else
		CONSOLE_Print( "[GAMEPROTO] no laggers passed to SEND_W3GS_START_LAG" );

	// DEBUG_Print( "SENT W3GS_START_LAG" );
	// DEBUG_Print( packet );
	return packet;
}
开发者ID:brunobnb,项目名称:ghostcb,代码行数:57,代码来源:gameprotocol.cpp


示例5: GetVoltage

/***************************************************************************//**
 * @brief Displays the input voltage in [mV].
 *
 * @return None.
*******************************************************************************/
void GetVoltage(double* param, char paramNo) // "voltage?" command
{
    float vin = 0;

    vin = ad7920_GetVoltage(VREF);
    vin = (vin / GAIN) * 1000;

    /* Send feedback to user */
    CONSOLE_Print("Voltage=%.3f[mV].\r\n", vin);
}
开发者ID:363546178,项目名称:no-OS,代码行数:15,代码来源:Command.c


示例6: DisplayCmdList

/***************************************************************************//**
 * @brief Internal function for displaying all the command with its description.
 *
 * @return None.
*******************************************************************************/
void DisplayCmdList()
{
    unsigned char displayCmd;

    for(displayCmd = 0; displayCmd < cmdNo; displayCmd++)
    {
        CONSOLE_Print("%s - %s\r\n", (char*)cmdList[displayCmd].name, \
                                     (char*)cmdList[displayCmd].description);
    }
}
开发者ID:363546178,项目名称:no-OS,代码行数:15,代码来源:Command.c


示例7: GetOffset

/***************************************************************************//**
 * @brief Displays last written value to the Offset Adjust register.
 *
 * @return None.
*******************************************************************************/
void GetOffset(double* param, char paramNo) // "offset?" command
{
    int value = 0;

    offsetReg = AD5421_GetOffset();
    /* Calculate offset according to the datasheet formula. */
    value = offsetReg - 32768;
    /* Send the requested value to user */
    CONSOLE_Print("%s%d [LSBs]\r\n", cmdList[6].name, value);
}
开发者ID:363546178,项目名称:no-OS,代码行数:15,代码来源:Command.c


示例8: GetGain

/***************************************************************************//**
 * @brief Displays last gain value from the Gain Adjust register.
 *
 * @return None.
*******************************************************************************/
void GetGain(double* param, char paramNo) // "gain?" command
{
    int value = 0;

    gainReg = AD5421_GetGain();
    /* Calculate according to the datasheet formula. */
    value = gainReg - 65535;
    /* Send the requested value to user */
    CONSOLE_Print("%s%d [LSBs]\r\n", cmdList[8].name, value);
}
开发者ID:363546178,项目名称:no-OS,代码行数:15,代码来源:Command.c


示例9: DoDeviceInit

/***************************************************************************//**
 * @brief Initializes the device.
 *
 * @return - The result of the initialization.
 *              Example: ERROR  - the device was not initialized or the device
 *                              is not present.
 *                       SUCCES - the device was initialized and the device
 *                              is present.
*******************************************************************************/
char DoDeviceInit(void)
{
    if(AD5781_Init() == 0)
    {
        CONSOLE_Print("AD5781 OK\r\n");
        GetHelp(NULL, 0);
        registerValue = (AD5781_GetRegisterValue(AD5781_REG_DAC) &
        				~(AD5781_ADDR_REG(-1))) >> 2;
        return SUCCESS;
    }
开发者ID:DannyDeGaspari,项目名称:no-OS,代码行数:19,代码来源:Command.c


示例10: Read

void CConfig :: Read( string file )
{
	ifstream in;
	in.open( file.c_str( ) );

	if( in.fail( ) )
		CONSOLE_Print( "[CONFIG] warning - unable to read file [" + file + "]" );
	else
	{
		CONSOLE_Print( "[CONFIG] loading file [" + file + "]" );
		string Line;

		while( !in.eof( ) )
		{
			getline( in, Line );

			// ignore blank lines and comments

			if( Line.empty( ) || Line[0] == '#' )
				continue;

			// remove newlines and partial newlines to help fix issues with Windows formatted config files on Linux systems

			Line.erase( remove( Line.begin( ), Line.end( ), '\r' ), Line.end( ) );
			Line.erase( remove( Line.begin( ), Line.end( ), '\n' ), Line.end( ) );

			string :: size_type Split = Line.find( "=" );

			if( Split == string :: npos )
				continue;

			string :: size_type KeyStart = Line.find_first_not_of( " " );
			string :: size_type KeyEnd = Line.find( " ", KeyStart );
			string :: size_type ValueStart = Line.find_first_not_of( " ", Split + 1 );
			string :: size_type ValueEnd = Line.size( );

			if( ValueStart != string :: npos )
				m_CFG[Line.substr( KeyStart, KeyEnd - KeyStart )] = Line.substr( ValueStart, ValueEnd - ValueStart );
		}

		in.close( );
	}
}
开发者ID:KimimaroTsukimiya,项目名称:G-hostOne,代码行数:43,代码来源:config.cpp


示例11: Listen

bool CTCPServer :: Listen( string address, uint16_t port )
{
	if( m_Socket == INVALID_SOCKET || m_HasError )
		return false;

	m_SIN.sin_family = AF_INET;

	if( !address.empty( ) )
	{
		if( ( m_SIN.sin_addr.s_addr = inet_addr( address.c_str( ) ) ) == INADDR_NONE )
			m_SIN.sin_addr.s_addr = INADDR_ANY;
	}
	else
		m_SIN.sin_addr.s_addr = INADDR_ANY;

	m_SIN.sin_port = htons( port );

	if( ::bind( m_Socket, (struct sockaddr *)&m_SIN, sizeof( m_SIN ) ) == SOCKET_ERROR )
	{
		m_HasError = true;
		m_Error = GetLastError( );

		if (m_isConsolePrint)
			CONSOLE_Print( "[TCPSERVER] error (bind) - " + GetErrorString( ) );

		return false;
	}

	// listen, queue length 8

	if( listen( m_Socket, 8 ) == SOCKET_ERROR )
	{
		m_HasError = true;
		m_Error = GetLastError( );

		if (m_isConsolePrint)
			CONSOLE_Print( "[TCPSERVER] error (listen) - " + GetErrorString( ) );

		return false;
	}

	return true;
}
开发者ID:brunobnb,项目名称:brtGHost,代码行数:43,代码来源:socket.cpp


示例12: PushCMDMessage

void CGamePlayer :: PushCMDMessage( string message, bool check )
{	
	if( m_LastCMDMessages.size( ) >= 8)
		m_LastCMDMessages.pop_front( );
	m_LastCMDMessages.push_back(message);
	if( m_LastCMDMessages.size( ) == 7 )
		if(!check){
			m_Game->SendAllChat( m_Game->m_GHost->m_Language->KickMsgForAbuser( GetName( ) ) );
			CONSOLE_Print("[" + m_Game->GetGameName( )+ "] Player "+GetName()+" appears to be a command abuser!");
		}	
}
开发者ID:KimimaroTsukimiya,项目名称:G-hostOne,代码行数:11,代码来源:gameplayer.cpp


示例13: Allocate

void CSocket :: Allocate( int type )
{
	m_Socket = socket( AF_INET, type, 0 );

	if( m_Socket == INVALID_SOCKET )
	{
		m_HasError = true;
		m_Error = GetLastError( );
		CONSOLE_Print( "[SOCKET] error (socket) - " + GetErrorString( ) );
		return;
	}
}
开发者ID:Mofsy,项目名称:ent-ghost,代码行数:12,代码来源:socket.cpp


示例14: SetResistance

/***************************************************************************//**
 * @brief Sets the output resistance between W and B, in ohms.
 *
 * @return None.
*******************************************************************************/
void SetResistance(double* param, char paramNo) /*!< "resistance=" command */
{
    double tempFloat = 0;

    /*!< Check if the parameter is valid */
    if(paramNo >= 1)
    {
        if(param[0] < 60)
        {
            param[0] = 60;
        }
        if(param[0] > 10020)
        {
            param[0] = 10020;
        }
        outResistance = param[0];
        /*!< Find the binary value corresponding to the output voltage*/
        tempFloat = ((outResistance - R_W) / (double)R_AB) * 256;
        registerValue = (unsigned char)tempFloat;
        /*!< Round the value */
        if(tempFloat - registerValue >= 0.5)
        {
            registerValue ++;
        }
        /*!< Write to DAC register */
        AD5160_Set(registerValue);
        /*!< Send feedback to user */
        outResistance = R_AB * ((double)registerValue / 256) + R_W;
        /*!< Convert float to string and send it to user */
        CONSOLE_Print("%s%d [ohms]\r\n",(char*)cmdList[1],\
                      (unsigned short)outResistance);
    }
     else
    {
        /*!< Display error messages */
        CONSOLE_Print("Invalid parameter!\r\n");
        CONSOLE_Print("%s%s\r\n", (char*)cmdList[1], (char*)cmdDescription[1]);
        CONSOLE_Print("Example: %s\r\n", (char*)cmdExample[1]);
    }
}
开发者ID:070411209,项目名称:no-OS,代码行数:45,代码来源:Command.c


示例15: CLanguage

CLanguage :: CLanguage( string nCFGFile )
{
	m_CFG = new CConfig( );
	m_CFG->Read( nCFGFile );
	
	ifstream in;
	in.open( "jokes.txt" );

	if( in.fail( ) )
		CONSOLE_Print( "[JOKES] error loading jokes from [jokes.txt]" );
	else
	{
		CONSOLE_Print( "[JOKES] loading jokes from [jokes.txt]" );
		m_Jokes.clear();
		
		string Line;

		while( !in.eof( ) )
		{
			getline( in, Line );

			// ignore blank lines and comments

			if( Line.empty( ) || Line[0] == '#' )
				continue;

			// remove newlines and partial newlines to help fix issues with Windows formatted files on Linux systems

			//Line.erase( remove( Line.begin( ), Line.end( ), ' ' ), Line.end( ) );
			Line.erase( remove( Line.begin( ), Line.end( ), '\r' ), Line.end( ) );
			Line.erase( remove( Line.begin( ), Line.end( ), '\n' ), Line.end( ) );

			m_Jokes.push_back( Line );
		}

		in.close( );

		CONSOLE_Print( "[JOKES] loaded " + UTIL_ToString( m_Jokes.size( ) ) + " jokes." );
	}
}
开发者ID:SparkoPro,项目名称:ghostnordicleague,代码行数:40,代码来源:language.cpp


示例16: SetCurrent

/***************************************************************************//**
 * @brief Sets the output current.
 *
 * @param param[0] - desired value to be set in milliamps.
 *
 * @return None.
*******************************************************************************/
void SetCurrent(double* param, char paramNo) // "current=" command
{
    float floatValue = 0;

    /* Check if the parameter is valid */
    if(paramNo >= 1)
    {
        if(param[0] < 4)
        {
            param[0] = 4;
        }
        if(param[0] > 20)
        {
            param[0] = 20;
        }
        /* Datasheet formula */
        floatValue = ((float)param[0] - (4 + (16 * ((float)offsetReg - 32768)) /
                      65536)) * 65536 * 65536 / (16 * (float)gainReg);
        /* Verify the limits of the value to be written in DAC register */
        if (floatValue > 65535)
        {
            floatValue = 65535;
        }
        else if (floatValue < 0)
        {
            floatValue = 0;
        }

        dacReg = (int)floatValue;
        /* Write to DAC register */
        AD5421_SetDac(dacReg);
        /* Datasheet formula */
        floatValue = (16 * ((float)gainReg / 65536) * ((float)dacReg / 65536))
                    + 4 + (16 * ((float)offsetReg - 32768) / 65536);
        /* Establish the current limits in software, in hardware is already done */
        if (floatValue < 4)
        {
            floatValue = 4;
        }
        else if (floatValue > 20)
        {
            floatValue = 20;
        }
        /* Send the requested value to user */
        CONSOLE_Print("%s%.3f [mA]\r\n", cmdList[2].name, floatValue);
    }
    else
    {
        /* Display error messages */
        DisplayError(2);
    }
}
开发者ID:363546178,项目名称:no-OS,代码行数:59,代码来源:Command.c


示例17: CGHostDBMySQL

CGHostDBMySQL :: CGHostDBMySQL( CConfig *CFG ) : CGHostDB( CFG )
{
	m_Server = CFG->GetString( "db_mysql_server", string( ) );
	m_Database = CFG->GetString( "db_mysql_database", "ghost" );
	m_User = CFG->GetString( "db_mysql_user", string( ) );
	m_Password = CFG->GetString( "db_mysql_password", string( ) );
	m_Port = CFG->GetInt( "db_mysql_port", 0 );
	m_BotID = CFG->GetInt( "db_mysql_botid", 0 );
	m_NumConnections = 1;
	m_OutstandingCallables = 0;

	mysql_library_init( 0, NULL, NULL );

	// create the first connection

	CONSOLE_Print( "[MYSQL] connecting to database server" );
	MYSQL *Connection = NULL;

	if( !( Connection = mysql_init( NULL ) ) )
	{
		CONSOLE_Print( string( "[MYSQL] " ) + mysql_error( Connection ) );
		m_HasError = true;
		m_Error = "error initializing MySQL connection";
		return;
	}

	my_bool Reconnect = true;
	mysql_options( Connection, MYSQL_OPT_RECONNECT, &Reconnect );

	if( !( mysql_real_connect( Connection, m_Server.c_str( ), m_User.c_str( ), m_Password.c_str( ), m_Database.c_str( ), m_Port, NULL, 0 ) ) )
	{
		CONSOLE_Print( string( "[MYSQL] " ) + mysql_error( Connection ) );
		m_HasError = true;
		m_Error = "error connecting to MySQL server";
		return;
	}

	m_IdleConnections.push( Connection );
}
开发者ID:binux,项目名称:ghostmod,代码行数:39,代码来源:ghostdbmysql.cpp


示例18: CreateThreadReal

void CGHostDB :: CreateThreadReal( CBaseCallable *callable )
{
	try
	{
		boost :: thread Thread( boost :: ref( *callable ) );
	}
	catch( boost :: thread_resource_error tre )
	{
		CONSOLE_Print( "[GHOST] error spawning thread on attempt #1 [" + string( tre.what( ) ) + "], pausing execution and trying again in 50ms" );
//		MILLISLEEP( 50 );

		try
		{
			boost :: thread Thread( boost :: ref( *callable ) );
		}
		catch( boost :: thread_resource_error tre2 )
		{
			CONSOLE_Print( "[GHOST] error spawning thread on attempt #2 [" + string( tre2.what( ) ) + "], giving up" );
			callable->SetReady( true );
		}
	}
}
开发者ID:NetCreator,项目名称:GHostPP,代码行数:22,代码来源:ghostdb.cpp


示例19: main

/***************************************************************************//**
 * @brief Main function.
 *
 * @return None.
*******************************************************************************/
int main(void)
{

    char          receivedCmd[30] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    unsigned char cmd             =  0;
    double        param[5]        = {0, 0, 0, 0, 0};
    char          paramNo         =  0;
    char          cmdType         = -1;
    char          invalidCmd      =  0;


    /*!< Select and initialize the platform. */
    if (PLATFORM_Init(XILINX_KC705) < 0)
    {
        return -1;
    }
    /*!< Initialize the console with selected baud rate for the platform used. */
    CONSOLE_Init(UART_BAUDRATE);
    /*!< Initialize the device. */
    DoDeviceInit();

    while(1)
    {
        /*!< Read the command entered by user through console. */
        CONSOLE_GetCommand(receivedCmd);
        invalidCmd = 0;
        for(cmd = 0; cmd < cmdNo; cmd++)
        {
            paramNo = 0;
            cmdType = CONSOLE_CheckCommands(receivedCmd, cmdList[cmd].name, \
                                            param, &paramNo);
            if(cmdType == UNKNOWN_CMD)
            {
                invalidCmd++;
            }
            else
            {
                cmdFunctions[cmd](param, paramNo);
            }
        }
        /*!< Send feedback to user, if the command entered by user is not a valid one. */
        if(invalidCmd == cmdNo)
        {
            CONSOLE_Print("Invalid command!\r\n");
        }
    }

    return 0;
}
开发者ID:prwilliams1969,项目名称:no-OS,代码行数:56,代码来源:main.c


示例20: ProcessPackets

void CPotentialPlayer :: ProcessPackets( )
{
	if( !m_Socket )
		return;

	// process all the received packets in the m_Packets queue

	while( !m_Packets.empty( ) )
	{
		CCommandPacket *Packet = m_Packets.front( );
		m_Packets.pop( );

		if( Packet->GetPacketType( ) == W3GS_HEADER_CONSTANT )
		{
			// the only packet we care about as a potential player is W3GS_REQJOIN, ignore everything else

			switch( Packet->GetID( ) )
			{
			case CGameProtocol :: W3GS_REQJOIN:
				delete m_IncomingJoinPlayer;
				m_IncomingJoinPlayer = m_Protocol->RECEIVE_W3GS_REQJOIN( Packet->GetData( ) );

				if( m_IncomingJoinPlayer && !m_Banned )
					m_Game->EventPlayerJoined( this, m_IncomingJoinPlayer );

				// don't continue looping because there may be more packets waiting and this parent class doesn't handle them
				// EventPlayerJoined creates the new player, NULLs the socket, and sets the delete flag on this object so it'll be deleted shortly
				// any unprocessed packets will be copied to the new CGamePlayer in the constructor or discarded if we get deleted because the game is full

				delete Packet;
				return;
			}
		}		
		
		else if( Packet->GetPacketType( ) == GCBI_HEADER_CONSTANT )
		{
//			if( Packet->GetID( ) == CGCBIProtocol :: GCBI_INIT && m_Game->m_GHost->IsLocal( GetExternalIPString( ) ) )
			if( Packet->GetID( ) == CGCBIProtocol :: GCBI_INIT )
			{
				delete m_IncomingGarenaUser;
				m_IncomingGarenaUser = m_Game->m_GHost->m_GCBIProtocol->RECEIVE_GCBI_INIT( Packet->GetData( ) );
				string RoomID = UTIL_ToString(m_IncomingGarenaUser->GetRoomID( ));
				m_RoomName = m_Game->m_GHost->GetRoomName( string( RoomID.begin( ), RoomID.end( ) ) );
				CONSOLE_Print( "[GCBI] Garena user detected; userid=" + UTIL_ToString( m_IncomingGarenaUser->GetUserID( ) ) + ", roomid=" + RoomID + ", RoomName=" + m_RoomName + ", experience=" + UTIL_ToString( m_IncomingGarenaUser->GetUserExp( ) ) + ", country=" + m_IncomingGarenaUser->GetCountryCode( ) );
			}
		}

		delete Packet;
	}
}
开发者ID:KimimaroTsukimiya,项目名称:G-hostOne,代码行数:50,代码来源:gameplayer.cpp



注:本文中的CONSOLE_Print函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CONSP函数代码示例发布时间:2022-05-30
下一篇:
C++ CONPRINTF函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap