• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kmahjongg

  • sources
  • kde-4.14
  • kdegames
  • kmahjongg
BoardLayout.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 1997 Mathias Mueller <in5y158@public.uni-hamburg.de>
3 
4  Kmahjongg is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef BOARD_LAYOUT_H
20 #define BOARD_LAYOUT_H
21 
22 #include <QString>
23 #include <QByteArray>
24 #include "KmTypes.h"
25 
26 const QString layoutMagic1_0 = "kmahjongg-layout-v1.0";
27 const QString layoutMagic1_1 = "kmahjongg-layout-v1.1";
28 
36 class BoardLayout {
37 
38 public:
42  BoardLayout();
43 
46  BoardLayout(const BoardLayout &boardLayout);
47 
51  ~BoardLayout();
59  bool loadBoardLayout(const QString &from);
68  bool loadBoardLayout_10(const QString &from);
77  bool saveBoardLayout(const QString &where);
86  UCHAR getBoardData(short z, short y, short x);
95  void setBoardData(short z, short y, short x, UCHAR value);
96 
106  bool tileAbove(short z, short y, short x);
115  bool tileAbove(POSITION &p) { return(tileAbove(p.e, p.y, p.x)); }
116 
126  bool blockedLeftOrRight(short z, short y, short x);
132  void deleteTile(POSITION &p);
140  bool anyFilled(POSITION &p);
148  bool allFilled(POSITION &p);
155  void insertTile(POSITION &p);
164  bool isTileAt(POSITION &p) { return getBoardData(p.e, p.y, p.x) == '1'; }
171  void copyBoardLayout(UCHAR *to , unsigned short &numTiles);
175  void clearBoardLayout();
179  void shiftLeft();
183  void shiftRight();
187  void shiftUp();
191  void shiftDown();
192 
195  QByteArray getLoadedBoard() const;
196 
199  QByteArray getBoard() const;
200 
203  unsigned short getMaxTileNum() const;
204 
205  int m_width;
206  int m_height;
207  int m_depth;
208  int m_maxTiles;
214  QString getFilename() const;
215 
216 protected:
220  void initialiseBoard();
221 
222 private:
223  QString filename;
224  QByteArray loadedBoard;
225  QByteArray board;
226  unsigned short maxTileNum;
227 };
228 
229 #endif
230 
BoardLayout::initialiseBoard
void initialiseBoard()
Protected Method description.
Definition: BoardLayout.cpp:219
BoardLayout::insertTile
void insertTile(POSITION &p)
Description.
Definition: BoardLayout.cpp:403
BoardLayout::clearBoardLayout
void clearBoardLayout()
Method description.
Definition: BoardLayout.cpp:71
QByteArray
BoardLayout::m_height
int m_height
Member Description.
Definition: BoardLayout.h:206
BoardLayout::loadBoardLayout_10
bool loadBoardLayout_10(const QString &from)
Method description.
Definition: BoardLayout.cpp:120
BoardLayout::shiftUp
void shiftUp()
Method description.
Definition: BoardLayout.cpp:313
BoardLayout::getFilename
QString getFilename() const
Get filename.
Definition: BoardLayout.cpp:51
pos::e
USHORT e
Member Description.
Definition: KmTypes.h:36
BoardLayout::getLoadedBoard
QByteArray getLoadedBoard() const
Get the loaded board.
Definition: BoardLayout.cpp:56
KmTypes.h
BoardLayout::copyBoardLayout
void copyBoardLayout(UCHAR *to, unsigned short &numTiles)
Description.
Definition: BoardLayout.cpp:266
BoardLayout::~BoardLayout
~BoardLayout()
Default Deconstructor.
Definition: BoardLayout.cpp:47
BoardLayout::deleteTile
void deleteTile(POSITION &p)
Description.
Definition: BoardLayout.cpp:381
BoardLayout::getBoardData
UCHAR getBoardData(short z, short y, short x)
Method description.
Definition: BoardLayout.cpp:410
BoardLayout::getBoard
QByteArray getBoard() const
Get the board.
Definition: BoardLayout.cpp:61
BoardLayout::tileAbove
bool tileAbove(POSITION &p)
is there a tile anywhere above here (top left to bot right quarter)
Definition: BoardLayout.h:115
pos::x
USHORT x
Member Description.
Definition: KmTypes.h:38
BoardLayout::m_width
int m_width
Member Description.
Definition: BoardLayout.h:205
BoardLayout::setBoardData
void setBoardData(short z, short y, short x, UCHAR value)
Method description.
Definition: BoardLayout.cpp:414
BoardLayout::BoardLayout
BoardLayout()
Default Constructor.
Definition: BoardLayout.cpp:25
BoardLayout::saveBoardLayout
bool saveBoardLayout(const QString &where)
Method description.
Definition: BoardLayout.cpp:76
QString
BoardLayout::shiftDown
void shiftDown()
Method description.
Definition: BoardLayout.cpp:339
layoutMagic1_1
const QString layoutMagic1_1
Definition: BoardLayout.h:27
pos::y
USHORT y
Member Description.
Definition: KmTypes.h:37
layoutMagic1_0
const QString layoutMagic1_0
Definition: BoardLayout.h:26
pos
struct pos POSITION
Definition: KmTypes.h:34
BoardLayout::m_maxTiles
int m_maxTiles
Member Description.
Definition: BoardLayout.h:208
BoardLayout::getMaxTileNum
unsigned short getMaxTileNum() const
Get max tile num.
Definition: BoardLayout.cpp:66
BoardLayout::m_depth
int m_depth
Member Description.
Definition: BoardLayout.h:207
BoardLayout::isTileAt
bool isTileAt(POSITION &p)
Description.
Definition: BoardLayout.h:164
BoardLayout::shiftLeft
void shiftLeft()
Method description.
Definition: BoardLayout.cpp:271
BoardLayout
This class implements methods for loading and manipulating board.
Definition: BoardLayout.h:36
UCHAR
unsigned char UCHAR
Definition: KmTypes.h:25
BoardLayout::tileAbove
bool tileAbove(short z, short y, short x)
is there a tile anywhere above here (top left to bot right quarter)
Definition: BoardLayout.cpp:366
BoardLayout::blockedLeftOrRight
bool blockedLeftOrRight(short z, short y, short x)
is this tile blocked to the left or right
Definition: BoardLayout.cpp:376
BoardLayout::shiftRight
void shiftRight()
Method description.
Definition: BoardLayout.cpp:293
BoardLayout::anyFilled
bool anyFilled(POSITION &p)
Description.
Definition: BoardLayout.cpp:391
BoardLayout::allFilled
bool allFilled(POSITION &p)
Description.
Definition: BoardLayout.cpp:397
BoardLayout::loadBoardLayout
bool loadBoardLayout(const QString &from)
Method description.
Definition: BoardLayout.cpp:165
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmahjongg

Skip menu "kmahjongg"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal