blob: 468bf5bc6a2b7a853128692f6223987328a51451 (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#ifndef __BOARD__LAYOUT_
#define __BOARD__LAYOUT_
#include <tqstring.h>
#include "KmTypes.h"
const TQString layoutMagic1_0 = "kmahjongg-layout-v1.0";
class BoardLayout {
public:
BoardLayout();
~BoardLayout();
bool loadBoardLayout(const TQString from);
bool saveBoardLayout(const TQString 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 };
TQString &getFilename() {return filename;}
protected:
void initialiseBoard();
private:
TQString filename;
TQString loadedBoard;
UCHAR board[depth][height][width];
unsigned short maxTileNum;
};
#endif
|