本文整理汇总了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;
}
示例2:
inline edict_t *BaseEntityToEdict(CBaseEntity *pEntity) {
IServerUnknown *pUnk = (IServerUnknown *)pEntity;
IServerNetworkable *pNet = pUnk->GetNetworkable();
if(!pNet)
return NULL;
return pNet->GetEdict();
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}