~neon/kapman/master

« back to all changes in this revision

Viewing changes to src/cell.cpp

  • Committer: Friedrich W. H. Kossebau
  • Date: 2020-12-30 12:55:56 UTC
  • Revision ID: git-v1:5864d1ce6462952ea2fc8a6a263976a5c97142e8
Move source files into own subfolder src/

GIT_SILENT

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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(nullptr), m_cost(0), m_parent(nullptr)
 
24
{
 
25
}
 
26
 
 
27
Cell::~Cell()
 
28
{
 
29
    m_element = nullptr;
 
30
    delete m_element;
 
31
}
 
32
 
 
33
Cell::Type Cell::getType() const
 
34
{
 
35
    return m_type;
 
36
}
 
37
 
 
38
void Cell::setType(Cell::Type p_type)
 
39
{
 
40
    m_type = p_type;
 
41
}
 
42
 
 
43
Element *Cell::getElement() const
 
44
{
 
45
    return m_element;
 
46
}
 
47
 
 
48
void Cell::setElement(Element *p_element)
 
49
{
 
50
    m_element = p_element;
 
51
}
 
52
 
 
53
int Cell::getCost() const
 
54
{
 
55
    return m_cost;
 
56
}
 
57
 
 
58
void Cell::setCost(const int p_cost)
 
59
{
 
60
    m_cost = p_cost;
 
61
}
 
62
 
 
63
Cell *Cell::getParent() const
 
64
{
 
65
    return m_parent;
 
66
}
 
67
 
 
68
void Cell::setParent(Cell *p_parent)
 
69
{
 
70
    m_parent = p_parent;
 
71
}
 
72