Cavoke  1.1.0
A Platform for creating and hosting multiplayer turn-based board games
Loading...
Searching...
No Matches
game_logic_manager.h
1#ifndef CAVOKE_SERVER_GAME_LOGIC_MANAGER_H
2#define CAVOKE_SERVER_GAME_LOGIC_MANAGER_H
3
4#include <memory>
5#include <string>
6#include "cavoke.h"
7#include "game_state_storage.h"
8#include "model/games/games_storage.h"
9
10namespace cavoke::server::model {
11
14 explicit validation_error(std::string message);
15};
16
18 std::shared_ptr<GamesStorage> m_games_storage;
19
20 std::string invoke_logic_local(const Game &game, const std::string &input);
21 std::string invoke_logic_external(const Game &game,
22 const std::string &method,
23 const std::string &input);
24
25public:
26 explicit GameLogicManager(std::shared_ptr<GamesStorage> games_storage);
27
28 const int LOGIC_TIMEOUT_MS = 500;
29 const int MAX_GAME_RESPONSE_B = 8 * 1024;
30
31 ValidationResult validate_settings(
32 const std::string &game_id,
33 const json &settings,
34 const std::vector<int> &occupied_positions);
35
37 const std::string &game_id,
38 const json &settings,
39 const std::vector<int> &occupied_positions);
40
41 GameStateStorage::GameState send_move(const std::string &game_id,
42 const cavoke::GameMove &move);
43};
44
45} // namespace cavoke::server::model
46
47#endif // CAVOKE_SERVER_GAME_LOGIC_MANAGER_H
Base exception for errors thrown in server.
is thrown when trying to start a new session with invalid config