diff options
Diffstat (limited to 'src/game/cell_helper_impl.hpp')
-rw-r--r-- | src/game/cell_helper_impl.hpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/game/cell_helper_impl.hpp b/src/game/cell_helper_impl.hpp index b7da413..bd40794 100644 --- a/src/game/cell_helper_impl.hpp +++ b/src/game/cell_helper_impl.hpp @@ -6,18 +6,19 @@ template <typename MatrixElement> constexpr auto has_matrix_value( - const IMatrix<MatrixElement> &matrix, + const std::shared_ptr<IMatrix<MatrixElement>> &matrix, const MatrixElement &value) noexcept { return [&matrix, &value](const Vector2 &pos) { - return matrix.get(pos) == value; + return matrix->get(pos) == value; }; } template <typename MatrixElement> -CellHelper<MatrixElement>::CellHelper(const IMatrix<MatrixElement> &matrix) noexcept - : _matrix(matrix) +CellHelper<MatrixElement>::CellHelper( + std::shared_ptr<IMatrix<MatrixElement>> matrix) noexcept + : _matrix(std::move(matrix)) { } @@ -75,7 +76,7 @@ auto CellHelper<MatrixElement>::find_neighbours(const Vector2 &cell_pos) const n std::vector<Vector2> cell_positions = {}; const auto matrix_size = - Bounds({.width = _matrix.get_column_cnt(), .height = _matrix.get_row_cnt()}); + Bounds({.width = _matrix->get_column_cnt(), .height = _matrix->get_row_cnt()}); const auto neighbours = _get_position_neighbours(cell_pos); |