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


C++ IServerUnknown类代码示例

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


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

示例1: FirstEntInfo

CBaseEntity *CGlobalEntityList::NextEnt( CBaseEntity *pCurrentEnt ) 
{ 
	if ( !pCurrentEnt )
	{
		const CEntInfo *pInfo = FirstEntInfo();
		if ( !pInfo )
			return NULL;

		return (CBaseEntity *)pInfo->m_pEntity;
	}

	// Run through the list until we get a CBaseEntity.
	const CEntInfo *pList = GetEntInfoPtr( pCurrentEnt->GetRefEHandle() );
	if ( pList )
		pList = NextEntInfo(pList);

	while ( pList )
	{
#if 0
		if ( pList->m_pEntity )
		{
			IServerUnknown *pUnk = static_cast<IServerUnknown*>(const_cast<IHandleEntity*>(pList->m_pEntity));
			CBaseEntity *pRet = pUnk->GetBaseEntity();
			if ( pRet )
				return pRet;
		}
#else
		return (CBaseEntity *)pList->m_pEntity;
#endif
		pList = pList->m_pNext;
	}
	
	return NULL; 

}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:35,代码来源:entitylist.cpp

示例2: PEntityOfEntIndex

void CHookManager::OnClientPutInServer(int client)
{
	if (!PRCH_enabled)
		return;

	if (!PRCH_used)
		return;

	edict_t *pEdict = PEntityOfEntIndex(client);
	if (!pEdict)
	{
		return;
	}

	IServerUnknown *pUnknown = pEdict->GetUnknown();
	if (!pUnknown)
	{
		return;
	}

	CBaseEntity *pEntity = pUnknown->GetBaseEntity();
	if (!pEntity)
	{
		return;
	}

	SH_ADD_MANUALHOOK(PlayerRunCmdHook, pEntity, SH_MEMBER(this, &CHookManager::PlayerRunCmd), false);
}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:28,代码来源:hooks.cpp

示例3: PEntityOfEntIndex

/* Taken from Sourcemod Tf2 Extension */
CBaseEntity *UTIL_GetCBaseEntity(int num, bool onlyPlayers)
{
	edict_t *pEdict = PEntityOfEntIndex(num);
	if (!pEdict || pEdict->IsFree())
	{
		return NULL;
	}

	if (num > 0 && num <= playerhelpers->GetMaxClients())
	{
		IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(pEdict);
		if (!pPlayer || !pPlayer->IsConnected())
		{
			return NULL;
		}
	}
	else if (onlyPlayers)
	{
		return NULL;
	}

	IServerUnknown *pUnk;
	if ((pUnk=pEdict->GetUnknown()) == NULL)
	{
		return NULL;
	}

	return pUnk->GetBaseEntity();
}
开发者ID:Anime4000,项目名称:Left4Downtown2,代码行数:30,代码来源:util.cpp

示例4: LookupEntity

CBaseEntity *GetBaseEntity(int index)
{
	IServerUnknown *pUnknown = LookupEntity(index);
	if(pUnknown == NULL)
		return NULL;

	return pUnknown->GetBaseEntity();
}
开发者ID:MerlinStarfinder,项目名称:gmodmodules,代码行数:8,代码来源:gm_pimpmyride.cpp

示例5:

inline edict_t *BaseEntityToEdict(CBaseEntity *pEntity) {
	IServerUnknown *pUnk = (IServerUnknown *)pEntity;
	IServerNetworkable *pNet = pUnk->GetNetworkable();

	if(!pNet)
		return NULL;

	return pNet->GetEdict();
}
开发者ID:jonatan1024,项目名称:gorme,代码行数:9,代码来源:tmpbrush.cpp

示例6: OnEntityCreated

void CSourcePython::OnEntityCreated( CBaseEntity *pEntity )
{
	edict_t *pEdict;
	if (EdictFromBaseEntity(pEntity, pEdict)) {
		IServerUnknown* pServerUnknown = pEdict->GetUnknown();
		if (pServerUnknown)
			pEdict->m_pNetworkable = pServerUnknown->GetNetworkable();
	}
	CALL_LISTENERS(OnEntityCreated, ptr((CBaseEntityWrapper*) pEntity));
}
开发者ID:KirillMysnik,项目名称:Source.Python,代码行数:10,代码来源:sp_main.cpp

