R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
Session.cpp
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.cpp
6*/
7
9
10namespace server {
11
12 Session::Session(const std::string &id) : _id(id), _playerId(0), _active(true) {}
13
14 std::string Session::getId() const {
15 return _id;
16 }
17
18 bool Session::isActive() const {
19 return _active;
20 }
21
22 uint32_t Session::getPlayerId() const {
23 return _playerId;
24 }
25
26 void Session::setPlayerId(uint32_t playerId) {
27 _playerId = playerId;
28 }
29
30 bool Session::isSpectator() const {
31 return _isSpectator;
32 }
33
34 void Session::setSpectator(bool spectator) {
35 _isSpectator = spectator;
36 }
37
38 void Session::setActive(bool active) {
39 _active = active;
40 }
41
42} // namespace server
void setSpectator(bool spectator)
Set spectator mode for this session.
Definition Session.cpp:34
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
Session(const std::string &id)
Constructor.
Definition Session.cpp:12
std::string _id
Definition Session.hpp:57
void setActive(bool active)
Set session active state.
Definition Session.cpp:38