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 | |
63 | |