-
Notifications
You must be signed in to change notification settings - Fork 1
/
collapser.h
64 lines (51 loc) · 1.79 KB
/
collapser.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
#ifndef COLLAPSER_H
#define COLLAPSER_H
#include <QObject>
#include <QSet>
#include <QRandomGenerator>
#include "backenddatadto.h"
#include "tile.h"
class Collapser : public QObject
{
Q_OBJECT
signals:
void tileMapChanged(int index, int newTile);
void updateCanvas();
public:
Collapser() = delete;
Collapser(const BackendDataDto& dto);
~Collapser();
void setNewAvailableTiles(const QList<QList<int>>& sockets);
void resetTileMap();
void setNewWeightMap(const QList<MapConstructor::constructParameters>& constructionParameters);
int getDimensionsWidth(){return m_dimensionsWidth;}
int getDimensionsHeight(){return m_dimensionsHeight;}
int getWindowSizeHorizontalInPixels(){return m_windowSizeHorizontalInPixels;};
QList<int> getTilesToBeColouredDifferently(){return m_tilesToBeColouredDifferently;}
QList<int> getTileMap() {return m_tileMap;}
public slots:
void startCollapsing();
private:
QList<QList<int>> m_sockets;
QList<MapConstructor::constructParameters> m_precollapsedTilesConstructionInstructions;
QList<MapConstructor::constructParameters> m_weightmapConstructionInstructions;
QList<QList<int>> m_availableWeightLists;
QList<int> m_tileMap;
QList<Tile> m_allTiles;
QList<int> m_disadvantageWeightMap;
QList<int> m_tilesToBeColouredDifferently;
QSet<int> m_indecesToCheck;
int m_dimensionsWidth;
int m_dimensionsHeight;
int m_windowSizeHorizontalInPixels;
int m_dimensionsWidthHeight;
int m_numberOfTiles;
QRandomGenerator *m_randomGenerator;
int m_collapsed ;
private:
void collapse();
int calculateIndexToCollapseNext();
bool checkIfTileFits(const int& pos,const Tile& tile) const;
void enableSurroundingIndecesToBeChecked(const int& pos);
};
#endif // COLLAPSER_H