R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
Session.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** Created by hugo on 06/12/2025
4** File description:
5** Session.hpp
6*/
7
8#pragma once
9
11
12namespace server {
13
14 class Session : public ISession {
15 public:
20 explicit Session(const std::string &id);
21 ~Session() override = default;
22
23 std::string getId() const override;
24 bool isActive() const override;
25
30 uint32_t getPlayerId() const;
31
36 void setPlayerId(uint32_t playerId);
37
42 [[nodiscard]] bool isSpectator() const;
43
48 void setSpectator(bool spectator);
49
54 void setActive(bool active);
55
56 private:
57 std::string _id;
58 uint32_t _playerId;
59 bool _active{false};
60 bool _isSpectator{false};
61 };
62
63} // namespace server
void setSpectator(bool spectator)
Set spectator mode for this session.
Definition Session.cpp:34
~Session() override=default
bool isSpectator() const
Check if this session is a spectator.
Definition Session.cpp:30
uint32_t getPlayerId() const
Get the player ID associated with this session.
Definition Session.cpp:22
std::string getId() const override
Get the session ID.
Definition Session.cpp:14
void setPlayerId(uint32_t playerId)
Set the player ID for this session.
Definition Session.cpp:26
bool isActive() const override
Check if session is active.
Definition Session.cpp:18
uint32_t _playerId
Definition Session.hpp:58
std::string _id
Definition Session.hpp:57
void setActive(bool active)
Set session active state.
Definition Session.cpp:38