SVN_SILENT made messages (.desktop file)
[kdegames.git] / kapman / cell.h
blob4e37b7ee960420c670be5fa061514fa49d05ff6f
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.
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/>.
18 #ifndef CELL_H
19 #define CELL_H
21 #include <QtGlobal>
23 class Element;
25 /**
26 * @brief This class represents a Cell of the Maze.
28 class Cell {
30 public:
32 /** The Cell side size */
33 static const qreal SIZE;
35 /** The Cell possible types */
36 enum Type {
37 WALL = 0,
38 CORRIDOR = 1,
39 GHOSTCAMP = 2
42 private:
44 /** The Cell type */
45 Type m_type;
47 /** A reference on the Element that is on the Cell */
48 Element* m_element;
50 /** Cost used in A* pathfinding algorithm : lower is the cost, closer to the target Cell is this Cell */
51 int m_cost;
53 /** Parent node used in A* pathfinding algorithm : the Cell which enables to go to this Cell */
54 Cell* m_parent;
56 public:
58 /**
59 * Creates a new Cell instance.
61 Cell();
63 /**
64 * Deletes the Cell instance.
66 ~Cell();
68 /**
69 * Gets the Cell type.
70 * @return the Cell type
72 Type getType();
74 /**
75 * Sets the Cell type.
76 * @param p_type the new type to set
78 void setType(Type p_type);
80 /**
81 * Gets the Element that is on the Cell.
82 * @return the Element that is on the Cell
84 Element* getElement();
86 /**
87 * Sets the Element that is on the Cell.
88 * @param p_element the Element to set on the Cell
90 void setElement(Element* p_element);
92 /**
93 * Gets the Cell cost for A* pathfinding algorithm.
94 * @return the Cell cost for A* pathfinding algorithm
96 int getCost() const;
98 /**
99 * Sets a cost for the Cell, for A* pathfinding algorithm.
100 * @param p_cost the cost of the Cell for A* pathfinding algorithm
102 void setCost(const int p_cost);
105 * Gets the parent Cell of this Cell for A* pathfinding algorithm.
106 * @return the Cell parent for A* pathfinding algorithm
108 Cell* getParent() const;
111 * Sets the parent Cell of this Cell for A* pathfinding algorithm.
112 * @param p_parent the parent of the Cell for A* pathfinding algorithm
114 void setParent(Cell* p_parent);
117 #endif