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


C++ ConCommandBase::IsCommand方法代码示例

本文整理汇总了C++中ConCommandBase::IsCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ ConCommandBase::IsCommand方法的具体用法?C++ ConCommandBase::IsCommand怎么用?C++ ConCommandBase::IsCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConCommandBase的用法示例。


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

示例1: while

IEntityFactoryDictionary *EntityFactoryDictionary()
{
    if(g_entityFactoryDictionary)
        return g_entityFactoryDictionary;

    if ( g_nServerToolsVersion >= 2 )
    {
        g_entityFactoryDictionary = servertools->GetEntityFactoryDictionary();
        return g_entityFactoryDictionary;
    }

#ifdef WIN32
    ConCommandBase *pPtr = pAdminOP.GetCommands();
    while (pPtr)
    {
        if (pPtr->IsCommand() && strcmp(pPtr->GetName(), "dumpentityfactories") == 0)
        {
            ConCommand *ptr = (ConCommand*)pPtr;

            //CEntityFactoryDictionary *dict = ( CEntityFactoryDictionary * )*(int *)( ((char*)VFuncs::GetCommandCallback(ptr))+0x14 );
            CEntityFactoryDictionary *dict = VFuncs::GetEntityDictionary(ptr);
            if ( dict )
            {
                g_entityFactoryDictionary = dict;
                return dict;
            }
        }
        pPtr = const_cast<ConCommandBase*>(pPtr->GetNext());
    }
#else
    g_entityFactoryDictionary = VFuncs::GetEntityDictionary(NULL);
    return g_entityFactoryDictionary;
#endif
    return NULL;
}
开发者ID:kila58,项目名称:sourceop,代码行数:35,代码来源:util.cpp

示例2: HookConCommands

void CSourceMMMAP::HookConCommands()
{
	//find the commands in the server's CVAR list
#if defined (GAME_CSGO)
	pSayCmd = static_cast<ConCommand *>(g_pCVar->FindCommand("say"));
	pTeamSayCmd = static_cast<ConCommand *>(g_pCVar->FindCommand("say_team"));
	pChangeLevelCmd = static_cast<ConCommand *>(g_pCVar->FindCommand("changelevel"));
	pAutoBuyCmd = static_cast<ConCommand *>(g_pCVar->FindCommand("autobuy"));
	pReBuyCmd = static_cast<ConCommand *>(g_pCVar->FindCommand("rebuy"));
	pRespawnEntities = static_cast<ConCommand *>(g_pCVar->FindCommand("respawn_entities"));
#else
	ConCommandBase *pCmd = g_pCVar->GetCommands();
	while (pCmd)
	{
		if (pCmd->IsCommand())
		{
			if (strcmp(pCmd->GetName(), "say") == 0)
				pSayCmd = static_cast<ConCommand *>(pCmd);
			else if (strcmp(pCmd->GetName(), "say_team") == 0)
				pTeamSayCmd = static_cast<ConCommand *>(pCmd);
			else if (strcmp(pCmd->GetName(), "changelevel") == 0)
				pChangeLevelCmd = static_cast<ConCommand *>(pCmd);
			else if (strcmp(pCmd->GetName(), "autobuy") == 0)
				pAutoBuyCmd = static_cast<ConCommand *>(pCmd);
			else if (strcmp(pCmd->GetName(), "rebuy") == 0)
				pReBuyCmd = static_cast<ConCommand *>(pCmd);
			else if (strcmp(pCmd->GetName(), "respawn_entities") == 0)
				pRespawnEntities = static_cast<ConCommand *>(pCmd);
		}

		pCmd = const_cast<ConCommandBase *>(pCmd->GetNext());
	}
#endif 

#if !defined GAME_ORANGE && defined SOURCEMM
	if (pSayCmd) SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pSayCmd, Say_handler, false);
	if (pRespawnEntities) SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pRespawnEntities, RespawnEntities_handler, false);
	if (pTeamSayCmd) SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pTeamSayCmd, TeamSay_handler, false);
	if (pChangeLevelCmd) SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pChangeLevelCmd, ChangeLevel_handler, false);
	if (pAutoBuyCmd) 
	{
		SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pAutoBuyCmd, AutoBuy_handler, false);
		autobuy_cc = SH_GET_CALLCLASS(pAutoBuyCmd);
	}

	if (pReBuyCmd) 
	{
		SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pReBuyCmd, ReBuy_handler, false);
		rebuy_cc = SH_GET_CALLCLASS(pReBuyCmd);
	}
