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


C++ IServerNetworkable::GetEdict方法代码示例

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


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

示例1: EnumElement

	IterationRetval_t EnumElement( IHandleEntity *pHandleEntity )
	{
		// skip static props, the game DLL doesn't care about them
		if ( StaticPropMgr()->IsStaticProp( pHandleEntity ) )
			return ITERATION_CONTINUE;

		IServerNetworkable *pNetworkable = static_cast< IServerNetworkable* >( pHandleEntity );
		Assert( pNetworkable );

		// Convert the user ID to and edict_t*...
		edict_t* pTouch = pNetworkable->GetEdict();

		// Can't ever touch itself because it's in the other list
		if ( pTouch == m_pTriggerEntity )
			return ITERATION_CONTINUE;

		IServerEntity *serverEntity = pTouch->GetIServerEntity();
		if ( !serverEntity )
			return ITERATION_CONTINUE;

		if ( m_headnode >= 0 )
		{
			Vector vecMins, vecMaxs;
			CM_WorldAlignBounds( serverEntity->GetCollideable(), &vecMins, &vecMaxs );
			int contents = CM_TransformedBoxContents( serverEntity->GetAbsOrigin(), 
					vecMins, vecMaxs, m_headnode, m_origin, m_angles );
			if ( !(contents & MASK_SOLID) )
				return ITERATION_CONTINUE;
		}

		m_TouchedEntities.AddToTail( pTouch );

		return ITERATION_CONTINUE;
	}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:34,代码来源:world.cpp

示例2:

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

示例3: StaticPropMgr

ICollideable *CEngineTraceServer::GetCollideable( IHandleEntity *pEntity )
{
	Assert( pEntity );

	ICollideable *pProp = StaticPropMgr()->GetStaticProp( pEntity );
	if ( pProp )
		return pProp;

	IServerNetworkable *pNetEntity = (IServerNetworkable*)pEntity;
	return pNetEntity->GetEdict()->GetCollideable();
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:11,代码来源:enginetrace.cpp

示例4: EdictFromBaseEntity

//-----------------------------------------------------------------------------
// Returns an Edict instance from the given BaseEntity instance.
//-----------------------------------------------------------------------------
bool EdictFromBaseEntity( CBaseEntity *pBaseEntity, edict_t*& output )
{
	if (!pBaseEntity)
		return false;
	
	IServerNetworkable *pServerNetworkable = pBaseEntity->GetNetworkable();
	if (!pServerNetworkable)
		return false;

	edict_t* pEdict = pServerNetworkable->GetEdict();
	if (!pEdict || pEdict->IsFree())
		return false;

	output = pEdict;
	return true;
}
开发者ID:ThaPwned,项目名称:Source.Python,代码行数:19,代码来源:edict_from.cpp

示例5: HandleEntityToCollideable

//-----------------------------------------------------------------------------
// Converts a user id to a collideable + username
//-----------------------------------------------------------------------------
void CEngineTraceServer::HandleEntityToCollideable( IHandleEntity *pHandleEntity, ICollideable **ppCollide, const char **ppDebugName )
{
	*ppCollide = StaticPropMgr()->GetStaticProp( pHandleEntity );
	if ( *ppCollide	)
	{
		*ppDebugName = "static prop";
		return;
	}

	IServerNetworkable *pServerNetworkable = static_cast<IServerNetworkable*>(pHandleEntity);
	if ( !pServerNetworkable )
	{
		*ppCollide = NULL;
		*ppDebugName = "<null>";
		return;
	}

	edict_t *pEdict = pServerNetworkable->GetEdict();
	Assert( pEdict );
	*ppCollide = pEdict->GetCollideable();
	*ppDebugName = pServerNetworkable->GetServerClass()->GetName();
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:25,代码来源:enginetrace.cpp

示例6: SetEntity

void SMJS_Entity::SetEntity(CBaseEntity *ent){
	if(this->ent != NULL){
		if(this->ent != ent){
			throw "Cannot set entity twice";
		}

		return;
	}

	this->valid = false;
	if(ent == NULL) return;

	this->ent = ent;

	IServerUnknown *pUnk = (IServerUnknown *)ent;
	IServerNetworkable *pNet = pUnk->GetNetworkable();
	if(pNet){
		edict = pNet->GetEdict();
		entIndex = gamehelpers->IndexOfEdict(edict);
	}

	this->valid = true;
}
开发者ID:1and1get2,项目名称:SourceMod.js,代码行数:23,代码来源:SMJS_Entity.cpp

示例7: GetType

CEntity *CEntityManager::CBaseEntityPostConstructor(CBaseEntity *pEntity, const char * szClassname )
{
	IServerNetworkable *pNetworkable = pEntity->GetNetworkable();
	Assert(pNetworkable);

	edict_t *pEdict = pNetworkable->GetEdict();

	if(strcmp(szClassname,"player") == 0 && engine->IndexOfEdict(pEdict) == 0)
	{
		return NULL;
	}

	IEntityFactory_CE **value = NULL;
	bool m_bShouldAddToCache = false;
	value = pCacheTrie.retrieve(szClassname);

	if(!value)
	{
		m_bShouldAddToCache = true;
		value = pFactoryTrie.retrieve(szClassname);
	}

	if (!value)
	{
		/* Attempt to do an RTTI lookup for C++ class links */
		IType *pType = GetType(pEntity);
		IBaseType *pBase = pType->GetBaseType();

		do 
		{
			const char *classname = GetTypeName(pBase->GetTypeInfo());
			value = pFactoryTrie.retrieve(classname);

			if (value)
			{
				break;
			}

		} while (pBase->GetNumBaseClasses() && (pBase = pBase->GetBaseClass(0)));

		pType->Destroy();
	}

	if (!value)
	{
		/* No specific handler for this entity */
		value = pFactoryTrie.retrieve("baseentity");
		assert(value);
	}

	IEntityFactory_CE *pFactory = *value;
	assert(pFactory);

	if(m_bShouldAddToCache)
	{
		pCacheTrie.insert(szClassname, pFactory);
	}

	CEntity *cent = pFactory->Create(pEdict, pEntity);

	char vtable[20];
	_snprintf(vtable, sizeof(vtable), "%x", (unsigned int) *(void **)pEntity);

	cent->ClearAllFlags();
	cent->InitProps();
	
	if (!pHookedTrie.retrieve(vtable))
	{
		cent->InitHooks();
		pHookedTrie.insert(vtable, true);
	}
	
	cent->InitDataMap();

	return cent;
}
开发者ID:KissLick,项目名称:sourcemod-npc-in-css,代码行数:76,代码来源:CEntityManager.cpp


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