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/BoardLayout.cpp | 300 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 kmahjongg/BoardLayout.cpp (limited to 'kmahjongg/BoardLayout.cpp') diff --git a/kmahjongg/BoardLayout.cpp b/kmahjongg/BoardLayout.cpp new file mode 100644 index 00000000..56659611 --- /dev/null +++ b/kmahjongg/BoardLayout.cpp @@ -0,0 +1,300 @@ + +#include "BoardLayout.h" +#include +#include +#include + + + + + +BoardLayout::BoardLayout() +{ + filename=""; + clearBoardLayout(); +} + +BoardLayout::~BoardLayout() +{ +} + +void BoardLayout::clearBoardLayout() { + loadedBoard=""; + initialiseBoard(); +} + +bool BoardLayout::saveBoardLayout(const QString where) { + QFile f(where); + if (!f.open(IO_ReadWrite)) { + return false; + } + + QCString tmp = layoutMagic1_0.utf8(); + if (f.writeBlock(tmp, tmp.length()) == -1) { + return(false); + } + + for (int z=0; z0; x--) { + board[z][y][x] = board[z][y][x-1]; + } + board[z][y][0] = 0; + } + } +} +void BoardLayout::shiftUp() { + for (int z=0; z0; y--) { + for (int x=0; x= depth -1) + return false; + if( board[z+1][y][x] || board[z+1][y+1][x] || board[z+1][y][x+1] || board[z+1][y+1][x+1] ) { + return true; + } + return false; +} + + +bool BoardLayout::blockedLeftOrRight(short z, short y, short x) { + return( (board[z][y][x-1] || board[z][y+1][x-1]) && + (board[z][y][x+2] || board[z][y+1][x+2]) ); +} + +void BoardLayout::deleteTile(POSITION &p) { + if ( p.e