Wizard
Software Engineering Project - Wizard
Loading...
Searching...
No Matches
game_instance.h
1//
2// Created by Manuel on 25.01.2021.
3//
4// The game_instance class is a wrapper around the game_state of an active instance of the game.
5// This class contains functions to modify the contained game_state.
6
7#ifndef WIZARD_GAME_H
8#define WIZARD_GAME_H
9
10#include <vector>
11#include <string>
12#include <mutex>
13
14#include "../common/game_state/player/player.h"
15#include "../common/game_state/game_state.h"
16
18
19private:
20 game_state* _game_state;
21 inline static std::mutex modification_lock;
22
23public:
26 if (_game_state != nullptr) {
27 delete _game_state;
28 }
29 _game_state = nullptr;
30 }
31 std::string get_id();
32
33 game_state* get_game_state();
34
35 bool is_full();
36 bool is_started();
37 bool is_finished();
38
39 // game update functions
40 bool start_game(player* player, std::string& err);
41 bool try_add_player(player* new_player, std::string& err);
42 bool try_remove_player(player* player, std::string& err);
43 bool play_card(player* player, const std::string& card_id, std::string& err);
44 bool estimate_tricks(player *player, std::string& err, int nof_tricks);
45
46};
47
48
49#endif //WIZARD_GAME_H
50
Definition game_instance.h:17
Definition game_state.h:18
Represents a player in the game.
Definition player.h:18