Esempio n. 1
0
//-----------------------------------------------------------------------------
// Returns a UserID from the given BaseHandle instance.
//-----------------------------------------------------------------------------
bool UseridFromBaseHandle( CBaseHandle hBaseHandle, unsigned int& output )
{
	unsigned int iEntityIndex;
	if (!IndexFromBaseHandle(hBaseHandle, iEntityIndex))
		return false;

	return UseridFromIndex(iEntityIndex, output);
}
Esempio n. 2
0
//-----------------------------------------------------------------------------
// Returns an Edict instance from the given BaseHandle instance.
//-----------------------------------------------------------------------------
bool EdictFromBaseHandle( CBaseHandle hBaseHandle, edict_t*& output )
{
	unsigned int iIndex;
	if (!IndexFromBaseHandle(hBaseHandle, iIndex))
		return false;

	return EdictFromIndex(iIndex, output);
}
Esempio n. 3
0
//-----------------------------------------------------------------------------
// Returns an index from the given IntHandle.
//-----------------------------------------------------------------------------
bool IndexFromIntHandle( unsigned int iEntityHandle, unsigned int& output )
{
    if (iEntityHandle == (int) INVALID_EHANDLE_INDEX)
        return false;

    CBaseHandle hBaseHandle(iEntityHandle);
    unsigned int iEntityIndex;
    if (!IndexFromBaseHandle(hBaseHandle, iEntityIndex))
        return false;

    edict_t* pEdict;
    if (!EdictFromIndex(iEntityIndex, pEdict))
        return false;

    CBaseHandle hTestHandle;
    if (!BaseHandleFromEdict(pEdict, hTestHandle))
        return false;

    if (!hTestHandle.IsValid() || hBaseHandle.GetSerialNumber() != hTestHandle.GetSerialNumber())
        return false;

    output = iEntityIndex;
    return true;
}