43 if (map && map->
pairs) {
58static inline entity_t network_map_lookup(
network_map_t *map, uint32_t network_id) {
59 if (!map || !map->
pairs)
return (entity_t)-1;
60 for (
size_t i = 0; i < map->
count; ++i) {
76static inline void network_map_insert(
network_map_t *map, uint32_t network_id, entity_t local_id) {
81 if (!new_pairs)
return;
82 map->
pairs = new_pairs;
96static inline int network_map_remove(
network_map_t *map, uint32_t network_id) {
97 if (!map || !map->
pairs)
return 0;
98 for (
size_t i = 0; i < map->
count; ++i) {
Pair mapping between a global network ID and a local entity ID.
Definition network_map.h:11
entity_t local_id
Corresponding local entity ID in the ECS.
Definition network_map.h:13
uint32_t network_id
Unique ID assigned by the server for an entity.
Definition network_map.h:12
Dynamic mapping structure from network IDs to local entity IDs. This map grows dynamically as new net...
Definition network_map.h:22
network_id_pair_t * pairs
Array of ID pairs.
Definition network_map.h:23
size_t count
Array of ID pairs.
Definition network_map.h:24
size_t capacity
Allocated capacity of the pairs array.
Definition network_map.h:25