-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.hpp
More file actions
48 lines (35 loc) · 1000 Bytes
/
player.hpp
File metadata and controls
48 lines (35 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// Created by Łukasz Stachowicz on 01/09/2022.
//
#pragma once
#include "player_id.hpp"
#include "interface_id.hpp"
#include "game_session.hpp"
#include <list>
#include <string>
#include <fstream>
#include <filesystem>
namespace RPSGame
{
class Player : public InterfaceId<PlayerId>
{
public:
explicit Player();
explicit Player(const std::string& hash);
~Player();
inline std::shared_ptr<GameSession> game() { return m_game_session; }
bool setGame(std::shared_ptr<GameSession> game_session);
inline void addEvent(const std::string& event) { m_events.push_back(event); }
inline void events(std::list<std::string>& events) { m_events.swap(events); }
inline uint64_t wins() const { return m_wins; }
inline void addWins() { ++m_wins; }
protected:
bool load();
void save();
std::filesystem::path filePath() const;
private:
std::list<std::string> m_events;
uint64_t m_wins;
std::shared_ptr<GameSession> m_game_session;
};
}