aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/game.cpp14
-rw-r--r--src/game/game.hpp2
2 files changed, 12 insertions, 4 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 0b3e85e..879f096 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -29,7 +29,8 @@ Game::Game(
_status_manager(std::move(status_manager)),
_user_input_observer(std::move(user_input_observer)),
_cell_helper(std::move(cell_helper)),
- _current_mode(Mode::NORMAL)
+ _current_mode(Mode::NORMAL),
+ _minimum_cursor_pos_y(0)
{
}
@@ -44,6 +45,8 @@ void Game::on_start() noexcept
_status_manager->bind(statusline);
+ _minimum_cursor_pos_y = 2;
+
_status_manager->set_section_title(StatusLineSection::A, "");
_status_manager->set_section_title(StatusLineSection::B, "X: ");
_status_manager->set_section_title(StatusLineSection::C, "Y: ");
@@ -319,8 +322,11 @@ void Game::_on_normal_mode_update() noexcept
for (const auto &birth_cell_pos : birth_cell_positions)
{
- _set_space(matrix, birth_cell_pos, 'x');
- _living_cell_positions.push_back(birth_cell_pos);
+ if (birth_cell_pos.get_y() >= _minimum_cursor_pos_y)
+ {
+ _set_space(matrix, birth_cell_pos, 'x');
+ _living_cell_positions.push_back(birth_cell_pos);
+ }
}
}
@@ -502,7 +508,7 @@ auto Game::_move_cursor(const Vector2 &direction) noexcept -> bool
return false;
}
- if (dest_position.get_y() <= 1)
+ if (dest_position.get_y() < _minimum_cursor_pos_y)
{
return false;
}
diff --git a/src/game/game.hpp b/src/game/game.hpp
index a35c0ce..4d83fe5 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -79,6 +79,8 @@ private:
Mode _current_mode;
+ int32_t _minimum_cursor_pos_y;
+
std::optional<Vector2> _last_pos_before_command_mode;
std::string _command_mode_input;