Skip to content

Commit d5c4ee3

Browse files
7 moved Island class definitions into source file (#31)
Co-authored-by: Kacu <kacper.kaleta@scythe-studio.com>
1 parent 77cb21d commit d5c4ee3

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

shm/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ project(SHM)
1010

1111
# set executables
1212
set(THIS_PROJECT_SRC_DIRECTORIES
13+
source/Island.cpp
1314
source/Fortune.cpp
1415
source/Map.cpp
1516
source/Game.cpp

shm/source/Island.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "Island.hpp"
2+
3+
Island::Coordinates::Coordinates(const int x, const int y):
4+
positionX(x),
5+
positionY(y)
6+
{}
7+
8+
bool Island::Coordinates::operator==(const Coordinates& coordinates) {
9+
return (positionX == coordinates.positionX && positionY == coordinates.positionY);
10+
}
11+
12+
Island::Island(const Coordinates& coordinates):
13+
position_(coordinates)
14+
{}
15+
16+
Island::Coordinates Island::getPosition() const {
17+
return position_;
18+
}

shm/source/Island.hpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,14 @@ struct Island {
55
int positionX;
66
int positionY;
77

8-
Coordinates(const int x, const int y):
9-
positionX(x),
10-
positionY(y)
11-
{}
8+
Coordinates(const int x, const int y);
129

13-
bool operator==(const Coordinates& coordinates) {
14-
return (positionX == coordinates.positionX && positionY == coordinates.positionY);
15-
}
10+
bool operator==(const Coordinates& coordinates);
1611
};
1712

18-
public:
19-
Island(const Coordinates& coordinates):
20-
position_(coordinates)
21-
{}
13+
Island(const Coordinates& coordinates);
2214

23-
Coordinates getPosition() const { return position_; }
15+
Coordinates getPosition() const;
2416

2517
private:
2618
Coordinates position_;

0 commit comments

Comments
 (0)