VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
EntityRef.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5namespace VoltMod
6{
7
8/** An entity handle that is safe to keep across frames: it resolves to nothing once its entity is gone,
9 * even if another entity reuses the slot. `EntityRef{}` clears a handle field. */
11{
12 static constexpr uint32_t Unset = 0xFFFFFFFFu;
13
14 /** The engine's CHandle bits. */
16
17 explicit operator bool() const noexcept { return Handle != Unset; }
18 bool operator==(const EntityRef&) const noexcept = default;
19};
20
21// Generated accessors read and write it in place of the engine's CHandle.
22static_assert(sizeof(EntityRef) == 4);
23
24} // namespace VoltMod
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
static constexpr uint32_t Unset
Definition EntityRef.hpp:12
bool operator==(const EntityRef &) const noexcept=default