Wizard
Software Engineering Project - Wizard
Loading...
Searching...
No Matches
player_manager.h
1//
2// Created by Manuel on 29.01.2021.
3//
4// The player_manager only exists on the server side. It stores all connected users since starting the server. It offers
5// functionality to retrieve players by id or adding players when they first connect to the server.
6//
7
8#ifndef WIZARD_PLAYER_MANAGER_H
9#define WIZARD_PLAYER_MANAGER_H
10
11#include <string>
12#include <shared_mutex>
13#include <unordered_map>
14
15#include "../common/game_state/player/player.h"
16
18
19private:
20
21 inline static std::shared_mutex _rw_lock;
22 static std::unordered_map<std::string, player*> _players_lut;
23
24public:
25 static bool try_get_player(const std::string& player_id, player*& player_ptr);
26 static bool add_or_get_player(std::string name, const std::string& player_id, player*& player_ptr);
27 static bool remove_player(const std::string& player_id, player*& player); // not implemented
28};
29
30
31#endif //WIZARD_PLAYER_MANAGER_H
Definition player_manager.h:17
Represents a player in the game.
Definition player.h:18