Files
csgo2_tiny_server_plugin_sy…/csgo2/native_sdk/handle/handle.h
2023-10-01 02:28:13 +08:00

26 lines
523 B
C++

#pragma once
#include <cstdint>
#define INVALID_EHANDLE_INDEX 0xFFFFFFFF
#define ENT_ENTRY_MASK 0x7FFF
class CBaseEntity;
class CHandle
{
CBaseEntity* GetBaseEntity() const;
public:
bool operator==(CHandle rhs) const { return m_Index == rhs.m_Index; }
bool IsValid() const { return m_Index != INVALID_EHANDLE_INDEX; }
int GetEntryIndex() const { return m_Index & ENT_ENTRY_MASK; }
template <typename T = CBaseEntity>
T* Get() const
{
return reinterpret_cast<T*>(GetBaseEntity());
}
uint32_t m_Index;
};