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


C++ IServerNetworkable类代码示例

本文整理汇总了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;
}
开发者ID:Deathreus,项目名称:AFKBot,代码行数:30,代码来源:bot_getprop.cpp

示例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;
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:32,代码来源:bot_getprop.cpp

示例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;
}
开发者ID:Deathreus,项目名称:AFKBot,代码行数:32,代码来源:bot_getprop.cpp

示例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");
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:32,代码来源:bot_getprop.cpp

示例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;
	}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:34,代码来源:world.cpp

示例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");
}
开发者ID:Deathreus,项目名称:AFKBot,代码行数:33,代码来源:bot_getprop.cpp

示例7:

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

示例8: EntityFactoryDictionary

CBaseNetworkable *CreateNetworkableByName( const char *className )
{
	IServerNetworkable *pNetwork = EntityFactoryDictionary()->Create( className );
	if ( !pNetwork )
		return NULL;

	CBaseNetworkable *pNetworkable = pNetwork->GetBaseNetworkable();
	Assert( pNetworkable );
	return pNetworkable;
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:10,代码来源:mapentities.cpp

示例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();
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:11,代码来源:enginetrace.cpp

示例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;
}
开发者ID:ThaPwned,项目名称:Source.Python,代码行数:19,代码来源:edict_from.cpp

示例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;
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:20,代码来源:mapentities.cpp

示例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;
}
开发者ID:knobik,项目名称:rcbot2,代码行数:43,代码来源:bot_getprop.cpp

示例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;
}
开发者ID:DJLaca,项目名称:sourcemod,代码行数:22,代码来源:gamerulesnatives.cpp

示例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();
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:25,代码来源:enginetrace.cpp

示例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;
}
开发者ID:1and1get2,项目名称:SourceMod.js,代码行数:23,代码来源:SMJS_Entity.cpp


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