-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
66 lines (59 loc) · 1.58 KB
/
main.cpp
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//---------------------------------------------------------------------------------------------------------------------
// main.cpp
//
// This is the main
// it checks if there are wrong arguments
// creates random and game objects and
// starts running the game.
//
// Authors: 11804229
// 11814996
// 00713374
//---------------------------------------------------------------------------------------------------------------------
//
#include "Random.hpp"
#include "Game.hpp"
#include "Treasure.hpp"
#include "Player.hpp"
#include "Tile.hpp"
#include "StartTile.hpp"
#include "TreasureTile.hpp"
#include "NormalTile.hpp"
#include "UserInput.hpp"
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <limits>
#include <string>
static const std::string WRONG_ARGS = "Wrong arguments!";
static const size_t RETURN_VALUE_2 = 2;
static const size_t RETURN_VALUE_1 = 1;
static const size_t RETURN_VALUE_0 = 0;
static const size_t ARGUMENT_NUMBER_1 = 1;
using namespace Oop;
int main(int argc, char** argv)
{
if (argc != ARGUMENT_NUMBER_1)
{
std::cout << WRONG_ARGS << std::endl;
return RETURN_VALUE_2;
char** unused_variable_removal = argv;
unused_variable_removal++;
}
size_t player_count;
UserInput user_input;
player_count = user_input.playerAmount();
user_input.setNumberOfPlayers(player_count);
Game& game = Game::gameInstance();
Random& random = Random::getInstance();
try
{
game.run(player_count, user_input, random);
}
catch(std::bad_alloc&)
{
return RETURN_VALUE_1;
}
return RETURN_VALUE_0;
}