-
Notifications
You must be signed in to change notification settings - Fork 2
/
GameEngine.h
130 lines (99 loc) · 2.76 KB
/
GameEngine.h
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//
// Created by Eve Gagnon on 2021-10-08.
//
#ifndef COMP345_GAMEENGINE_H
#define COMP345_GAMEENGINE_H
//
// Created by Eve Gagnon on 2021-09-26.
//
#include <iostream>
#include <unordered_map>
#include "Player.h"
#include "LoggingObserver.h"
// Makes sure the content is read only once if the file is read more than one.
using namespace std;
class CommandProcessor;
class Queue;
class Deck;
class Player;
class GameEngine: public ILoggable,public Subject {
public:
string stringToLog();
Queue* queue;
string LogMessage;
void transition(string);
CommandProcessor *c;
GameEngine();
bool redistribute(Player *p);
bool readFromFile ;
string filename;
GameEngine(GameEngine const&);
// Accessors
// Functions
static void printMenu();
Map* map;
Deck* gameDeck;
vector<Player*> players;
void RemovePlayer(Player * p);
vector<Player*> listOfTournamentPlayers;
vector<string>strategies;
vector<string> mapsToLoad;
int numbersToPlay;
int numberOfTurns;
bool isTournament=false;
void start();
bool loadMap(const string&);
bool validateMap();
bool addPlayer(string);
bool assignCountries();
void issueOrder();
bool quit();
bool replay();
bool gameStart();
bool draw=false;
int numberOftimesHecannotattack=0;
void win();
void tournamentSetup(string);
void play();
void end();
void startupphase();
void verification();
void endIssueOrders(); // endissueorders and endexecorders pretty much just end the phase so we can move on
// to the next state, allowing the user to enter a different set of commands.
void execOrder();
void endExecOrders();
~GameEngine();
GameEngine& operator =(const GameEngine &m);
void issueOrdersPhase();
bool executeOrdersPhase();
void reinforcementPhase();
string mainGameLoop();
int gameReinforcementPool = 2 * 60;
unordered_map<string, unordered_map<string, string>> gameBlock;
};
class Queue {
public:
// Initialize front and rear
// Circular Queue
vector<Player*> queue;
void enQueue(Player* player);
Player* deQueue();
};
ostream& operator <<(ostream &strm,const GameEngine &m);
class Command: public ILoggable,public Subject {
public:
// Constructor takes the current
string name;
Command();
Command(string);
string LogMessage;
void saveEffect(string);
Command(Command const &);
string stringToLog();
string effect;
// Empty constructor
~Command();
//bool executeCommand();
};
ostream& operator <<(ostream &strm,const Command &m);
#endif //COMP345_GAMEENGINE_H