本文整理汇总了C++中IServerNetworkable类的典型用法代码示例。如果您正苦于以下问题:C++ IServerNetworkable类的具体用法?C++ IServerNetworkable怎么用?C++ IServerNetworkable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IServerNetworkable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INDEXENT
const char *CClassInterface::FindEntityNetClass(int start, const char *classname)
{
edict_t *current;
for (register short int i = 0; i < MAX_ENTITIES; i++)
{
current = INDEXENT(i);
if (current == NULL)
{
continue;
}
IServerNetworkable *network = current->GetNetworkable();
if (network == NULL)
{
continue;
}
if (strcmp(current->GetClassName(), classname) == 0)
{
ServerClass *sClass = network->GetServerClass();
return sClass->GetName();
}
}
return NULL;
}
示例2:
// http://svn.alliedmods.net/viewvc.cgi/trunk/extensions/tf2/extension.cpp?revision=2183&root=sourcemod&pathrev=2183
edict_t *CClassInterface::FindEntityByNetClass(int start, const char *classname)
{
edict_t *current;
for (int i = ((start != -1) ? start : 0); i < gpGlobals->maxEntities; i++)
{
current = engine->PEntityOfEntIndex(i);
if (current == NULL)
{
continue;
}
IServerNetworkable *network = current->GetNetworkable();
if (network == NULL)
{
continue;
}
ServerClass *sClass = network->GetServerClass();
const char *name = sClass->GetName();
if (strcmp(name, classname) == 0)
{
return current;
}
}
return NULL;
}
示例3:
// http://svn.alliedmods.net/viewvc.cgi/trunk/extensions/tf2/extension.cpp?revision=2183&root=sourcemod&pathrev=2183
edict_t *CClassInterface::FindEntityByNetClass(int start, const char *classname)
{
edict_t *current;
for (register short int i = 0; i < MAX_ENTITIES; i++)
{
current = engine->PEntityOfEntIndex(i);
if (current == NULL)
{
continue;
}
IServerNetworkable *network = current->GetNetworkable();
if (network == NULL)
{
continue;
}
ServerClass *sClass = network->GetServerClass();
const char *name = sClass->GetName();
if (strcmp(name, classname) == 0)
{
return current;
}
}
return NULL;
}
示例4: UTIL_FindServerClassnamePrint
void UTIL_FindServerClassnamePrint(const char *name_cmd)
{
edict_t *current;
for (int i = 0; i < gpGlobals->maxEntities; i++)
{
current = engine->PEntityOfEntIndex(i);
if (current == NULL)
{
continue;
}
IServerNetworkable *network = current->GetNetworkable();
if (network == NULL)
{
continue;
}
ServerClass *sClass = network->GetServerClass();
const char *name = sClass->GetName();
if (strcmp(name, name_cmd) == 0)
{
CBotGlobals::botMessage(NULL,0,"%s",current->GetClassName());
return;
}
}
CBotGlobals::botMessage(NULL,0,"Not found");
}
示例5: 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;
}
示例6: UTIL_FindServerClassnamePrint
void UTIL_FindServerClassnamePrint(const char *name_cmd)
{
edict_t *current;
register short int maxEnts = (short int)MAX_ENTITIES;
for (register short int i = 0; i < maxEnts; i++)
{
current = INDEXENT(i);
if (current == NULL)
{
continue;
}
IServerNetworkable *network = current->GetNetworkable();
if (network == NULL)
{
continue;
}
ServerClass *sClass = network->GetServerClass();
const char *name = sClass->GetName();
if (strcmp(name, name_cmd) == 0)
{
CBotGlobals::BotMessage(NULL, 0, "%s", current->GetClassName());
return;
}
}
CBotGlobals::BotMessage(NULL, 0, "Not found");
}
示例7:
inline edict_t *BaseEntityToEdict(CBaseEntity *pEntity) {
IServerUnknown *pUnk = (IServerUnknown *)pEntity;
IServerNetworkable *pNet = pUnk->GetNetworkable();
if(!pNet)
return NULL;
return pNet->GetEdict();
}
示例8: EntityFactoryDictionary
CBaseNetworkable *CreateNetworkableByName( const char *className )
{
IServerNetworkable *pNetwork = EntityFactoryDictionary()->Create( className );
if ( !pNetwork )
return NULL;
CBaseNetworkable *pNetworkable = pNetwork->GetBaseNetworkable();
Assert( pNetworkable );
return pNetworkable;
}
示例9: Assert
ICollideable *CEngineTraceServer::GetCollideable( IHandleEntity *pEntity )
{
Assert( pEntity );
ICollideable *pProp = StaticPropMgr()->GetStaticProp( pEntity );
if ( pProp )
return pProp;
IServerNetworkable *pNetEntity = (IServerNetworkable*)pEntity;
return pNetEntity->GetEdict()->GetCollideable();
}
示例10: 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;
}
示例11: Error
// creates an entity by string name, but does not spawn it
CBaseEntity *CreateEntityByName( const char *className, int iForceEdictIndex )
{
if ( iForceEdictIndex != -1 )
{
g_pForceAttachEdict = engine->CreateEdict( iForceEdictIndex );
if ( !g_pForceAttachEdict )
Error( "CreateEntityByName( %s, %d ) - CreateEdict failed.", className, iForceEdictIndex );
}
IServerNetworkable *pNetwork = EntityFactoryDictionary()->Create( className );
g_pForceAttachEdict = NULL;
if ( !pNetwork )
return NULL;
CBaseEntity *pEntity = pNetwork->GetBaseEntity();
Assert( pEntity );
return pEntity;
}
示例12:
edict_t *CClassInterface::FindEntityByNetClassNearest(Vector vstart, const char *classname)
{
edict_t *current;
edict_t *pfound = NULL;
float fMindist = 8192.0f;
float fDist;
for (short int i = 0; i < gpGlobals->maxEntities; i++)
{
current = engine->PEntityOfEntIndex(i);
if (current == NULL)
{
continue;
}
if ( current->IsFree() )
continue;
if ( current->GetUnknown() == NULL )
continue;
IServerNetworkable *network = current->GetNetworkable();
if (network == NULL)
{
continue;
}
ServerClass *sClass = network->GetServerClass();
const char *name = sClass->GetName();
if (strcmp(name, classname) == 0)
{
fDist = (vstart - CBotGlobals::entityOrigin(current)).Length();
if ( !pfound || (fDist < fMindist))
{
fMindist = fDist;
pfound = current;
}
}
}
return pfound;
}
示例13:
static CBaseEntity *FindEntityByNetClass(int start, const char *classname)
{
int maxEntities = gpGlobals->maxEntities;
for (int i = start; i < maxEntities; i++)
{
edict_t *current = gamehelpers->EdictOfIndex(i);
if (current == NULL || current->IsFree())
continue;
IServerNetworkable *network = current->GetNetworkable();
if (network == NULL)
continue;
ServerClass *sClass = network->GetServerClass();
const char *name = sClass->GetName();
if (!strcmp(name, classname))
return gamehelpers->ReferenceToEntity(gamehelpers->IndexOfEdict(current));
}
return NULL;
}
示例14: 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();
}
示例15: 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;
}