Skip to content

7 moved Island class definitions into source file #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions shm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ project(SHM)

# set executables
set(THIS_PROJECT_SRC_DIRECTORIES
source/Island.cpp
source/Fortune.cpp
source/Map.cpp
source/Game.cpp
Expand Down
18 changes: 18 additions & 0 deletions shm/source/Island.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "Island.hpp"

Island::Coordinates::Coordinates(const int x, const int y):
positionX(x),
positionY(y)
{}

bool Island::Coordinates::operator==(const Coordinates& coordinates) {
return (positionX == coordinates.positionX && positionY == coordinates.positionY);
}

Island::Island(const Coordinates& coordinates):
position_(coordinates)
{}

Island::Coordinates Island::getPosition() const {
return position_;
}
16 changes: 4 additions & 12 deletions shm/source/Island.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,14 @@ struct Island {
int positionX;
int positionY;

Coordinates(const int x, const int y):
positionX(x),
positionY(y)
{}
Coordinates(const int x, const int y);

bool operator==(const Coordinates& coordinates) {
return (positionX == coordinates.positionX && positionY == coordinates.positionY);
}
bool operator==(const Coordinates& coordinates);
};

public:
Island(const Coordinates& coordinates):
position_(coordinates)
{}
Island(const Coordinates& coordinates);

Coordinates getPosition() const { return position_; }
Coordinates getPosition() const;

private:
Coordinates position_;
Expand Down