-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameConfig.cpp
More file actions
25 lines (19 loc) · 806 Bytes
/
GameConfig.cpp
File metadata and controls
25 lines (19 loc) · 806 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
#include "GameConfig.hpp"
#include <boost/log/trivial.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
Config::GameConfig::GameConfig()
{
BOOST_LOG_TRIVIAL(debug) << "Building game machine and reading game config file.";
boost::property_tree::ptree pt;
boost::property_tree::ini_parser::read_ini("./Config/TournamentConfig.ini", pt);
_bothCheat = pt.get<int>("Game.BothCheat");
_bothCooperate = pt.get<int>("Game.BothCooperate");
_cheat = pt.get<int>("Game.Cheat");
_cooperate = pt.get<int>("Game.Cooperate");
_mistakeChance = pt.get<int>("Game.MistakeChance");
if(_mistakeChance < 0 || _mistakeChance > 100)
{
throw std::exception("Mistake chance config is lower than 0% or greater than 100%!");
}
}