本文整理汇总了C++中ConsolePrint函数的典型用法代码示例。如果您正苦于以下问题:C++ ConsolePrint函数的具体用法?C++ ConsolePrint怎么用?C++ ConsolePrint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ConsolePrint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeviceListPrintList
/* INFO: */
int DeviceListPrintList() {
StructuresDynamicNode * localNode = { 0 };
unsigned int localDeviceNumber = { 0 };
CHECK_INITIALIZED(staticInitializedFlag);
++localDeviceNumber;
CHECK(ConsolePrint(DEVICE_LIST_PRINT_LIST_STRING));
CHECK(DeviceListMutexLock());
{
localNode = globalDeviceList;
while(localNode) {
CHECK(ConsolePrint(
DEVICE_LIST_PRINT_LIST_ENTRY_FORMATTER,
localDeviceNumber, localNode->device->
friendlyName, localNode->device->
uniqueDeviceName));
localNode = localNode->next;
++localDeviceNumber;
}
}
CHECK(DeviceListMutexUnlock());
CHECK(ConsolePrint(DEVICE_LIST_NEW_LINE_STRING));
return NO_ERROR;
}
示例2: ConsolePrint
void CHudAmmo::UserCmd_Rebuy()
{
char *afile = (char*)gEngfuncs.COM_LoadFile("rebuy.txt", 5, NULL);
char *pfile = afile;
char token[64];
char szCmd[1024];
int lastCh;
if( !pfile )
{
ConsolePrint( "Can't open rebuy.txt file.\n" );
return;
}
// start with \"
strncpy(szCmd, "cl_setrebuy \"", sizeof(szCmd));
while((pfile = gEngfuncs.COM_ParseFile( pfile, token )))
{
strcat(szCmd, token);
// append space after token
strcat(szCmd, " ");
}
// replace last space with ", before terminator
lastCh = strlen(szCmd);
szCmd[lastCh - 1] = '\"';
ConsolePrint(szCmd);
gEngfuncs.pfnServerCmd(szCmd);
gEngfuncs.COM_FreeFile( afile );
}
示例3: CommandsCommonPrintHelpList
/* INFO: */
static int CommandsCommonPrintHelpList(const bool inpLongHelpFlag) {
const char * localCommandString = { 0 };
const char * localShortHelpString = { 0 };
const char * localLongHelpString = { 0 };
unsigned int localIndex = { 0 };
CHECK(ConsolePrint(COMMANDS_INFO));
for(; localIndex < globalCommandsCommandArraySize; ++localIndex) {
localCommandString = globalCommandsCommandArray[localIndex].
commandString;
localShortHelpString = globalCommandsCommandArray[localIndex].
shortHelpString;
localLongHelpString = globalCommandsCommandArray[localIndex].
longHelpString;
CHECK(CommandsCommonPrintHelpEntry(inpLongHelpFlag,
localCommandString, localShortHelpString,
localLongHelpString));
}
CHECK(ConsolePrint(COMMANDS_NEW_LINE_STRING));
return NO_ERROR;
}
示例4: SM_ConfigsExecuted_Global
void RootConsoleMenu::GotRootCmd(const CCommand &cmd)
{
unsigned int argnum = cmd.ArgC();
if (argnum >= 2)
{
const char *cmdname = cmd.Arg(1);
if (strcmp(cmdname, "internal") == 0)
{
if (argnum >= 3)
{
const char *arg = cmd.Arg(2);
if (strcmp(arg, "1") == 0)
{
SM_ConfigsExecuted_Global();
}
else if (strcmp(arg, "2") == 0)
{
if (argnum >= 4)
{
SM_ConfigsExecuted_Plugin(atoi(cmd.Arg(3)));
}
}
}
return;
}
CCommandArgs ocmd(cmd);
ConsoleEntry *entry;
if (m_Commands.retrieve(cmdname, &entry))
{
if (entry->version2)
{
entry->cmd->OnRootConsoleCommand2(cmdname, &ocmd);
}
else
{
entry->cmd->OnRootConsoleCommand(cmdname, cmd);
}
return;
}
}
ConsolePrint("SourceMod Menu:");
ConsolePrint("Usage: sm <command> [arguments]");
List<ConsoleEntry *>::iterator iter;
ConsoleEntry *pEntry;
for (iter=m_Menu.begin(); iter!=m_Menu.end(); iter++)
{
pEntry = (*iter);
DrawGenericOption(pEntry->command.c_str(), pEntry->description.c_str());
}
}
示例5: BEGIN_READ
// Message handler for text messages
// displays a string, looking them up from the titles.txt file, which can be localised
// parameters:
// byte: message direction ( HUD_PRINTCONSOLE, HUD_PRINTNOTIFY, HUD_PRINTCENTER, HUD_PRINTTALK )
// string: message
// optional parameters:
// string: message parameter 1
// string: message parameter 2
// string: message parameter 3
// string: message parameter 4
// any string that starts with the character '#' is a message name, and is used to look up the real message in titles.txt
// the next (optional) one to four strings are parameters for that string (which can also be message names if they begin with '#')
int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
int msg_dest = READ_BYTE();
#define MSG_BUF_SIZE 128
static char szBuf[6][MSG_BUF_SIZE];
char *msg_text = LookupString( READ_STRING(), &msg_dest );
msg_text = safe_strcpy( szBuf[0], msg_text , MSG_BUF_SIZE);
// keep reading strings and using C format strings for subsituting the strings into the localised text string
char *sstr1 = LookupString( READ_STRING() );
sstr1 = safe_strcpy( szBuf[1], sstr1 , MSG_BUF_SIZE);
StripEndNewlineFromString( sstr1 ); // these strings are meant for subsitution into the main strings, so cull the automatic end newlines
char *sstr2 = LookupString( READ_STRING() );
sstr2 = safe_strcpy( szBuf[2], sstr2 , MSG_BUF_SIZE);
StripEndNewlineFromString( sstr2 );
char *sstr3 = LookupString( READ_STRING() );
sstr3 = safe_strcpy( szBuf[3], sstr3 , MSG_BUF_SIZE);
StripEndNewlineFromString( sstr3 );
char *sstr4 = LookupString( READ_STRING() );
sstr4 = safe_strcpy( szBuf[4], sstr4 , MSG_BUF_SIZE);
StripEndNewlineFromString( sstr4 );
char *psz = szBuf[5];
if ( gViewPort && gViewPort->AllowedToPrintText() == FALSE )
return 1;
switch ( msg_dest )
{
case HUD_PRINTCENTER:
safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
CenterPrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTNOTIFY:
psz[0] = 1; // mark this message to go into the notify buffer
safe_sprintf( psz+1, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
ConsolePrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTTALK:
safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );
break;
case HUD_PRINTCONSOLE:
safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
ConsolePrint( ConvertCRtoNL( psz ) );
break;
}
return 1;
}
示例6: Blitters_Init
void Blitters_Init()
{
ConsolePrint(Msg_Get(MSG_Blitters_Loading));
Blitters.list = NULL;
Blitters.current = NULL;
// Open and read file
t_tfile * tf;
if ((tf = tfile_read (Blitters.filename)) == NULL)
Quit_Msg("%s", meka_strerror());
ConsolePrint("\n");
// Parse each line
int line_cnt = 0;
for (t_list* lines = tf->data_lines; lines; lines = lines->next)
{
const char* line = (char*)lines->elem;
line_cnt += 1;
int i, j;
char s1 [256], s2 [256];
for (i = 0, j = 0; line [i] != 0 && line [i] != ';'; i ++)
if ((line [0] == '[') || (line [i] != ' ' && line [i] != '\t'))
s2 [j ++] = line [i];
s2 [j] = 0;
if (StrIsNull (s2))
continue;
strcpy(s1, s2);
StrLower(s1);
switch (Blitters_Parse_Line (s1, s2))
{
case MEKA_ERR_UNKNOWN: tfile_free(tf); Quit_Msg(Msg_Get(MSG_Blitters_Error_Unrecognized), line_cnt);
case MEKA_ERR_MISSING: tfile_free(tf); Quit_Msg(Msg_Get(MSG_Blitters_Error_Missing), line_cnt);
case MEKA_ERR_VALUE_INCORRECT: tfile_free(tf); Quit_Msg(Msg_Get(MSG_Blitters_Error_Incorrect_Value), line_cnt);
}
}
// Free file data
tfile_free(tf);
// Requires at least 1 blitter
if (Blitters.count == 0)
Quit_Msg("%s", Msg_Get(MSG_Blitters_Error_Not_Enough));
// Current blitter
if (Blitters.blitter_configuration_name != NULL)
Blitters.current = Blitters_FindBlitterByName(Blitters.blitter_configuration_name);
if (Blitters.current == NULL)
Blitters.current = (t_blitter*)Blitters.list->elem; // first
}
示例7: DB_Load
//-----------------------------------------------------------------------------
// DB_Load (const char *filename)
// Initialize and load given Meka DB file
//-----------------------------------------------------------------------------
void DB_Load (const char *filename)
{
t_tfile * tf;
t_list * lines;
char * line;
int line_cnt;
ConsolePrint (Msg_Get (MSG_DB_Loading));
// Open and read file
tf = tfile_read (filename);
if (tf == NULL)
{
ConsolePrintf ("%s\n", meka_strerror());
return;
}
// Ok
ConsolePrint ("\n");
// Parse each line
line_cnt = 0;
for (lines = tf->data_lines; lines; lines = lines->next)
{
line_cnt += 1;
line = lines->elem;
// Strip comments
// FIXME
// Trim spaces?
// FIXME
// Skip empty lines
//if (line[0] == EOSTR)
// continue;
if (DB_Load_Line (line) == 0)
{
tfile_free (tf);
Quit_Msg (Msg_Get (MSG_DB_SyntaxError), line_cnt);
}
}
// Free file data
tfile_free(tf);
// FIXME - Uncomment for counting progress of DB transition
//ConsolePrintf ("ENTRIES NEW = %d, OLD = %d\n", DB.entries_counter_format_new, DB.entries_counter_format_old);
//Quit();
}
示例8: CommandsCommonPrintHelpEntry
/* INFO: */
static int CommandsCommonPrintHelpEntry(const bool inpLongHelpFlag,
const char * const inpCommandString,
const char * const inpShortHelpString,
const char * const inpLongHelpString) {
if(inpLongHelpFlag) {
CHECK(ConsolePrint(COMMANDS_LONG_HELP_FORMATTER,
inpCommandString, inpShortHelpString,
inpLongHelpString));
} else {
CHECK(ConsolePrint(COMMANDS_SHORT_HELP_FORMATTER,
inpCommandString, inpShortHelpString));
}
return NO_ERROR;
}
示例9: DisplayPrintServiceHeader
/* INFO: */
static int DisplayPrintServiceHeader(
const StructuresDynamicService * const inpService,
const unsigned int inpServiceNumber,
const char inpServiceTreeVertical) {
CHECK(ConsolePrint(
DISPLAY_PRINT_SERVICE_HEADER_FORMAT_STRING,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_VERTICAL_FULL,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_HORIZONTAL_FULL,
DISPLAY_SERVICE_GROUP_STRING,
inpServiceNumber,
DISPLAY_TREE_HORIZONTAL_EMPTY,
inpServiceTreeVertical,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_VERTICAL_FULL));
CHECK(DisplayPrintServiceEntry(DISPLAY_SUBSCRIPTION_ID_STRING,
inpService->subscriptionId, inpServiceTreeVertical));
CHECK(DisplayPrintServiceEntry(DISPLAY_SERVICE_TYPE_STRING,
inpService->serviceType, inpServiceTreeVertical));
CHECK(DisplayPrintServiceEntry(DISPLAY_SERVICE_ID_STRING,
inpService->serviceId, inpServiceTreeVertical));
CHECK(DisplayPrintServiceEntry(DISPLAY_SCPDURL_STRING,
inpService->SCPDURL, inpServiceTreeVertical));
CHECK(DisplayPrintServiceEntry(DISPLAY_CONTROL_URL_STRING,
inpService->controlURL, inpServiceTreeVertical));
CHECK(DisplayPrintServiceEntry(DISPLAY_EVENT_SUB_URL_STRING,
inpService->eventSubURL, inpServiceTreeVertical));
return NO_ERROR;
}
示例10: Sound_Init_Engine
// Initialize Sound Engine ----------------------------------------------------
// FIXME: This is mostly legacy stuff :(
static int Sound_Init_Engine (int buffer_mode)
{
// Stream Buffer Mode
//STREAM_BUFFER_MAXA = DEF_STREAM_BUFFER_MAXA;
MODEB_FRAME_SIZE = DEF_MODEB_FRAME_SIZE;
MODEB_UPDATE_COUNT = DEF_MODEB_UPDATE_COUNT;
MODEB_ERROR_MAX = DEF_STREAM_UPDATE_ERROR_MAX;
STREAM_BUFFER_MAXB = MODEB_FRAME_SIZE;
MODEB_MASK = MODEB_FRAME_SIZE / MODEB_UPDATE_COUNT;
sound_stream_mode = buffer_mode; /* SOUND_STREAM_WAIT in MEKA */
//stream_buffer_max = (sound_stream_mode == SOUND_STREAM_NORMAL) ? STREAM_BUFFER_MAXA : STREAM_BUFFER_MAXB;
#ifdef INSTALL_SOUND_TIMER
buffered_stream_max = stream_buffer_max = 3; // audio_buffer_max_size
MODEB_UPDATE_COUNT = 1;
#else
stream_buffer_max = ((stream_buffer_max / 6) / MODEB_UPDATE_COUNT) * MODEB_UPDATE_COUNT;
// buffered_stream_max = stream_buffer_max; // audio_buffer_max_size
buffered_stream_max = MODEB_UPDATE_COUNT * 2; // audio_buffer_max_size
#endif
/**** timer work init ****/
sound_freerun_count = 0;
sound_slice = 0;
if (change_sample_rate)
{ // Sample rate has changed, so all emulators must be restarted!
change_sample_rate = FALSE;
saStopSoundEmulators();
}
ConsolePrint (" - SEAL: Ok\n"); // FIXME: should be a message ?
#ifdef INSTALL_SOUND_TIMER
saInitSoundTimer();
#endif
if (SndMachine != NULL)
{
if (!SndMachine->first)
{
int i;
SndMachine->first = 1; /* first flag clear */
streams_sh_start(); /* streaming system initialize & start */
pause_sound = 0; /* pause flag off */
vbover_err = vbunder_err = 0; /* error initial */
for (i = 0; i < SndMachine->control_max; i++)
{
if (SndMachine->f_init[i])
{
if (SndMachine->f_init[i] (SndMachine->userdata[i]) != MEKA_ERR_OK)
{
SndMachine = NULL;
return (MEKA_ERR_FAIL);
}
}
}
}
}
return (MEKA_ERR_OK);
}
示例11: DisplayPrintAllowedValueHeader
/* INFO: */
static int DisplayPrintAllowedValueHeader(
const StructuresDynamicAllowedValue * const inpAllowedValue,
const unsigned int inpAllowedValueNumber,
const char inpServiceTreeVertical,
const char inpAllowedValueTreeVertical) {
CHECK(ConsolePrint(
DISPLAY_PRINT_ALLOWED_VALUE_HEADER_FORMAT_STRING,
DISPLAY_TREE_HORIZONTAL_EMPTY,
inpServiceTreeVertical,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_VERTICAL_FULL,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_VERTICAL_FULL,
DISPLAY_TREE_HORIZONTAL_EMPTY,
inpServiceTreeVertical,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_VERTICAL_FULL,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_HORIZONTAL_FULL,
DISPLAY_ALLOWED_VALUE_GROUP_STRING,
inpAllowedValueNumber,
DISPLAY_TREE_HORIZONTAL_EMPTY,
inpServiceTreeVertical,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_VERTICAL_FULL,
DISPLAY_TREE_HORIZONTAL_EMPTY,
inpAllowedValueTreeVertical,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_VERTICAL_FULL));
CHECK(DisplayPrintAllowedValueEntry(DISPLAY_ALLOWED_VALUE_STRING,
inpAllowedValue->allowedValue, inpServiceTreeVertical,
inpAllowedValueTreeVertical));
return NO_ERROR;
}
示例12: CliAutocompletionApplySuggestion
/* INFO: */
static int CliAutocompletionApplySuggestion(char * const inpCommandBuffer,
const unsigned int inpCommandBufferSize,
unsigned int * const inpCommandSize,
unsigned int * const inpCommandBufferOffset,
const char * const inpSuggestion,
const unsigned int inpSuggestionSize) {
char * localCompletionBuffer = { 0 };
unsigned int localCompletionBufferSize = { 0 };
const char * localSuggestionTail = { 0 };
unsigned int localSuggestionTailSize = { 0 };
unsigned int localSuggestionOffset = { 0 };
localCompletionBuffer = inpCommandBuffer + (* inpCommandSize);
if((* inpCommandSize) >= inpCommandBufferSize) {
return ERROR;
}
localCompletionBufferSize = inpCommandBufferSize - (* inpCommandSize);
if(! localCompletionBufferSize) {
return ERROR;
}
if((* inpCommandBufferOffset) > (* inpCommandSize)) {
return ERROR;
}
localSuggestionOffset = (* inpCommandSize) -
(* inpCommandBufferOffset);
localSuggestionTail = inpSuggestion + localSuggestionOffset;
localSuggestionTailSize = inpSuggestionSize - localSuggestionOffset;
if(! localSuggestionTailSize) {
(* inpCommandBufferOffset) = (* inpCommandSize);
return NO_ERROR;
}
if(localSuggestionTailSize >= localCompletionBufferSize) {
(* inpCommandBufferOffset) = (* inpCommandSize);
return NO_ERROR;
}
memcpy(localCompletionBuffer, localSuggestionTail,
localSuggestionTailSize);
localCompletionBuffer[localSuggestionTailSize] = 0;
(* inpCommandSize) += localSuggestionTailSize;
CHECK(ConsolePrint(UTILS_SIMPLE_PRINT_FORMATTER,
localCompletionBuffer));
(* inpCommandBufferOffset) = (* inpCommandSize);
return NO_ERROR;
}
示例13: CliAutocompletionPrintPrimaryCommand
/* INFO: */
static int CliAutocompletionPrintPrimaryCommand(
char * const inpCommandBuffer) {
CHECK(ConsolePrint(UTILS_SIMPLE_PRINT_FORMATTER,
inpCommandBuffer));
return NO_ERROR;
}
示例14: DisplayPrintActionHeader
/* INFO: */
static int DisplayPrintActionHeader(
const StructuresDynamicAction * const inpAction,
const unsigned int inpActionNumber,
const char inpServiceTreeVertical) {
CHECK(ConsolePrint(
DISPLAY_PRINT_ACTION_HEADER_FORMAT_STRING,
DISPLAY_TREE_HORIZONTAL_EMPTY,
inpServiceTreeVertical,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_VERTICAL_FULL,
DISPLAY_TREE_HORIZONTAL_EMPTY,
inpServiceTreeVertical,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_HORIZONTAL_FULL,
DISPLAY_ACTION_GROUP_STRING,
inpActionNumber,
DISPLAY_TREE_HORIZONTAL_EMPTY,
inpServiceTreeVertical,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_VERTICAL_FULL,
DISPLAY_TREE_HORIZONTAL_EMPTY,
DISPLAY_TREE_VERTICAL_FULL));
CHECK(DisplayPrintActionEntry(DISPLAY_NAME_STRING, inpAction->name,
inpServiceTreeVertical));
return NO_ERROR;
}
示例15: ConsolePrint
void Log::LogPrint(LogType type, const char* msg)
{
if (config.logConsole)
ConsolePrint(type, msg);
if (config.logSyslog)
SyslogPrint(type, msg);
if (config.logFile)
FilePrint(type, msg);
}