Brunot
Loading...
Searching...
No Matches
GameRules.h
Go to the documentation of this file.
1
11// ____ __ __ __
12// /\__ _\/\ \ /\ \/\ \
13// \/_/\ \/\ \ \___ __ \ \ \_\ \ ___ __ __ ____ __
14// \ \ \ \ \ _ `\ /'__`\ \ \ _ \ / __`\/\ \/\ \ /',__\ /'__`\
15// \ \ \ \ \ \ \ \/\ __/ \ \ \ \ \/\ \L\ \ \ \_\ \/\__, `\/\ __/
16// \ \_\ \ \_\ \_\ \____\ \ \_\ \_\ \____/\ \____/\/\____/\ \____\
17// \/_/ \/_/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/___/ \/____/
18
19
20#pragma once
21#include <utility>
22
23#include "Audio/AudioObject.h"
24
30{
31public:
32 GameRules();
33 GameRules(const GameRules&) = default;
34 GameRules(GameRules&&) = default;
35 auto operator=(const GameRules& other) -> GameRules& = default;
36 auto operator=(GameRules&& other) noexcept -> GameRules& = default;
37 ~GameRules() = default;
38
39 auto load(Stream& stream) -> void;
40 auto save(Stream& stream) const -> void;
41
42 friend auto to_json(json& j, const GameRules& g) -> void;
43 friend auto from_json(const json& j, GameRules& g) -> void;
44
45 auto getMaxCardsPerPlayerHand() const -> int;
46
47 auto setMaxCardsPerPlayerHand(int newMax) -> void;
48
49 auto getMaxNumberOfCardsPlayedPerTurn() const -> int;
50
51 auto setMaxNumberOfCardsPlayedPerTurn(int newMax) -> void;
52
53 auto getBoardDimensions() const -> const std::pair<int, int>&;
54
55 auto setBoardDimensions(std::pair<int, int>&& newDimension) -> void;
56
57 auto getTimeLimit() const -> float;
58
59 auto setTimeLimit(float newTimeLimit) -> void;
60
61private:
64 std::pair<int, int> boardDimensions;
66 float timeLimit;
67};
sys::Json Stream
Definition AudioObject.h:20
nlohmann::json json
Definition Json.cpp:19
float timeLimit
timeLimit is stored in seconds
Definition GameRules.h:66
auto getBoardDimensions() const -> const std::pair< int, int > &
Definition GameRules.cpp:79
int maxNumberOfCardsPlayedPerTurn
Definition GameRules.h:63
std::pair< int, int > boardDimensions
Definition GameRules.h:64
auto load(Stream &stream) -> void
Definition GameRules.cpp:49
friend auto to_json(json &j, const GameRules &g) -> void
Definition GameRules.cpp:30
auto operator=(const GameRules &other) -> GameRules &=default
auto save(Stream &stream) const -> void
Definition GameRules.cpp:54
friend auto from_json(const json &j, GameRules &g) -> void
Definition GameRules.cpp:40
GameRules()
Definition GameRules.cpp:22
int maxCardsPerPlayerHand
Definition GameRules.h:62
auto operator=(GameRules &&other) noexcept -> GameRules &=default
GameRules(const GameRules &)=default
~GameRules()=default
auto getMaxCardsPerPlayerHand() const -> int
Definition GameRules.cpp:59
auto setMaxCardsPerPlayerHand(int newMax) -> void
Definition GameRules.cpp:64
auto setTimeLimit(float newTimeLimit) -> void
Definition GameRules.cpp:94
auto getMaxNumberOfCardsPlayedPerTurn() const -> int
Definition GameRules.cpp:69
auto getTimeLimit() const -> float
Definition GameRules.cpp:89
auto setBoardDimensions(std::pair< int, int > &&newDimension) -> void
Definition GameRules.cpp:84
GameRules(GameRules &&)=default
auto setMaxNumberOfCardsPlayedPerTurn(int newMax) -> void
Definition GameRules.cpp:74