diff options
Diffstat (limited to 'ksirtet/ksirtet/board.h')
-rw-r--r-- | ksirtet/ksirtet/board.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ksirtet/ksirtet/board.h b/ksirtet/ksirtet/board.h new file mode 100644 index 00000000..90b1c231 --- /dev/null +++ b/ksirtet/ksirtet/board.h @@ -0,0 +1,50 @@ +#ifndef KS_BOARD_H +#define KS_BOARD_H + +#include "common/board.h" + + +class KSBoard : public Board +{ + Q_OBJECT + public: + KSBoard(bool graphic, QWidget *parent); + void copy(const GenericTetris &); + + void start(const GTInitData &); + enum Constants { Width = 10, Nb_Stages = 6 }; + uint nbRemovedLines(uint i) const { return linesRemoved[i]; } + uint lastRemoved() const { return _lastRemoved; } + + private: + QMemArray<uint> filled; + QMemArray<uint> linesRemoved; + uint addRemoved; + uint _lastRemoved; + + struct StageData { + uint todo, speed; + bool hasPattern; + uint pattern[Width]; + }; + static const StageData STAGE_DATA[Nb_Stages]; + + void init(); + uint gift(); + bool putGift(uint nb); + bool _putGift(uint nb); + bool needRemoving(); + void remove(); + bool toBeRemoved(const KGrid2D::Coord &) const; + bool toFall(const KGrid2D::Coord &) const; + void computeInfos(); + void setGarbageBlock(const KGrid2D::Coord &); + + const StageData &stageData() const { return STAGE_DATA[arcadeStage()]; } + uint normalTime() const; + uint arcadeTodo() const { return stageData().todo; } + uint arcadeDone() const { return nbRemoved(); } + void arcadePrepare(); +}; + +#endif |