示例#1
0
//-----------------------------------------------------------------------------
// Returns an Edict instance from the given Pointer instance.
//-----------------------------------------------------------------------------
bool EdictFromPointer( CPointer *pEntityPointer, edict_t*& output )
{
	if (!IsValidNetworkedEntityPointer(pEntityPointer))
		return false;

	return EdictFromBaseEntity((CBaseEntity *) pEntityPointer->m_ulAddr, output);
}
示例#2
0
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));
}
// ----------------------------------------------------------------------------
// Returns the next valid edict_t instance.
// ----------------------------------------------------------------------------
edict_t* CEntityGenerator::getNext()
{
	while (m_pCurrentEntity)
	{
		edict_t *pEdict;
		if (!EdictFromBaseEntity(m_pCurrentEntity, pEdict))
			pEdict = NULL;

		m_pCurrentEntity = (CBaseEntity *)servertools->NextEntity(m_pCurrentEntity);
		if (pEdict)
		{
			if (m_uiClassNameLen && m_szClassName)
			{
				if (!m_bExactMatch && strncmp(pEdict->GetClassName(), m_szClassName, m_uiClassNameLen) != 0)
					continue;

				else if (m_bExactMatch && strcmp(pEdict->GetClassName(), m_szClassName) != 0)
					continue;
			}
			return pEdict;
		}
	}
	return NULL;
}