Games: Cast unused smart-pointer return values to void

This commit is contained in:
Sam Atkins 2021-12-02 12:53:33 +00:00 committed by Andreas Kling
parent d95e50643e
commit 0e2fa09f52
Notes: sideshowbarker 2024-07-17 23:08:55 +09:00
6 changed files with 11 additions and 11 deletions

View file

@ -60,7 +60,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(315, 336);
auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>());
TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
main_widget->set_fill_with_background_color(true);
Game game { board_size, target_tile, evil_ai };

View file

@ -98,27 +98,27 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
statusbar.set_text(click_tip);
board_widget->run_generation();
});
TRY(main_toolbar.try_add_action(run_one_generation_action));
(void)TRY(main_toolbar.try_add_action(run_one_generation_action));
auto clear_board_action = GUI::Action::create("&Clear board", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
statusbar.set_text(click_tip);
board_widget->clear_cells();
board_widget->update();
});
TRY(main_toolbar.try_add_action(clear_board_action));
(void)TRY(main_toolbar.try_add_action(clear_board_action));
auto randomize_cells_action = GUI::Action::create("&Randomize board", { Mod_Ctrl, Key_R }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
statusbar.set_text(click_tip);
board_widget->randomize_cells();
board_widget->update();
});
TRY(main_toolbar.try_add_action(randomize_cells_action));
(void)TRY(main_toolbar.try_add_action(randomize_cells_action));
auto rotate_pattern_action = GUI::Action::create("&Rotate pattern", { 0, Key_R }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/redo.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
board_widget->selected_pattern()->rotate_clockwise();
});
rotate_pattern_action->set_enabled(false);
TRY(main_toolbar.try_add_action(rotate_pattern_action));
(void)TRY(main_toolbar.try_add_action(rotate_pattern_action));
auto game_menu = TRY(window->try_add_menu("&Game"));

View file

@ -43,7 +43,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(139, 175);
auto widget = TRY(window->try_set_main_widget<GUI::Widget>());
TRY(widget->try_set_layout<GUI::VerticalBoxLayout>());
(void)TRY(widget->try_set_layout<GUI::VerticalBoxLayout>());
widget->layout()->set_spacing(0);
auto top_line = TRY(widget->try_add<GUI::SeparatorWidget>(Gfx::Orientation::Horizontal));
@ -52,7 +52,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto container = TRY(widget->try_add<GUI::Widget>());
container->set_fill_with_background_color(true);
container->set_fixed_height(36);
TRY(container->try_set_layout<GUI::HorizontalBoxLayout>());
(void)TRY(container->try_set_layout<GUI::HorizontalBoxLayout>());
container->layout()->add_spacer();

View file

@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_icon(app_icon.bitmap_for_size(16));
window->set_title("Pong");
window->set_double_buffering_enabled(false);
TRY(window->try_set_main_widget<Pong::Game>());
(void)TRY(window->try_set_main_widget<Pong::Game>());
window->set_resizable(false);
auto game_menu = TRY(window->try_add_menu("&Game"));

View file

@ -294,7 +294,7 @@ void Game::mouseup_event(GUI::MouseEvent& event)
for (auto& to_intersect : m_focused_cards) {
mark_intersecting_stacks_dirty(to_intersect);
stack.push(to_intersect);
m_focused_stack->pop();
(void)m_focused_stack->pop();
}
remember_move_for_undo(*m_focused_stack, stack, m_focused_cards);
@ -629,7 +629,7 @@ void Game::perform_undo()
for (auto& to_intersect : m_last_move.cards) {
mark_intersecting_stacks_dirty(to_intersect);
m_last_move.from->push(to_intersect);
m_last_move.to->pop();
(void)m_last_move.to->pop();
}
if (m_last_move.from->type() == CardStack::Type::Stock) {

View file

@ -303,7 +303,7 @@ void Game::mouseup_event(GUI::MouseEvent& event)
for (auto& to_intersect : m_focused_cards) {
mark_intersecting_stacks_dirty(to_intersect);
stack.push(to_intersect);
m_focused_stack->pop();
(void)m_focused_stack->pop();
}
update_score(-1);