示例7: IndexFromBaseEntity

void CSourcePython::OnEntityCreated( CBaseEntity *pEntity )
{
	int iIndex = IndexFromBaseEntity(pEntity);
	edict_t *pEdict = EdictFromIndex(iIndex);
	if (pEdict)
	{
		IServerUnknown* pServerUnknown = pEdict->GetUnknown();
		if (pServerUnknown)
			pEdict->m_pNetworkable = pServerUnknown->GetNetworkable();
	}
	CALL_LISTENERS(OnEntityCreated, iIndex, ptr((CBaseEntityWrapper*) pEntity));
}
开发者ID:Doldol,项目名称:Source.Python,代码行数:12,代码来源:sp_main.cpp

示例8: BaseEntityFromEdict

//-----------------------------------------------------------------------------
// Returns a BaseEntity instance from the given Edict instance.
//-----------------------------------------------------------------------------
bool BaseEntityFromEdict( edict_t *pEdict, CBaseEntity*& output )
{
	if (!pEdict || pEdict->IsFree())
		return false;

	IServerUnknown *pServerUnknown = pEdict->GetUnknown();
	if (!pServerUnknown)
		return false;

	output = pServerUnknown->GetBaseEntity();
	return true;
}
开发者ID:dsezen,项目名称:Source.Python,代码行数:15,代码来源:baseentity_from.cpp

示例9:

	CBaseEntity *EdictToBaseEntity( edict_t *pEdict )
	{
		if (pEdict)
		{
			IServerUnknown *pUnk = pEdict->GetUnknown();
			if (pUnk)
			{
				return pUnk->GetBaseEntity();
			}
		}
		return nullptr;
	}
开发者ID:SizzlingStats,项目名称:sizzlingplugins,代码行数:12,代码来源:SC_helpers.cpp

示例10: GetEntityWrapper

SMJS_Entity* GetEntityWrapper(CBaseEntity *pEntity){
	if(pEntity == NULL) return NULL;

	auto ref = gamehelpers->EntityToReference(pEntity);
	auto it = refs.find(ref);
	if(it != refs.end()) return it->second;

	IServerUnknown *pUnk = (IServerUnknown *)pEntity;
	IServerNetworkable *pNet = pUnk->GetNetworkable();

	SMJS_Entity *wrapper = new SMJS_Entity(pEntity);
	refs.insert(std::make_pair(ref, wrapper));
	return wrapper;
}
开发者ID:Kolpa,项目名称:SourceMod.js,代码行数:14,代码来源:MEntities.cpp

示例11: defined

int	ManiReservedSlot::FindPlayerToKick ( ) {
	// FIRST LOOK FOR BOTS!
	for ( int i = 1; i <= max_players; i++ ) {
#if defined ( GAME_CSGO )
		edict_t *pEdict = PEntityOfEntIndex(i);
#else
		edict_t *pEdict = engine->PEntityOfEntIndex(i);
#endif

		IServerUnknown *unknown = pEdict->GetUnknown();
		if (!unknown)
			continue;

		CBaseEntity *base = unknown->GetBaseEntity();

		if (!base)
			continue;
		
		IPlayerInfo *pi_player = playerinfomanager->GetPlayerInfo( pEdict );

		if ( !pi_player )
			continue;

		if ( FStrEq(pi_player->GetNetworkIDString(), "BOT") ) 
			return i;
	}

	BuildPlayerKickList();

	if ( active_player_list_size == 0 )
		return 0;

	int KickMethod = mani_reserve_slots_kick_method.GetInt();
	//0 = by ping
	//1 = by connection time
	//2 = by kills per minute
	//3 = kill/death ratio

	if ( KickMethod == 0 ) {
		qsort(active_player_list, active_player_list_size, sizeof(active_player_t), sort_active_players_by_ping);
	} else if ( KickMethod == 1 ) {
		qsort(active_player_list, active_player_list_size, sizeof(active_player_t), sort_active_players_by_connect_time);
	} else if ( KickMethod == 2 ) {
		qsort(active_player_list, active_player_list_size, sizeof(active_player_t), sort_active_players_by_kill_rate);
	} else if ( KickMethod == 3 ) {
		qsort(active_player_list, active_player_list_size, sizeof(active_player_t), sort_active_players_by_kd_ratio);
	}

	return active_player_list[0].index;
}
开发者ID:imyzcn,项目名称:mani-admin-plugin,代码行数:50,代码来源:mani_reservedslot.cpp

