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


C++ Q_strcmp函数代码示例

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


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

示例1: SetTarget

void C_Camera::SpecTargetByName(const char *name)
{
	if (!Q_stricmp(name, "ball"))
	{
		if (GetMatchBall())
		{
			SetTarget(GetMatchBall()->entindex());
		}
	}
	else
	{
		for (int i = 1; i <= gpGlobals->maxClients; i++)
		{
			C_BasePlayer *pPlayer =	UTIL_PlayerByIndex(i);

			if (!pPlayer || Q_strcmp(name, pPlayer->GetPlayerName()))
				continue;

			SetTarget(i);
			break;
		}
	}
}
开发者ID:rain2372,项目名称:IOS-1,代码行数:23,代码来源:ios_camera.cpp

示例2: V_StripExtension

void CASW_Mission_Chooser_Source_Local::OnSaveUpdated(const char *szSaveName)
{
	// if we haven't started scanning for saves yet, don't worry about it
	if (!m_bBuiltSavedCampaignList && !m_bBuildingSavedCampaignList)
		return;

	// make sure it has the campaignsave extension
	char stripped[256];
	V_StripExtension(szSaveName, stripped, sizeof(stripped));
	char szWithExtension[256];
	Q_snprintf(szWithExtension, sizeof(szWithExtension), "%s.campaignsave", stripped);
	// check it's not already in the saved list
	for (int i=0;i<m_SavedCampaignList.Count();i++)
	{
		if (!Q_strcmp(m_SavedCampaignList[i].m_szSaveName, szWithExtension))
		{
			m_SavedCampaignList.Remove(i);
			break;
		}
	}
	Msg("Updating save game summary %s\n", szSaveName);
	AddToSavedCampaignList(szWithExtension);
}
开发者ID:Randdalf,项目名称:bliink,代码行数:23,代码来源:asw_mission_chooser_source_local.cpp

示例3: while

/*
===============
Info_ValueForKey

Searches the string for the given
key and returns the associated value, or an empty string.
===============
*/
char *Info_ValueForKey( const char *s, const char *key )
{
	char	pkey[MAX_INFO_STRING];
	static	char value[2][MAX_INFO_STRING]; // use two buffers so compares work without stomping on each other
	static	int valueindex;
	char	*o;
	
	valueindex ^= 1;
	if( *s == '\\' ) s++;

	while( 1 )
	{
		o = pkey;
		while( *s != '\\' && *s != '\n' )
		{
			if( !*s ) return "";
			*o++ = *s++;
		}

		*o = 0;
		s++;

		o = value[valueindex];

		while( *s != '\\' && *s != '\n' && *s )
		{
			if( !*s ) return "";
			*o++ = *s++;
		}
		*o = 0;

		if( !Q_strcmp( key, pkey ))
			return value[valueindex];
		if( !*s ) return "";
		s++;
	}
}
开发者ID:DavidKnight247,项目名称:xash3d,代码行数:45,代码来源:infostring.c

