R-Type  2
Doom but in better
Loading...
Searching...
No Matches
PlayerMiscellaneous.cpp
Go to the documentation of this file.
2#include "Registry.hpp"
3#include "IndexedZipper.hpp"
4#include "PlayerInfo.hpp"
5
6std::size_t getIdByClientId(Registry &r, const unsigned int client_id)
7{
8 auto &infos = r.get_components<PlayerInfo>();
9 for (auto &&[idx, info] : IndexedZipper(infos))
10 {
11 if (info->id == client_id)
12 return idx;
13 }
14 return -1;
15}
std::size_t getIdByClientId(Registry &r, const unsigned int client_id)
Gets entity id by the player's client id.
Registry * r
Definition Tests.cpp:4
Combines multiple containers into a single iterable unit, iterating over corresponding elements from ...
Manages entities and their associated components, enabling the creation, deletion,...
Definition Registry.hpp:23
ComponentContainer< Component > & get_components()
Retrieves the component container for a specific type.
Definition Registry.hpp:121
Represents information about a player, specifically their username.