From c90c389a8a8d9d8661e9772ec4144c5cf2039f23 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- kmahjongg/boardwidget.h | 244 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 kmahjongg/boardwidget.h (limited to 'kmahjongg/boardwidget.h') diff --git a/kmahjongg/boardwidget.h b/kmahjongg/boardwidget.h new file mode 100644 index 00000000..4c042c38 --- /dev/null +++ b/kmahjongg/boardwidget.h @@ -0,0 +1,244 @@ +#ifndef BOARDWIDGET_H +#define BOARDWIDGET_H + +#include +#include +#include + + +#include "KmTypes.h" +#include "Tileset.h" +#include "Background.h" +#include "BoardLayout.h" + +typedef struct gamedata { + int allow_undo; + int allow_redo; + UCHAR Board[BoardLayout::depth][BoardLayout::height][BoardLayout::width]; + USHORT TileNum; + USHORT MaxTileNum; + UCHAR Mask[BoardLayout::depth][BoardLayout::height][BoardLayout::width]; + UCHAR hilighted[BoardLayout::depth][BoardLayout::height][BoardLayout::width]; + POSITION MoveList[BoardLayout::maxTiles]; + void putTile( short e, short y, short x, UCHAR f ) + { + + + Board[e][y][x] = Board[e][y+1][x] = + Board[e][y+1][x+1] = Board[e][y][x+1] = f; + } + void putTile( POSITION& pos ) + { + putTile( pos.e, pos.y, pos.x, pos.f ); + } + + + bool tilePresent(int z, int y, int x) { + return(Board[z][y][x]!=0 && Mask[z][y][x] == '1'); + } + + bool partTile(int z, int y, int x) { + return (Board[z][y][x] != 0); + } + + int shadowHeight(int z, int y, int x) { + + + if ((z>=BoardLayout::depth||y>=BoardLayout::height||x>=BoardLayout::width)) + return 0; + + + if ((y < 0) || (x < 0)) + return 0; + + int h=0; + for (int e=z; e