示例4: Assert

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CMaterialModifyProxy::OnBindSetVar( C_MaterialModifyControl *pControl )
{
	IMaterial *pMaterial = pControl->GetMaterial();
	if( !pMaterial )
	{
		Assert( 0 );
		return;
	}

	if ( pMaterial != m_pMaterial )
	{
//		Warning( "\t%s!=%s\n", pMaterial->GetName(), m_pMaterial->GetName() );
		return;
	}

	bool bFound;
	IMaterialVar *pMaterialVar = pMaterial->FindVar( pControl->GetMaterialVariableName(), &bFound, false );
	if ( !bFound )
		return;

	if( Q_strcmp( pControl->GetMaterialVariableValue(), "" ) )
	{
//		const char *pMaterialName = m_pMaterial->GetName();
//		const char *pMaterialVarName = pMaterialVar->GetName();
//		const char *pMaterialVarValue = pControl->GetMaterialVariableValue();
//		if( debug_materialmodifycontrol_client.GetBool() 
//			&& Q_stristr( m_pMaterial->GetName(), "faceandhair" )
//			&& Q_stristr( pMaterialVar->GetName(), "self" )
//			)
//		{
//			static int count = 0;
//			DevMsg( 1, "CMaterialModifyProxy::OnBindSetVar \"%s\" %s=%s %d pControl=0x%p\n", 
//				m_pMaterial->GetName(), pMaterialVar->GetName(), pControl->GetMaterialVariableValue(), count++, pControl );
//		}
		pMaterialVar->SetValueAutodetectType( pControl->GetMaterialVariableValue() );
	}
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:40,代码来源:C_MaterialModifyControl.cpp

示例5: NET_Stats_f

void NET_Stats_f(void)
{
    qsocket_t *s;

    if (Cmd_Argc() == 1) {
	Con_Printf("unreliable messages sent   = %i\n",
		   unreliableMessagesSent);
	Con_Printf("unreliable messages recv   = %i\n",
		   unreliableMessagesReceived);
	Con_Printf("reliable messages sent     = %i\n", messagesSent);
	Con_Printf("reliable messages received = %i\n", messagesReceived);
	Con_Printf("packetsSent                = %i\n", packetsSent);
	Con_Printf("packetsReSent              = %i\n", packetsReSent);
	Con_Printf("packetsReceived            = %i\n", packetsReceived);
	Con_Printf("receivedDuplicateCount     = %i\n",
		   receivedDuplicateCount);
	Con_Printf("shortPacketCount           = %i\n", shortPacketCount);
	Con_Printf("droppedDatagrams           = %i\n", droppedDatagrams);
    } else if (Q_strcmp(Cmd_Argv(1), "*") == 0) {
	for (s = net_activeSockets; s; s = s->next)
	    PrintStats(s);
	for (s = net_freeSockets; s; s = s->next)
	    PrintStats(s);
    } else {
	for (s = net_activeSockets; s; s = s->next)
	    if (Q_strcasecmp(Cmd_Argv(1), s->address) == 0)
		break;
	if (s == NULL)
	    for (s = net_freeSockets; s; s = s->next)
		if (Q_strcasecmp(Cmd_Argv(1), s->address) == 0)
		    break;
	if (s == NULL)
	    return;
	PrintStats(s);
    }
}
开发者ID:indev,项目名称:asquake,代码行数:36,代码来源:net_dgrm.c

示例6: Q_strcpy

//-----------------------------------------------------------------------------
// 
//-----------------------------------------------------------------------------
void CBindPanel::DrawBindingName()
{
	int iconWide = m_iIconTall * m_fWidthScale * m_fScale;

	int x = (iconWide>>1);
	int y = ( m_iIconTall * m_fScale ) * 0.5f;

	if ( !m_bController && !IsConsole() )
	{
		// Draw the caption
		vgui::surface()->DrawSetTextFont( m_hKeysFont );
		int fontTall = vgui::surface()->GetFontTall( m_hKeysFont );

		char szBinding[ 256 ];
		Q_strcpy( szBinding, m_szKey );

		if ( Q_strcmp( szBinding, "SEMICOLON" ) == 0 )
		{
			Q_strcpy( szBinding, ";" );
		}
		else if ( Q_strlen( szBinding ) == 1 && szBinding[ 0 ] >= 'a' && szBinding[ 0 ] <= 'z' )
		{
			// Make single letters uppercase
			szBinding[ 0 ] += ( 'A' - 'a' );
		}

		wchar wszCaption[ 64 ];
		g_pVGuiLocalize->ConstructString( wszCaption, sizeof(wchar)*64, szBinding, NULL );

		int iWidth = GetScreenWidthForCaption( wszCaption, m_hKeysFont );

		// Draw black text
		vgui::surface()->DrawSetTextColor( 0,0,0, 255 );
		vgui::surface()->DrawSetTextPos( x - (iWidth>>1) - 1, y - (fontTall >>1) - 1 );
		vgui::surface()->DrawUnicodeString( wszCaption );
	}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:39,代码来源:vgui_bindpanel.cpp

示例7: Assert

bool CHLTVDirector::StartCameraManShot()
{
	Assert( m_nNextShotTick <= m_nBroadcastTick );

	int index = FindFirstEvent( m_nNextShotTick );

	// check for cameraman mode
	while( index != m_EventHistory.InvalidIndex() )
	{
		CGameEvent &dc = m_EventHistory[index];

		// only check if this is the current tick
		if ( dc.m_Tick > m_nBroadcastTick )
			break; 

		if ( Q_strcmp( dc.m_Event->GetName(), "hltv_cameraman") == 0 )
		{
			if ( dc.m_Event->GetInt("index") > 0 )
			{
				// ok, this guy is now the active camera man
				m_iCameraMan = dc.m_Event->GetInt("index");

				m_iPVSEntity = m_iCameraMan;
				m_nNextShotTick = m_nBroadcastTick+1; // check setting right on next frame

				// send camera man command to client
				m_pHLTVServer->BroadcastEvent( dc.m_Event );
				return true;
			}
		}

		index = m_EventHistory.NextInorder( index );
	}

	return false;	// no camera man found
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:36,代码来源:hltvdirector.cpp

示例8: VID_EnumerateInstances

uint VID_EnumerateInstances( void )
{
	num_instances = 0;

#ifdef _WIN32
	if( EnumWindows( &pfnEnumWnd, 0 ))
		return num_instances;
#else
#ifdef XASH_X11
	Display* display = XOpenDisplay(NULL);
	Window* winlist;
	char* name;
	unsigned long len;
	int i;

	if(!display)
	{
		MsgDev(D_ERROR, "Lol, no displays? Returning 1 instance.\n");
		return 1;
	}

	if( !(winlist = NetClientList(display, &len)) ) return 1;

	for(i = 0; i < len; i++)
	{
		if( !(name = WindowClassName(display, winlist[i])) ) continue;
		if( !Q_strcmp( name, WINDOW_NAME ) )
			num_instances++;
		free(name);
	}

	XFree(winlist);
#endif
#endif
	return 1;
}
开发者ID:DeadZoneLuna,项目名称:xash3d,代码行数:36,代码来源:gl_vidnt.c

示例9: RecursiveMergeKeyValues

void KeyValues::RecursiveMergeKeyValues(KeyValues *baseKV)
{
	for (KeyValues *baseChild = baseKV->m_pSub; baseChild != NULL; baseChild = baseChild->m_pPeer)
	{
		bool bFoundMatch = false;

		for (KeyValues *newChild = m_pSub; newChild != NULL; newChild = newChild->m_pPeer)
		{
			if (!Q_strcmp(baseChild->GetName(), newChild->GetName()))
			{
				newChild->RecursiveMergeKeyValues(baseChild);
				bFoundMatch = true;
				break;
			}
		}

		if (!bFoundMatch)
		{
			KeyValues *dat = baseChild->MakeCopy();
			Assert(dat);
			AddSubKey(dat);
		}
	}
}
开发者ID:hzqst,项目名称:CaptionMod,代码行数:24,代码来源:KeyValues.cpp

示例10: ReadCheatCommandsFromFile

void ReadCheatCommandsFromFile( char *pchFileName )
{
	KeyValues *pCheatCodeKeys = new KeyValues( "cheat_codes" );
	pCheatCodeKeys->LoadFromFile( g_pFullFileSystem, pchFileName, NULL );

	KeyValues *pKey = NULL;
	for ( pKey = pCheatCodeKeys->GetFirstTrueSubKey(); pKey; pKey = pKey->GetNextTrueSubKey() )
	{
		int iCheat = s_CheatCodeCommands.AddToTail();
		CheatCodeData_t *pNewCheatCode = &(s_CheatCodeCommands[ iCheat ]);

		Q_strncpy( pNewCheatCode->szName, pKey->GetName(), CHEAT_NAME_MAX_LEN );	// Get the name
		pNewCheatCode->bDevOnly = ( pKey->GetInt( "dev", 0 ) != 0 );				// Get developer only flag
		pNewCheatCode->iCodeLength = 0;												// Start at zero code elements
		Q_strncpy( pNewCheatCode->szCommand, pKey->GetString( "command", "echo \"Cheat code has no command!\"" ), CHEAT_COMMAND_MAX_LEN );

		KeyValues *pSubKey = NULL;
		for ( pSubKey = pKey->GetFirstSubKey(); pSubKey; pSubKey = pSubKey->GetNextKey() )
		{
			const char *pchType = pSubKey->GetName();
			if ( Q_strcmp( pchType, "code" ) == 0 )
			{
				AssertMsg( ( pNewCheatCode->iCodeLength < CHEAT_NAME_MAX_LEN ), "Cheat code elements exceeded max!" );

				pNewCheatCode->pButtonCodes[ pNewCheatCode->iCodeLength ] = g_pInputSystem->StringToButtonCode( pSubKey->GetString() );
				++pNewCheatCode->iCodeLength;
			}
		}

		if ( pNewCheatCode->iCodeLength < CHEAT_NAME_MAX_LEN )
		{
			// If it's activation is a subsequence of another cheat, the longer cheat can't be activated!
			DevWarning( "Cheat code \"%s\" has less than %i code elements!", pKey->GetName(), CHEAT_NAME_MAX_LEN );
		}
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:36,代码来源:cheatcodes.cpp

示例11: GetVarMapping

void C_HL2MPRagdoll::Interp_Copy( C_BaseAnimatingOverlay *pSourceEntity )
{
	if ( !pSourceEntity )
		return;
	
	VarMapping_t *pSrc = pSourceEntity->GetVarMapping();
	VarMapping_t *pDest = GetVarMapping();
    	
	// Find all the VarMapEntry_t's that represent the same variable.
	for ( int i = 0; i < pDest->m_Entries.Count(); i++ )
	{
		VarMapEntry_t *pDestEntry = &pDest->m_Entries[i];
		const char *pszName = pDestEntry->watcher->GetDebugName();
		for ( int j=0; j < pSrc->m_Entries.Count(); j++ )
		{
			VarMapEntry_t *pSrcEntry = &pSrc->m_Entries[j];
			if ( !Q_strcmp( pSrcEntry->watcher->GetDebugName(), pszName ) )
			{
				pDestEntry->watcher->Copy( pSrcEntry->watcher );
				break;
			}
		}
	}
}
开发者ID:uunx,项目名称:quakelife2,代码行数:24,代码来源:c_hl2mp_player.cpp

示例12: printf

void GameRulesHelper::OnServerActivated()
{
	
	printf("Doin stuf\n");
	m_pGameRulesProxy = UTIL_FindEntityByClassname(nullptr, "dota_gamerules");
	m_pGameManagerProxy = UTIL_FindEntityByClassname(nullptr, "dota_gamemanager");

	auto *pSendTable = ((IServerUnknown *) m_pGameRulesProxy)->GetNetworkable()->GetServerClass()->m_pTable;
	auto *pManagerSendTable = ((IServerUnknown *)m_pGameManagerProxy)->GetNetworkable()->GetServerClass()->m_pTable;

	if (!s_bHaveOffsets)
	{
		m_Offsets.m_nSeriesType = UTIL_FindInSendTable(pSendTable, "m_nSeriesType");
		m_Offsets.m_nRadiantSeriesWins = UTIL_FindInSendTable(pSendTable, "m_nRadiantSeriesWins");
		m_Offsets.m_nDireSeriesWins = UTIL_FindInSendTable(pSendTable, "m_nDireSeriesWins");
		m_Offsets.m_nGameState = UTIL_FindInSendTable(pSendTable, "m_nGameState");
		m_Offsets.m_fGameTime = UTIL_FindInSendTable(pSendTable, "m_fGameTime");
		m_Offsets.m_nGGTeam = UTIL_FindInSendTable(pSendTable, "m_nGGTeam");
		m_Offsets.m_flGGEndsAtTime = UTIL_FindInSendTable(pSendTable, "m_flGGEndsAtTime");
		m_Offsets.m_iGameMode = UTIL_FindInSendTable(pSendTable, "m_iGameMode");
		m_Offsets.m_bGamePaused = UTIL_FindInSendTable(pSendTable, "m_bGamePaused");
		m_Offsets.m_iPauseTeam = UTIL_FindInSendTable(pSendTable, "m_iPauseTeam");
		m_Offsets.m_StableHeroAvailable = UTIL_FindInSendTable(pManagerSendTable, "m_StableHeroAvailable");
		m_Offsets.m_CurrentHeroAvailable = UTIL_FindInSendTable(pManagerSendTable, "m_CurrentHeroAvailable");
		m_Offsets.m_CulledHeroes = UTIL_FindInSendTable(pManagerSendTable, "m_CulledHeroes");

		s_bHaveOffsets = true;
	}

	m_pGameRules = nullptr;
	m_pGameManager = nullptr;

	for (int i = 0; i < pSendTable->GetNumProps(); i++)
	{
		auto pProp = pSendTable->GetProp(i);

		if (pProp->GetDataTable() && !Q_strcmp("dota_gamerules_data", pProp->GetName()))
		{
			auto proxyFn = pProp->GetDataTableProxyFn();
			if (proxyFn)
			{
				CSendProxyRecipients recp;
				m_pGameRules = proxyFn(NULL, NULL, NULL, &recp, 0);
			}

			break;
		}
	}

	for (int i = 0; i < pManagerSendTable->GetNumProps(); i++)
	{
		auto pProp = pManagerSendTable->GetProp(i);

		if (pProp->GetDataTable() && !Q_strcmp("dota_gamemanager_data", pProp->GetName()))
		{
			auto proxyFn = pProp->GetDataTableProxyFn();

			if (proxyFn)
			{
				CSendProxyRecipients recp;
				m_pGameManager = proxyFn(NULL, NULL, NULL, &recp, 0);
				printf("Manager name: %d\n", m_pGameManager);
			}

			break;
		}
	}

	const char *pszBannedHeroes = CommandLine()->ParmValue("-d2bannedheroes", "");
	if (pszBannedHeroes && pszBannedHeroes[0])
	{
		V_SplitString(pszBannedHeroes, ",", bannedHeroes);
	}

	BanThem();
}
开发者ID:psychonic,项目名称:d2lobby,代码行数:76,代码来源:gameruleshelper.cpp

示例13: CONSOLE_ECHO

// Load the bot profile database
void BotProfileManager::Init(const char *filename, unsigned int *checksum)
{
	static const char *BotDifficultyName[] = { "EASY", "NORMAL", "HARD", "EXPERT", nullptr };

	int dataLength;
	char *dataPointer = (char *)LOAD_FILE_FOR_ME(const_cast<char *>(filename), &dataLength);
	char *dataFile = dataPointer;

	if (!dataFile)
	{
		if (AreBotsAllowed())
		{
			CONSOLE_ECHO("WARNING: Cannot access bot profile database '%s'\n", filename);
		}

		return;
	}

	// compute simple checksum
	if (checksum)
	{
		*checksum = ComputeSimpleChecksum((const unsigned char *)dataPointer, dataLength);
	}

	// keep list of templates used for inheritance
	BotProfileList templateList;
	BotProfile defaultProfile;

	// Parse the BotProfile.db into BotProfile instances
	while (true)
	{
		dataFile = SharedParse(dataFile);
		if (!dataFile)
			break;

		char *token = SharedGetToken();

		bool isDefault = (!Q_stricmp(token, "Default"));
		bool isTemplate = (!Q_stricmp(token, "Template"));
		bool isCustomSkin = (!Q_stricmp(token, "Skin"));

		if (isCustomSkin)
		{
			const int BufLen = 64;
			char skinName[BufLen];

			// get skin name
			dataFile = SharedParse(dataFile);
			if (!dataFile)
			{
				CONSOLE_ECHO("Error parsing %s - expected skin name\n", filename);
				FREE_FILE(dataPointer);
				return;
			}

			token = SharedGetToken();
			Q_snprintf(skinName, BufLen, "%s", token);

			// get attribute name
			dataFile = SharedParse(dataFile);
			if (!dataFile)
			{
				CONSOLE_ECHO("Error parsing %s - expected 'Model'\n", filename);
				FREE_FILE(dataPointer);
				return;
			}

			token = SharedGetToken();
			if (Q_stricmp(token, "Model") != 0)
			{
				CONSOLE_ECHO("Error parsing %s - expected 'Model'\n", filename);
				FREE_FILE(dataPointer);
				return;
			}

			// eat '='
			dataFile = SharedParse(dataFile);
			if (!dataFile)
			{
				CONSOLE_ECHO("Error parsing %s - expected '='\n", filename);
				FREE_FILE(dataPointer);
				return;
			}

			token = SharedGetToken();
			if (Q_strcmp(token, "=") != 0)
			{
				CONSOLE_ECHO("Error parsing %s - expected '='\n", filename);
				FREE_FILE(dataPointer);
				return;
			}

			// get attribute value
			dataFile = SharedParse(dataFile);
			if (!dataFile)
			{
				CONSOLE_ECHO("Error parsing %s - expected attribute value\n", filename);
				FREE_FILE(dataPointer);
				return;
//.........这里部分代码省略.........
开发者ID:s1lentq,项目名称:ReGameDLL_CS,代码行数:101,代码来源:bot_profile.cpp

示例14: FStruEq

inline bool FStruEq(const char *sz1, const char *sz2)
{
	return(Q_strcmp(sz1, sz2) == 0);
}
开发者ID:imyzcn,项目名称:mani-admin-plugin,代码行数:4,代码来源:mani_log_css_stats.cpp

示例15: StrLess

static bool StrLess( const char * const &pszLeft, const char * const &pszRight )
{
	return ( Q_strcmp( pszLeft, pszRight) < 0 );
}
开发者ID:FWGS,项目名称:XashXT,代码行数:4,代码来源:strings.cpp


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