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{
31 GameRules();
32 GameRules(const GameRules&) = default;
33 GameRules(GameRules&&) = default;
34 auto operator=(const GameRules& other) -> GameRules& = default;
35 auto operator=(GameRules&& other) noexcept -> GameRules& = default;
36 ~GameRules() = default;
37
38 auto load(const Stream& stream) -> void;
39 auto save(Stream& stream) const -> void;
40
41 friend auto to_json(json& j, const GameRules& g) -> void;
42 friend auto from_json(const json& j, GameRules& g) -> void;
43
44 auto getMaxCardsPerPlayerHand() const -> int;
45
46 auto setMaxCardsPerPlayerHand(int newMax) -> void;
47
48 auto getMaxNumberOfCardsPlayedPerTurn() const -> int;
49
50 auto setMaxNumberOfCardsPlayedPerTurn(int newMax) -> void;
51
52 auto getBoardDimensions() const -> const std::pair<int, int>&;
53
54 auto setBoardDimensions(std::pair<int, int>&& newDimension) -> void;
55
56 auto getTimeLimit() const -> float;
57
58 auto setTimeLimit(float newTimeLimit) -> void;
59
60private:
63 std::pair<int, int> boardDimensions;
65 float timeLimit;
66};
sys::Json Stream
Definition AudioObject.h:20
nlohmann::json json
Definition Json.cpp:19
float timeLimit
timeLimit is stored in seconds
Definition GameRules.h:65
auto getBoardDimensions() const -> const std::pair< int, int > &
Definition GameRules.cpp:79
int maxNumberOfCardsPlayedPerTurn
Definition GameRules.h:62
std::pair< int, int > boardDimensions
Definition GameRules.h:63
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:61
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 load(const Stream &stream) -> void
Definition GameRules.cpp:49
auto setBoardDimensions(std::pair< int, int > &&newDimension) -> void
Definition GameRules.cpp:84
GameRules(GameRules &&)=default
auto setMaxNumberOfCardsPlayedPerTurn(int newMax) -> void
Definition GameRules.cpp:74