From fceae8cadb302125f9813667bd8ab935ae19b652 Mon Sep 17 00:00:00 2001 From: KrzysztofJ85 Date: Sat, 20 Jun 2020 22:04:59 +0200 Subject: [PATCH] compilation fix --- shm/Coordinates.cpp | 6 +++++- shm/Coordinates.hpp | 4 +--- shm/Island.cpp | 3 +++ shm/Island.hpp | 2 +- shm/Map.cpp | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/shm/Coordinates.cpp b/shm/Coordinates.cpp index bb5ce3551..966d5a415 100644 --- a/shm/Coordinates.cpp +++ b/shm/Coordinates.cpp @@ -1,5 +1,9 @@ #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; @@ -7,4 +11,4 @@ bool Coordinates::operator==(const Coordinates& coordinatesToCheck) const { bool Coordinates::operator!=(const Coordinates& coordinatesToCheck) const { return !(*this == coordinatesToCheck); -} \ No newline at end of file +} diff --git a/shm/Coordinates.hpp b/shm/Coordinates.hpp index fccbc6a2e..63f1bf842 100644 --- a/shm/Coordinates.hpp +++ b/shm/Coordinates.hpp @@ -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; diff --git a/shm/Island.cpp b/shm/Island.cpp index 08d1202ff..70dbbb731 100644 --- a/shm/Island.cpp +++ b/shm/Island.cpp @@ -1 +1,4 @@ #include "Island.hpp" + +Island::Island(int posX, int posY) + : _position(posX, posY) {} diff --git a/shm/Island.hpp b/shm/Island.hpp index 5a0190d7d..3bb9cfe1a 100644 --- a/shm/Island.hpp +++ b/shm/Island.hpp @@ -4,9 +4,9 @@ class Island { public: + Island(int posX, int posY); Coordinates getPosition() const { return _position; } private: Coordinates _position; }; - diff --git a/shm/Map.cpp b/shm/Map.cpp index 87cf141b5..65b0b5f2a 100644 --- a/shm/Map.cpp +++ b/shm/Map.cpp @@ -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++; } }