summaryrefslogtreecommitdiffstats
path: root/kfouleggs/board.h
blob: e0889b3b43732facaf9e0cdf78d81000f12574ed (plain)
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
#ifndef FE_BOARD_H
#define FE_BOARD_H

#include "common/board.h"


class FEBoard : public Board
{
 Q_OBJECT
 public:
    FEBoard(bool graphic, QWidget *parent);
	void copy(const GenericTetris &);

	void start(const GTInitData &);

    uint nbPuyos() const { return _nbPuyos; }
    uint chained() const { return _chained; }
    uint nbChainedPuyos(uint i) const { return _chainedPuyos[i]; }
    uint lastChained() const { return _lastChained; }

 private:
	// standard methods
	bool afterGlue(bool doAll, bool first);
	AfterRemoveResult afterRemove(bool doAll, bool first);
	bool afterGift(bool first) { return !doFall(false, first, true); }
    void removeBlock(const KGrid2D::Coord &);
    bool toBeRemoved(const KGrid2D::Coord &) const;
    bool toFall(const KGrid2D::Coord &) const;
	void remove();
	bool needRemoving();
    void computeInfos();
    
    void init();

	// Multiplayers methods
	uint gift();
	bool putGift(uint);

	KGrid2D::Square<int> _field;
	QMemArray<uint>     _groups, _chainedPuyos;
	uint                _nbPuyos, _chained, _giftRest, _lastChained;
};

#endif