Skip to content

Commit

Permalink
compilation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
madebykj committed Jun 20, 2020
1 parent fd3b6af commit fceae8c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
6 changes: 5 additions & 1 deletion shm/Coordinates.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#include "Coordinates.hpp"

Coordinates::Coordinates(const int positionX,
const int positionY)
: _positionX(positionX), _positionY(positionY) {}

bool Coordinates::operator==(const Coordinates& coordinatesToCheck) const {
return _positionX == coordinatesToCheck._positionX &&
_positionY == coordinatesToCheck._positionY;
}

bool Coordinates::operator!=(const Coordinates& coordinatesToCheck) const {
return !(*this == coordinatesToCheck);
}
}
4 changes: 1 addition & 3 deletions shm/Coordinates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

class Coordinates {
public:
Coordinates(const int positionX,
const int positionY)
: _positionX(positionX), _positionY(positionY) {}
Coordinates(const int positionX, const int positionY);

bool operator==(const Coordinates& coordinatesToCheck) const;
bool operator!=(const Coordinates& coordinatesToCheck) const;
Expand Down
3 changes: 3 additions & 0 deletions shm/Island.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
#include "Island.hpp"

Island::Island(int posX, int posY)
: _position(posX, posY) {}
2 changes: 1 addition & 1 deletion shm/Island.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

class Island {
public:
Island(int posX, int posY);
Coordinates getPosition() const { return _position; }

private:
Coordinates _position;
};

2 changes: 1 addition & 1 deletion shm/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Map::Map() {
if (std::none_of(_vecOfIslands.begin(), _vecOfIslands.end(), [positionX, positionY](auto& i) {
return i.getPosition() == Coordinates(positionX, positionY);
})) {
_vecOfIslands.emplace_back(Island(positionX, positionY));
_vecOfIslands.push_back(Island(positionX, positionY));
notRepeatedPositions++;
}
}
Expand Down

0 comments on commit fceae8c

Please sign in to comment.