这篇教程C++ CONSOLE_Print函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CONSOLE_Print函数的典型用法代码示例。如果您正苦于以下问题:C++ CONSOLE_Print函数的具体用法?C++ CONSOLE_Print怎么用?C++ CONSOLE_Print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CONSOLE_Print函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SEND_W3GS_GAMEINFOBYTEARRAY 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,
示例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,
示例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,
示例4: SEND_W3GS_START_LAGBYTEARRAY 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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例10: Readvoid 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,
示例11: Listenbool 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,
示例12: PushCMDMessagevoid 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,
示例13: Allocatevoid 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,
示例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,
示例15: CLanguageCLanguage :: 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,
示例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,
示例17: CGHostDBMySQLCGHostDBMySQL :: 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,
示例18: CreateThreadRealvoid 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,
示例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, ¶mNo); 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,
示例20: ProcessPacketsvoid 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,
示例21: SignalCatchervoid SignalCatcher( int signal ){ CONSOLE_Print( "[!!!] caught signal, shutting down" ); if( gCCBot ) { if( gCCBot->m_Exiting ) exit( 1 ); else gCCBot->m_Exiting = true; } else exit( 1 );}
开发者ID:Danteoriginal,项目名称:ccbot,代码行数:14,
示例22: DoRecvvoid CTCPSocket :: DoRecv( fd_set *fd ){ if( m_Socket == INVALID_SOCKET || m_HasError || !m_Connected ) return; if( FD_ISSET( m_Socket, fd ) ) { // data is waiting, receive it char buffer[1024]; int c = recv( m_Socket, buffer, 1024, 0 ); if( c == SOCKET_ERROR && GetLastError( ) != EWOULDBLOCK ) { // receive error m_HasError = true; m_Error = GetLastError( ); CONSOLE_Print( "[TCPSOCKET] error (recv) - " + GetErrorString( ) ); return; } else if( c == 0 ) { // the other end closed the connection CONSOLE_Print( "[TCPSOCKET] closed by remote host" ); m_Connected = false; } else if( c > 0 ) { // success! add the received data to the buffer m_RecvBuffer += string( buffer, c ); m_LastRecv = GetTime( ); } }}
开发者ID:luqasn,项目名称:ghost4mac,代码行数:37,
示例23: CStatsDOTACStatsDOTA :: CStatsDOTA( CBaseGame *nGame, string nConditions, string nSaveType ) : CStats( nGame ), m_SaveType( nSaveType ), m_Winner( 0 ), m_Min( 0 ), m_Sec( 0 ), m_TowerLimit( false ), m_KillLimit( 0 ), m_TimeLimit( 0 ), m_SentinelTowers( 0 ), m_ScourgeTowers( 0 ), m_SentinelKills( 0 ), m_ScourgeKills( 0 ), m_LastCreepTime( 0 ){ CONSOLE_Print( "[STATSDOTA] using dota stats" ); for( unsigned int i = 0; i < 12; ++i ) m_Players[i] = NULL; // process the win conditions if( !nConditions.empty( ) ) { stringstream SS; SS << nConditions; while( !SS.eof( ) ) { string Condition; SS >> Condition; if( SS.fail( ) ) { CONSOLE_Print( "[STATSDOTA] failed to process win conditions: " + nConditions ); break; } else if( Condition.length( ) >= 2 ) { string Key = Condition.substr( 0, 2 ); string Value = Condition.substr( 2 ); if( Key == "tw" ) m_TowerLimit = UTIL_ToUInt32( Value ); else if( Key == "ki" ) m_KillLimit = UTIL_ToUInt32( Value ); else if( Key == "tm" ) m_TimeLimit = UTIL_ToUInt32( Value ); } } }
开发者ID:Mofsy,项目名称:ent-ghost,代码行数:37,
示例24: RecvFromvoid CUDPServer :: RecvFrom( fd_set *fd, struct sockaddr_in *sin, string *message ){ if( m_Socket == INVALID_SOCKET || m_HasError || !sin || !message ){ return; } int AddrLen = sizeof( *sin ); if( FD_ISSET( m_Socket, fd ) ) { // data is waiting, receive it CONSOLE_Print( "DEBUUUUUUUUUUUUUUUUUUUUUG" ); char buffer[1024];#ifdef WIN32 int c = recvfrom( m_Socket, buffer, 1024, 0, (struct sockaddr *)sin, &AddrLen );#else int c = recvfrom( m_Socket, buffer, 1024, 0, (struct sockaddr *)sin, (socklen_t *)&AddrLen );#endif if( c == SOCKET_ERROR && GetLastError( ) != EWOULDBLOCK ) { // receive error m_HasError = true; m_Error = GetLastError( ); CONSOLE_Print( "[UDPSERVER] error (recvfrom) - " + GetErrorString( ) ); } else if( c > 0 ) { // success! *message = string( buffer, c ); } }}
开发者ID:nyilmaz,项目名称:px-guard,代码行数:37,
示例25: GetTemperature/***************************************************************************//** * @brief Displays the temperature. * * @return None.*******************************************************************************/void GetTemperature(double* param, char paramNo) /*!< "temperature?" command */{ if(currentMode != 3) { /*!< Read the temperature value from the device */ temperature = ADT7420_GetTemperature(); /*!< Send the requested value to user */ CONSOLE_Print("temperature=%.3f [C]/r/n",temperature); } else { CONSOLE_Print("Device in shutdown mode. Please change the /mode in order to display the temperature. /r/n"); }}
开发者ID:070411209,项目名称:no-OS,代码行数:20,
示例26: Sendvoid CGamePlayer :: Send( BYTEARRAY data ){ // must start counting packet total from beginning of connection // but we can avoid buffering packets until we know the client is using GProxy++ since that'll be determined before the game starts // this prevents us from buffering packets for non-GProxy++ clients m_TotalPacketsSent++; if( m_GProxy && m_Game->GetGameLoaded( ) ){ if( m_GProxyBuffer.size( ) <= 2000 ) m_GProxyBuffer.push( data ); else CONSOLE_Print( "[DENY] Warning: discarding GProxy++ packet from player [" + m_Name + "] due to large queue size (> 2000)" ); } CPotentialPlayer :: Send( data );}
开发者ID:KimimaroTsukimiya,项目名称:G-hostOne,代码行数:15,
示例27: SetBroadcastTargetvoid CUDPSocket :: SetBroadcastTarget( string subnet ){ if( subnet.empty( ) ) { CONSOLE_Print( "[UDPSOCKET] using default broadcast target" ); m_BroadcastTarget.s_addr = INADDR_BROADCAST; } else { // this function does not check whether the given subnet is a valid subnet the user is on // convert string representation of ip/subnet to in_addr CONSOLE_Print( "[UDPSOCKET] using broadcast target [" + subnet + "]" ); m_BroadcastTarget.s_addr = inet_addr( subnet.c_str( ) ); // if conversion fails, inet_addr( ) returns INADDR_NONE if( m_BroadcastTarget.s_addr == INADDR_NONE ) { CONSOLE_Print( "[UDPSOCKET] invalid broadcast target, using default broadcast target" ); m_BroadcastTarget.s_addr = INADDR_BROADCAST; } }}
开发者ID:Mofsy,项目名称:ent-ghost,代码行数:24,
注:本文中的CONSOLE_Print函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CONSP函数代码示例 C++ CONPRINTF函数代码示例 |