diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | c90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch) | |
tree | 6d8391395bce9eaea4ad78958617edb20c6a7573 /kmahjongg/BoardLayout.h | |
download | tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmahjongg/BoardLayout.h')
-rw-r--r-- | kmahjongg/BoardLayout.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/kmahjongg/BoardLayout.h b/kmahjongg/BoardLayout.h new file mode 100644 index 00000000..60048bc9 --- /dev/null +++ b/kmahjongg/BoardLayout.h @@ -0,0 +1,62 @@ +#ifndef __BOARD__LAYOUT_ +#define __BOARD__LAYOUT_ + +#include <qstring.h> +#include "KmTypes.h" + +const QString layoutMagic1_0 = "kmahjongg-layout-v1.0"; + +class BoardLayout { + +public: + BoardLayout(); + ~BoardLayout(); + + bool loadBoardLayout(const QString from); + bool saveBoardLayout(const QString where); + UCHAR getBoardData(short z, short y, short x) {return board[z][y][x];} + + // is there a tile anywhere above here (top left to bot right quarter) + bool tileAbove(short z, short y, short x); + bool tileAbove(POSITION &p) { return(tileAbove(p.e, p.y, p.x)); } + + // is this tile blocked to the left or right + bool blockedLeftOrRight(short z, short y, short x); + + void deleteTile(POSITION &p); + + bool anyFilled(POSITION &p); + bool allFilled(POSITION &p); + void insertTile(POSITION &p); + bool isTileAt(POSITION &p) { return board[p.e][p.y][p.x] == '1'; } + + + + const char *getBoardLayout(); + void copyBoardLayout(UCHAR *to , unsigned short &numTiles); + void clearBoardLayout(); + void shiftLeft(); + void shiftRight(); + void shiftUp(); + void shiftDown(); + + + enum { width = 32, + height = 16, + depth = 5 }; + enum { maxTiles = (depth*width*height)/4 }; + + QString &getFilename() {return filename;} + +protected: + + void initialiseBoard(); + +private: + QString filename; + QString loadedBoard; + UCHAR board[depth][height][width]; + unsigned short maxTileNum; +}; + +#endif |