-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
130 lines (124 loc) · 3.1 KB
/
mainwindow.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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QWidget>
#include <QString>
#include <QStringList>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QScrollArea>
#include <QPushButton>
#include <QPixmap>
#include <QLabel>
#include <QTransform>
#include <QInputDialog>
#include <QMessageBox>
#include <QApplication>
#include <QDesktopWidget>
#include <QIcon>
#include <vector>
#include <string>
#include "deck.h"
#include "table.h"
#include "player.h"
#include "follower.h"
#include "followerplacer.h"
#include "occupationmapper.h"
#include "piece.h"
#include "dragonmover.h"
using namespace std;
class MainWindow : public QMainWindow {
Q_OBJECT
private:
int tileSizes[6] = {25, 50, 100, 200, 400, 800};
int zoom;
int screenSize;
int drawn;
int turn;
int rules;
bool active;
bool portalActive;
bool gameOver;
bool builderRedraw;
bool builderPlaced;
bool innsAndCathedrals;
bool tradersAndBuilders;
bool princessAndDragon;
bool volcanoPlayed;
bool placeFairy;
QString *baseDir;
QWidget *window;
QWidget *tableArea;
QWidget *rotateButtons;
QWidget *zoomButtons;
QScrollArea *scroll;
QHBoxLayout *mainLayout;
QHBoxLayout *rotateLayout;
QHBoxLayout *zoomLayout;
QGridLayout *tableLayout;
QVBoxLayout *controlLayout;
QLabel *currentDraw;
QLabel *tileCounter;
QPixmap *backDrawPile;
QPixmap *backTable;
QPixmap *barrelImg;
QPixmap *barleyImg;
QPixmap *clothImg;
Table *table;
Deck *deck;
QPushButton *draw;
QPushButton *rotateCCW;
QPushButton *rotateCW;
QPushButton *zoomInButton;
QPushButton *zoomOutButton;
vector<Player*> players;
vector<QLabel*> scoreLabels;
vector<QWidget*> scoreWidgets;
vector<QVBoxLayout*> scoreLayouts;
vector<QHBoxLayout*> merchandiseLayouts;
vector<vector<QLabel*>*> merchandiseLabels;
set<int> validPlacePositions;
set<int> validRiverPositions;
FollowerPlacer *placer;
FollowerType followerType;
TableLabel *currentLabel;
OccupationMapper *occupationMapper;
Piece *fairyPiece;
Piece *dragonPiece;
Tile *placingTile;
bool legalMovesExist(Tile *t);
bool riverDoesUTurn(int x, int y);
void checkFeatureCompletion();
void advanceTurn();
void redrawTable();
int translatePointToSubtile(int x, int y, int size);
void restoreFollowerToPlayer(Follower *f);
int getMaxValue(vector<int> nums);
void addScore(int score, int player);
void addScore(int score, Player *p);
void addMerchandise(int barrels, int barley, int spools);
void countFinalScore();
void checkFarmerPigStatus();
void updateValidPositions(int x, int y, bool first = false);
bool isValidPosition(int x, int y);
bool canPlaceFairy();
vector<Follower*> followersToEvict();
Follower* haveUserPickFollower(vector<Follower*> fs, bool addPlayer);
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void drawTile();
void selectedTableLabel();
void rotateClockwise();
void rotateCounterClockwise();
void zoomIn();
void zoomOut();
public slots:
void start(int x, int y, int p, int r, QStringList *decks, QStringList *rulesList);
void placeFollower(const QPoint p);
void setFollowerType(FollowerType ft);
void keepPortalActive();
};
#endif