#else
	if (pSayCmd) SH_ADD_HOOK(ConCommand, Dispatch, pSayCmd, SH_STATIC(Say_handler), false);
	if (pRespawnEntities) SH_ADD_HOOK(ConCommand, Dispatch, pRespawnEntities, SH_STATIC(RespawnEntities_handler), false);
	if (pTeamSayCmd) SH_ADD_HOOK(ConCommand, Dispatch, pTeamSayCmd, SH_STATIC(TeamSay_handler), false);
	if (pChangeLevelCmd) SH_ADD_HOOK(ConCommand, Dispatch, pChangeLevelCmd, SH_STATIC(ChangeLevel_handler), false);
	if (pAutoBuyCmd) SH_ADD_HOOK(ConCommand, Dispatch, pAutoBuyCmd, SH_STATIC(AutoBuy_handler), false);
	if (pReBuyCmd) SH_ADD_HOOK(ConCommand, Dispatch, pReBuyCmd, SH_STATIC(ReBuy_handler), false);
#endif
}
开发者ID:gunslinger23,项目名称:maniadminplugin,代码行数:59,代码来源:mani_callback_sourcemm.cpp

示例3: RevertAll

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void ConVar::RevertAll( void )
{
	ConCommandBase *p = s_pConCommandBases;
	while ( p  )
	{
		if ( !p->IsCommand() )
		{
			ConVar *var = ( ConVar * )p;
			var->Revert();
		}
		p = p->m_pNext;
	}
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:16,代码来源:convar.cpp

示例4: if

void	ManiSMMHooks::HookConCommands()
{
	//find the commands in the server's CVAR list
#if defined (GAME_CSGO)
	pSayCmd = static_cast<ConCommand *>(g_pCVar->FindCommand("say"));
	pTeamSayCmd = static_cast<ConCommand *>(g_pCVar->FindCommand("say_team"));
	pChangeLevelCmd = static_cast<ConCommand *>(g_pCVar->FindCommand("changelevel"));
	pAutoBuyCmd = static_cast<ConCommand *>(g_pCVar->FindCommand("autobuy"));
	pReBuyCmd = static_cast<ConCommand *>(g_pCVar->FindCommand("rebuy"));
	pRespawnEntities = static_cast<ConCommand *>(g_pCVar->FindCommand("respawn_entities"));
#else
	ConCommandBase *pCmd = NULL;
	pCmd = g_pCVar->GetCommands();

	while (pCmd)
	{
		if (pCmd->IsCommand())
		{
			if (strcmp(pCmd->GetName(), "say") == 0)
				pSayCmd = static_cast<ConCommand *>(pCmd);
			else if (strcmp(pCmd->GetName(), "say_team") == 0)
				pTeamSayCmd = static_cast<ConCommand *>(pCmd);
			else if (strcmp(pCmd->GetName(), "changelevel") == 0)
				pChangeLevelCmd = static_cast<ConCommand *>(pCmd);
			else if (strcmp(pCmd->GetName(), "autobuy") == 0)
				pAutoBuyCmd = static_cast<ConCommand *>(pCmd);
			else if (strcmp(pCmd->GetName(), "rebuy") == 0)
				pReBuyCmd = static_cast<ConCommand *>(pCmd);
			else if (strcmp(pCmd->GetName(), "respawn_entities") == 0)
				pRespawnEntities = static_cast<ConCommand *>(pCmd);
		}

		pCmd = const_cast<ConCommandBase *>(pCmd->GetNext());
	}
#endif
	if (pSayCmd) SH_ADD_HOOK(ConCommand, Dispatch, pSayCmd, SH_STATIC(Say_handler), false);
	if (pRespawnEntities) SH_ADD_HOOK(ConCommand, Dispatch, pRespawnEntities, SH_STATIC(RespawnEntities_handler), false);
	if (pTeamSayCmd) SH_ADD_HOOK(ConCommand, Dispatch, pTeamSayCmd, SH_STATIC(TeamSay_handler), false);
	if (pChangeLevelCmd) SH_ADD_HOOK(ConCommand, Dispatch, pChangeLevelCmd, SH_STATIC(ChangeLevel_handler), false);
	if (pAutoBuyCmd) SH_ADD_HOOK(ConCommand, Dispatch, pAutoBuyCmd, SH_STATIC(AutoBuy_handler), false);
	if (pReBuyCmd) SH_ADD_HOOK(ConCommand, Dispatch, pReBuyCmd, SH_STATIC(ReBuy_handler), false);
}
开发者ID:gunslinger23,项目名称:maniadminplugin,代码行数:42,代码来源:mani_sourcehook.cpp

示例5: OnSourceModGameInitialized

void ChatTriggers::OnSourceModGameInitialized()
{
	unsigned int total = 2;
	ConCommandBase *pCmd = icvar->GetCommands();
	const char *name;
	while (pCmd)
	{
		if (pCmd->IsCommand())
		{
			name = pCmd->GetName();
			if (!m_pSayCmd && strcmp(name, "say") == 0)
			{
				m_pSayCmd = (ConCommand *)pCmd;
				if (--total == 0)
				{
					break;
				}
			} else if (!m_pSayTeamCmd && strcmp(name, "say_team") == 0) {
				m_pSayTeamCmd = (ConCommand *)pCmd;
				if (--total == 0)
				{
					break;
				}
			}
		}
		pCmd = const_cast<ConCommandBase *>(pCmd->GetNext());
	}

	if (m_pSayCmd)
	{
		SH_ADD_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayCmd, this, &ChatTriggers::OnSayCommand_Pre, false);
		SH_ADD_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayCmd, this, &ChatTriggers::OnSayCommand_Post, true);
	}
	if (m_pSayTeamCmd)
	{
		SH_ADD_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayTeamCmd, this, &ChatTriggers::OnSayCommand_Pre, false);
		SH_ADD_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayTeamCmd, this, &ChatTriggers::OnSayCommand_Post, true);
	}
}
开发者ID:Nephyrin,项目名称:-furry-octo-nemesis,代码行数:39,代码来源:ChatTriggers.cpp

