-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGame.h
54 lines (40 loc) · 944 Bytes
/
Game.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
#ifndef GAME_H
#define GAME_H
#include "GameMap.h"
#include "Player.h"
#include "common.h"
#include <QList>
#include <QPoint>
#include <QObject>
class Game : public QObject
{
Q_OBJECT
public:
Game();
Player* addHumanPlayer();
Player* addAIPlayer(Difficulty mode);
void removeAllPlayers();
GameMap* map();
void reset();
Player* currentPlayer();
PlayerIcon currentPlayerIcon();
bool allowsInput();
bool isRunning();
QList<Player*> players() const;
public slots:
bool activateField(QPoint pos);
bool activateField(int x, int y);
void start();
void end();
signals:
void winner(Player *p, QSet<QPoint> fields);
private:
void nextTurn();
bool checkWinner(int x, int y);
const int winLength = 3;
GameMap m_map;
QList<Player*> m_players;
int curPlayerId;
bool active;
};
#endif // GAME_H