Skip to content

Commit

Permalink
improvements: cleaner std::stack clear (#36)
Browse files Browse the repository at this point in the history
* improvements: deleted unnecessary tab indent

* improvements: cleaner std::stack clear

* fix(compilation): added the missing noexcept
  • Loading branch information
naezith authored and Milerius committed Sep 19, 2019
1 parent 22680a0 commit 15be47e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace antara::gaming::scenes::tests
my_game_scene(entt::registry &entity_registry, entt::dispatcher &dispatcher_) noexcept : base_scene(
entity_registry, dispatcher_)
{
MESSAGE("game_scene enter");
MESSAGE("game_scene enter");
}

void update() noexcept final
Expand All @@ -50,7 +50,7 @@ namespace antara::gaming::scenes::tests

~my_game_scene() noexcept final
{
MESSAGE("game_scene leave");
MESSAGE("game_scene leave");
}
};

Expand Down
11 changes: 3 additions & 8 deletions modules/scenes/antara/gaming/scenes/scene.manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,15 @@ namespace antara::gaming::scenes
return false;
}

void manager::clear()
void manager::clear() noexcept
{
while (not scenes_.empty())
{
scenes_.pop();
}
scenes_ = {};
}

void manager::change_scene(manager::scene_ptr &&scene, bool just_push_scene) noexcept
{
if (not just_push_scene) {
while (not scenes_.empty()) {
scenes_.pop();
}
clear();
}
scenes_.push(std::move(scene));
}
Expand Down
2 changes: 1 addition & 1 deletion modules/scenes/antara/gaming/scenes/scene.manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace antara::gaming::scenes

bool previous_scene();

void clear();
void clear() noexcept;
base_scene &current_scene() noexcept;

private:
Expand Down

0 comments on commit 15be47e

Please sign in to comment.