aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/cell_helper.hpp3
-rw-r--r--src/game/cell_helper_impl.hpp10
-rw-r--r--src/interfaces/cell_helper.hpp9
3 files changed, 9 insertions, 13 deletions
diff --git a/src/game/cell_helper.hpp b/src/game/cell_helper.hpp
index f76497a..ee5ab27 100644
--- a/src/game/cell_helper.hpp
+++ b/src/game/cell_helper.hpp
@@ -7,6 +7,7 @@
#include <list>
#include <memory>
+#include <vector>
template <typename MatrixElement>
class CellHelper : public ICellHelper
@@ -22,7 +23,7 @@ public:
-> std::list<Vector2> override;
[[nodiscard]] auto find_neighbours(const Vector2 &cell_pos) const noexcept
- -> std::list<Vector2> override;
+ -> std::vector<Vector2> override;
private:
const IMatrix<MatrixElement> &_matrix;
diff --git a/src/game/cell_helper_impl.hpp b/src/game/cell_helper_impl.hpp
index ebb35aa..b7da413 100644
--- a/src/game/cell_helper_impl.hpp
+++ b/src/game/cell_helper_impl.hpp
@@ -41,7 +41,7 @@ auto CellHelper<MatrixElement>::get_birth_cell_positions(
for (const auto &cell_pos : cell_positions)
{
- const std::list<Vector2> empty_neighbour_positions =
+ const std::vector<Vector2> empty_neighbour_positions =
container_filter(find_neighbours(cell_pos), has_matrix_value(_matrix, ' '));
all_empty_neighbour_positions.insert(
@@ -70,9 +70,9 @@ auto CellHelper<MatrixElement>::get_birth_cell_positions(
template <typename MatrixElement>
auto CellHelper<MatrixElement>::find_neighbours(const Vector2 &cell_pos) const noexcept
- -> std::list<Vector2>
+ -> std::vector<Vector2>
{
- std::list<Vector2> cell_positions = {};
+ std::vector<Vector2> cell_positions = {};
const auto matrix_size =
Bounds({.width = _matrix.get_column_cnt(), .height = _matrix.get_row_cnt()});
@@ -91,8 +91,8 @@ auto CellHelper<MatrixElement>::find_neighbours(const Vector2 &cell_pos) const n
}
template <typename MatrixElement>
-auto CellHelper<MatrixElement>::_get_position_neighbours(
- const Vector2 &position) noexcept -> std::list<Vector2>
+auto CellHelper<MatrixElement>::_get_position_neighbours(const Vector2 &position) noexcept
+ -> std::list<Vector2>
{
return {
position + Vector2::up(),
diff --git a/src/interfaces/cell_helper.hpp b/src/interfaces/cell_helper.hpp
index 141d905..d814aa7 100644
--- a/src/interfaces/cell_helper.hpp
+++ b/src/interfaces/cell_helper.hpp
@@ -8,6 +8,7 @@
#include <list>
#include <memory>
+#include <vector>
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class ICellHelper
@@ -22,14 +23,8 @@ public:
get_birth_cell_positions(const std::list<Vector2> &cell_positions) const noexcept
-> std::list<Vector2> = 0;
- /*
- [[nodiscard]] virtual auto
- find_neighbour_cells(const Vector2 &cell_pos) const noexcept
- -> std::list<Vector2> = 0;
- */
-
[[nodiscard]] virtual auto find_neighbours(const Vector2 &cell_pos) const noexcept
- -> std::list<Vector2> = 0;
+ -> std::vector<Vector2> = 0;
};
template <typename MatrixElement>