1 | /*************************************************************************** |
2 | * KBlocks, a falling blocks game for KDE * |
3 | * Copyright (C) 2010 Zhongjie Cai <squall.leonhart.cai@gmail.com> * |
4 | * * |
5 | * This program is free software; you can redistribute it and/or modify * |
6 | * it under the terms of the GNU General Public License as published by * |
7 | * the Free Software Foundation; either version 2 of the License, or * |
8 | * (at your option) any later version. * |
9 | ***************************************************************************/ |
10 | #ifndef KBLOCKSFIELD_H |
11 | #define KBLOCKSFIELD_H |
12 | |
13 | #include "FieldInterface.h" |
14 | |
15 | class KBlocksField : public FieldInterface |
16 | { |
17 | protected: |
18 | bool** maBoard; |
19 | int mHeight; |
20 | int mWidth; |
21 | |
22 | private: |
23 | int mCurModifyID; |
24 | int mLastModifyID; |
25 | unsigned char* maEncodeData; |
26 | |
27 | public: |
28 | explicit KBlocksField(int width = 10, int height = 20); |
29 | explicit KBlocksField(FieldInterface * p); |
30 | ~KBlocksField(); |
31 | |
32 | public: |
33 | bool getCell(int xPos, int yPos); |
34 | void setCell(int xPos, int yPos, bool value); |
35 | |
36 | void copy(FieldInterface * p); |
37 | void clear(); |
38 | |
39 | bool checkFilledLine(int lineID); |
40 | void removeFilledLine(int lineID); |
41 | |
42 | bool addPunishLine(int lineCount, int punishSeed); |
43 | |
44 | int getModifyID(); |
45 | int encodeData(unsigned char * data); |
46 | void decodeData(unsigned char * data); |
47 | |
48 | int getWidth(); |
49 | int getHeight(); |
50 | |
51 | bool equals(KBlocksField * rhs); |
52 | |
53 | int getBlockHeight(int xPos); |
54 | int getFreeHeight(int xPos); |
55 | void getSignature(int * data); |
56 | }; |
57 | |
58 | #endif |
59 | |
60 | |