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

kapman

  • sources
  • kde-4.14
  • kdegames
  • kapman
cell.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (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, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "cell.h"
19 #include "element.h"
20 
21 const qreal Cell::SIZE = 20.0;
22 
23 Cell::Cell() : m_type(Cell::WALL), m_element(NULL), m_cost(0), m_parent(NULL) {
24 }
25 
26 Cell::~Cell() {
27  m_element = NULL;
28  delete m_element;
29 }
30 
31 Cell::Type Cell::getType() const {
32  return m_type;
33 }
34 
35 void Cell::setType(Cell::Type p_type) {
36  m_type = p_type;
37 }
38 
39 Element* Cell::getElement() const {
40  return m_element;
41 }
42 
43 void Cell::setElement(Element* p_element) {
44  m_element = p_element;
45 }
46 
47 int Cell::getCost() const {
48  return m_cost;
49 }
50 
51 void Cell::setCost(const int p_cost) {
52  m_cost = p_cost;
53 }
54 
55 Cell* Cell::getParent() const {
56  return m_parent;
57 }
58 
59 void Cell::setParent(Cell* p_parent) {
60  m_parent = p_parent;
61 }
62 
Cell::setElement
void setElement(Element *p_element)
Sets the Element that is on the Cell.
Definition: cell.cpp:43
Cell::getElement
Element * getElement() const
Gets the Element that is on the Cell.
Definition: cell.cpp:39
element.h
Cell
This class represents a Cell of the Maze.
Definition: cell.h:28
Cell::getType
Type getType() const
Gets the Cell type.
Definition: cell.cpp:31
Cell::getParent
Cell * getParent() const
Gets the parent Cell of this Cell for A* pathfinding algorithm.
Definition: cell.cpp:55
Cell::getCost
int getCost() const
Gets the Cell cost for A* pathfinding algorithm.
Definition: cell.cpp:47
Cell::setCost
void setCost(const int p_cost)
Sets a cost for the Cell, for A* pathfinding algorithm.
Definition: cell.cpp:51
Cell::SIZE
static const qreal SIZE
The Cell side size.
Definition: cell.h:33
cell.h
Cell::~Cell
~Cell()
Deletes the Cell instance.
Definition: cell.cpp:26
Element
This class describes the common characteristics and behaviour of any game Element (character or item)...
Definition: element.h:30
Cell::setParent
void setParent(Cell *p_parent)
Sets the parent Cell of this Cell for A* pathfinding algorithm.
Definition: cell.cpp:59
Cell::setType
void setType(Type p_type)
Sets the Cell type.
Definition: cell.cpp:35
Cell::Type
Type
The Cell possible types.
Definition: cell.h:36
Cell::Cell
Cell()
Creates a new Cell instance.
Definition: cell.cpp:23
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:15 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kapman

Skip menu "kapman"
  • 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