当前位置: 首页>>代码示例>>C++>>正文


C++ CONSOLE_Print函数代码示例

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


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


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