RavEngine
Loading...
Searching...
No Matches
Types.hpp
1#pragma once
2#include <cstdint>
3#include <limits>
4#include <chrono>
5#include "cluster_defs.h"
6
7using entity_id_t = uint32_t;
8constexpr entity_id_t INVALID_ENTITY = std::numeric_limits<decltype(INVALID_ENTITY)>::max();
9
11 entity_id_t id : 24 = INVALID_ENTITY;
12 entity_id_t version : 8 = 0; // MSVC makes the struct the wrong size if we don't do this
13
14 bool operator==(const EntityHandle& other) const{
15 return id == other.id && version == other.version;
16 }
17};
18
19static_assert(sizeof(EntityHandle) == sizeof(entity_id_t), "EntityHandle is the wrong size!");
20
22using pos_t = uint32_t;
23constexpr pos_t INVALID_INDEX = std::numeric_limits<decltype(INVALID_INDEX)>::max();
24
25static constexpr inline bool EntityIsValid(entity_id_t id){
26 return id != INVALID_ENTITY;
27}
28
29
30static constexpr inline bool EntityIsValid(entity_t id){
31 return EntityIsValid(id.id);
32}
33
34static constexpr inline bool PosIsValid(pos_t id){
35 return id != INVALID_INDEX;
36}
37
38using e_clock_t = std::chrono::steady_clock;
39
40constexpr uint8_t MAX_CASCADES = SH_MAX_CASCADES;
41
42#define MOVE_NO_COPY(T) T(const T&) = delete; T(T&&) = default; T& operator=(T&&) = default;
uint32 uint32_t
Definition fwd.hpp:131
uint8 uint8_t
Definition fwd.hpp:103
Definition Types.hpp:10