示例6: Load


//.........这里部分代码省略.........
			{
				SendTable *st = svrclass->m_pTable;
				for (int i = 0; i < st->m_nProps; i++)
				{
					SendProp *sp = st->GetProp(i);
					const char *propname = sp->GetName();
					Msg("Prop name: %s | Prop Offset: %d | Type: %d | IsSigned: %d\n", propname, sp->GetOffset(), sp->GetType(), sp->IsSigned());
				}
			}*/
			svrclass = svrclass->m_pNext;
		}
	}
	else
	{
		Warning("Unable to load IServerGameDLL.\n");
		return false;
	}

	serverGameEnts = (IServerGameEnts *)gameServerFactory(INTERFACEVERSION_SERVERGAMEENTS, NULL);
	if (!serverGameEnts)
	{
		Warning("Unable to load IServerGameEnts.\n");
		return false;
	}

	playerInfoManager = (IPlayerInfoManager *)gameServerFactory(INTERFACEVERSION_PLAYERINFOMANAGER, NULL);
	if (playerInfoManager)
	{
		globalVars = playerInfoManager->GetGlobalVars();
	}
	else
	{
		Warning("Unable to load IPlayerInfoManager.\n");
		return false;
	}
	
	g_pCVar = (ICvar *)interfaceFactory(CVAR_INTERFACE_VERSION, NULL);
	if (g_pCVar)
	{
		ICvar::Iterator iter(g_pCVar);
		for (iter.SetFirst(); iter.IsValid(); iter.Next())
		{
			ConCommandBase *cmd = iter.Get();
			if (cmd->IsCommand())
				continue;
			const char *cmdname = cmd->GetName();
			ConVar *cvar = (ConVar *)cmd;
			if (strcmp(cmdname, "net_maxcleartime") == 0)
				cvar->SetValue(0.001f);

			/*if (strcmp(cmdname, "net_minroutable") == 0)
				cvar->SetValue(1000);*/
		}
	}
	else
	{
		Warning("Unable to load ICVar.\n");
		return false;
	}
	
	gameEventManager2 = (IGameEventManager2 *)interfaceFactory(INTERFACEVERSION_GAMEEVENTSMANAGER2, NULL);
	if (!gameEventManager2)
	{
		Warning("Unable to load IGameEventManager2.\n");
		return false;
	}

	vEngineServer = (IVEngineServer *)interfaceFactory(INTERFACEVERSION_VENGINESERVER, NULL);
	if (!vEngineServer)
	{
		Warning("Unable to load IVEngineServer.\n");
		return false;
	}

	serverTools = (IServerTools *)gameServerFactory(VSERVERTOOLS_INTERFACE_VERSION, NULL);
	if (!serverTools)
	{
		Warning("Unable to load IServerTools.\n");
		return false;
	}

	serverPluginHelpers = (IServerPluginHelpers *)interfaceFactory(INTERFACEVERSION_ISERVERPLUGINHELPERS, NULL);
	if (!serverPluginHelpers)
	{
		Warning("Unable to load IServerPluginHelpers.\n");
		return false;
	}

	//playerDeathEvent = new PlayerDeathEvent();
	//playerSayEvent = new PlayerSayEvent();
	//playerConnectEvent = new PlayerConnectEvent();
	//playerDisconnectEvent = new PlayerDisconnectEvent();
	roundStartEvent = new RoundStartEvent();
	//itemPickupEvent = new ItemPickupEvent();
	//playerSpawnEvent = new PlayerSpawnEvent();
	//playerSpawnedEvent = new PlayerSpawnedEvent();
	//announphaseendevent = new AnnouncePhaseEndEvent();

	return true;
}
开发者ID:hungnmcoder,项目名称:csgoplugin,代码行数:101,代码来源:myplugin.cpp