示例12: GetPlayerInfo

int CPlayer::GetLifeState()
{
	if (lifestate_offset == -1)
	{
		if (!g_pGameConf->GetOffset("m_lifeState", &lifestate_offset))
		{
			lifestate_offset = -2;
		}
	}

	if (lifestate_offset < 0)
	{
		IPlayerInfo *info = GetPlayerInfo();
		if (info == NULL)
		{
			return PLAYER_LIFE_UNKNOWN;
		}
		return info->IsDead() ? PLAYER_LIFE_DEAD : PLAYER_LIFE_ALIVE;
	}

	if (m_pEdict == NULL)
	{
		return PLAYER_LIFE_UNKNOWN;
	}

	CBaseEntity *pEntity;
	IServerUnknown *pUnknown = m_pEdict->GetUnknown();
	if (pUnknown == NULL || (pEntity = pUnknown->GetBaseEntity()) == NULL)
	{
		return PLAYER_LIFE_UNKNOWN;
	}

	if (*((uint8_t *)pEntity + lifestate_offset) == LIFE_ALIVE)
	{
		return PLAYER_LIFE_ALIVE;
	}
	else
	{
		return PLAYER_LIFE_DEAD;
	}
}
开发者ID:Nephyrin,项目名称:-furry-octo-nemesis,代码行数:41,代码来源:PlayerManager.cpp

示例13: hndl

CBaseEntity *CHalfLife2::ReferenceToEntity(cell_t entRef)
{
	if ((unsigned)entRef == INVALID_EHANDLE_INDEX)
	{
		return NULL;
	}

	CEntInfo *pInfo = NULL;

	if (entRef & (1<<31))
	{
		/* Proper ent reference */
		int hndlValue = entRef & ~(1<<31);
		CBaseHandle hndl(hndlValue);

		pInfo = LookupEntity(hndl.GetEntryIndex());
		if (!pInfo || pInfo->m_SerialNumber != hndl.GetSerialNumber())
		{
			return NULL;
		}
	}
	else
	{
		/* Old style index only */
		pInfo = LookupEntity(entRef);
	}

	if (!pInfo)
	{
		return NULL;
	}

	IServerUnknown *pUnk = static_cast<IServerUnknown *>(pInfo->m_pEntity);
	if (pUnk)
	{
		return pUnk->GetBaseEntity();
	}

	return NULL;
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:40,代码来源:HalfLife2.cpp

示例14: GetEntityClassname

const char *CHalfLife2::GetEntityClassname(edict_t * pEdict)
{
	if (pEdict == NULL || pEdict->IsFree())
	{
		return NULL;
	}
	
	IServerUnknown *pUnk = pEdict->GetUnknown();
	if (pUnk == NULL)
	{
		return NULL;
	}
	
	CBaseEntity * pEntity = pUnk->GetBaseEntity();
	
	if (pEntity == NULL)
	{
		return NULL;
	}
	
	return GetEntityClassname(pEntity);
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:22,代码来源:HalfLife2.cpp

示例15: EntInfoArray

/**
 * Retrieves the CEntInfo pointer from g_EntList for a given entity index
 */
CEntInfo *CHalfLife2::LookupEntity(int entIndex)
{
	// Make sure that our index is within the bounds of the global ent array
	if (entIndex < 0 || entIndex >= NUM_ENT_ENTRIES)
	{
		return NULL;
	}

	CEntInfo *entInfos = EntInfoArray();

	if (!entInfos)
	{
		/* Attempt to use engine interface instead */
		static CEntInfo tempInfo;
		tempInfo.m_pNext = NULL;
		tempInfo.m_pPrev = NULL;

		edict_t *pEdict = PEntityOfEntIndex(entIndex);

		if (!pEdict)
		{
			return NULL;
		}

		IServerUnknown *pUnk = pEdict->GetUnknown();

		if (!pUnk)
		{
			return NULL;
		}

		tempInfo.m_pEntity = pUnk;
		tempInfo.m_SerialNumber = pUnk->GetRefEHandle().GetSerialNumber();

		return &tempInfo;
	}

	return &entInfos[entIndex];
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:42,代码来源:HalfLife2.cpp


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