-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCell.h
52 lines (39 loc) · 1.42 KB
/
Cell.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// Created by chris on 06.05.21.
//
#pragma once
class Cell {
public:
Cell() = default;
//initializes with given height
explicit Cell(unsigned int height) : height(height), slopeToNeighbours(0) {};
// -----------------------------------------------------------------------------------
// ------------------GETTER AND SETTERS-----------------------------------------------
// -----------------------------------------------------------------------------------
[[nodiscard]] unsigned int getHeight() const {
return height;
}
void setHeight(unsigned int height) {
Cell::height = height;
slopeToNeighbours = 0;
}
[[nodiscard]] int getSlopeToNeighbours() const {
return slopeToNeighbours;
}
void setSlopeToNeighbours(int slopeToNeighbours) {
Cell::slopeToNeighbours = slopeToNeighbours;
}
// -----------------------------------------------------------------------------------
// ------------------METHODS----------------------------------------------------------
// -----------------------------------------------------------------------------------
//increases height by 1
void incHeight() {
height++;
}
friend bool operator==(const Cell &lhs, const Cell &rhs) {
return (lhs.height == rhs.height) && (lhs.getSlopeToNeighbours() == rhs.getSlopeToNeighbours());
}
private:
unsigned int height;
int slopeToNeighbours;
};