示例7: Fixup

bool ConCommandBaseMgr::Fixup(ConCommandBase* pConCommand)
{
	ConCommandBase	*pCur;
	ConCommandBase	*pPrev2;
	ConCommandBase	*pCur2;
	ConCommandBase	*pNext2;
	const char		*name;
	static int		initCount = 0;

	// xboxissue - cvars and its class hierarchy could not be made to instance per subsystem
	// without massive mangling and re-arranging, instead...
	// there is only a single chain and therefore single /init/fixup
	// missing: need to identify which subsystem
	// could pass as part of declaration in constructor, but how to hide parameter for pc
	// the accessors (aka callbacks to subsystems) to register with engine 
	// cannot be invoked as their unlink logic expect private lists
	// so this just mimics the expected end result
	// must handle early and late constructors
	// late constructors are usually function scoped static
	if (!pConCommand)
	{
		// the caller is one-time-init 
		if (++initCount > 1)
		{
			// the list has already been fixed
			return true;
		}
	}
	else
	{
		// the caller is a console command constructor
		if (!initCount)
		{
			// the list has not been fixed yet 
			// no special behavior
			return false;
		}
		else
		{
			// the list has already been fixed
			// the console command is a late constructor
			// add in to fixed list 
			bool hasParent = false;
			if (!pConCommand->IsCommand())
			{
				pCur  = ConCommandBase::s_pConCommandBases;
				while (pCur)
				{
					if (pCur->IsCommand() && !stricmp(pCur->m_pszName, pConCommand->m_pszName))
					{
						// set its parent
						((ConVar*)pConCommand)->m_pParent = ((ConVar*)pCur)->m_pParent;
						hasParent = true;
						break;
					}
					pCur = pCur->m_pNext;
				}
			}
			if (!hasParent)
			{
				// add to head of list
				pConCommand->m_pNext = ConCommandBase::s_pConCommandBases;
				ConCommandBase::s_pConCommandBases = pConCommand;
			}
			else
				return true;
		}
	}

	if (initCount == 1)
	{
		// iterate the cvars and set their possible proxy parents
		// skip over registered (fixed) entries
		pCur = ConCommandBase::s_pConCommandBases;
		while (pCur)
		{
			if (!pCur->IsCommand() && !pCur->m_bRegistered)
			{
				// iterate from the next node until end of list
				name   = pCur->m_pszName; 
				pPrev2 = pCur;		
				pCur2  = pCur->m_pNext;
				while (pCur2)
				{
					pNext2 = pCur2->m_pNext;
					if (!pCur2->IsCommand() && !stricmp(pCur2->m_pszName, name))
					{
						// found duplicate
						// unlink and fixup
						pCur2->m_pNext  = NULL;
						pPrev2->m_pNext = pNext2;

						// set its parent
						((ConVar*)pCur2)->m_pParent = ((ConVar*)pCur)->m_pParent;
					}
					else
					{
						// no unlink, advance to next node
						pPrev2 = pCur2;
					}
//.........这里部分代码省略.........
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:101,代码来源:convar.cpp


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