1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:17:45 +00:00

Userland: Fix remaining smart pointer const-correctness issues

This commit is contained in:
Andreas Kling 2023-02-20 19:03:59 +01:00
parent faa1a09042
commit 33e87d1627
17 changed files with 23 additions and 23 deletions

View file

@ -421,7 +421,7 @@ Chess::Square ChessWidget::mouse_to_square(GUI::MouseEvent& event) const
}
}
RefPtr<Gfx::Bitmap> ChessWidget::get_piece_graphic(Chess::Piece const& piece) const
RefPtr<Gfx::Bitmap const> ChessWidget::get_piece_graphic(Chess::Piece const& piece) const
{
return m_pieces.get(piece).value();
}

View file

@ -48,7 +48,7 @@ public:
bool drag_enabled() const { return m_drag_enabled; }
void set_drag_enabled(bool e) { m_drag_enabled = e; }
RefPtr<Gfx::Bitmap> get_piece_graphic(Chess::Piece const& piece) const;
RefPtr<Gfx::Bitmap const> get_piece_graphic(Chess::Piece const& piece) const;
bool show_available_moves() const { return m_show_available_moves; }
void set_show_available_moves(bool e) { m_show_available_moves = e; }
@ -128,7 +128,7 @@ private:
Color m_marking_alternate_color { Color::from_argb(0x66ffaa00) };
Color m_marking_secondary_color { Color::from_argb(0x6655dd55) };
Chess::Color m_side { Chess::Color::White };
HashMap<Chess::Piece, RefPtr<Gfx::Bitmap>> m_pieces;
HashMap<Chess::Piece, RefPtr<Gfx::Bitmap const>> m_pieces;
DeprecatedString m_piece_set;
Chess::Square m_moving_square { 50, 50 };
Gfx::IntPoint m_drag_point;

View file

@ -40,7 +40,7 @@ ColorLines::BitmapArray ColorLines::build_marble_color_bitmaps()
ColorLines::BitmapArray ColorLines::build_marble_trace_bitmaps()
{
// Use "Paw Prints" Unicode Character (U+1F43E)
auto trace_bitmap = NonnullRefPtr<Gfx::Bitmap>(*Gfx::Emoji::emoji_for_code_point(0x1F43E));
auto trace_bitmap = NonnullRefPtr<Gfx::Bitmap const>(*Gfx::Emoji::emoji_for_code_point(0x1F43E));
BitmapArray result;
result.ensure_capacity(number_of_marble_trace_bitmaps);
result.append(trace_bitmap);

View file

@ -47,7 +47,7 @@ private:
void restart_timer(int milliseconds);
using Point = Gfx::IntPoint;
using BitmapArray = Vector<NonnullRefPtr<Gfx::Bitmap>>;
using BitmapArray = Vector<NonnullRefPtr<Gfx::Bitmap const>>;
StringView const m_app_name;
GameState m_game_state { GameState::Idle };

View file

@ -162,7 +162,7 @@ void Player::remove_cards(NonnullRefPtrVector<Card> const& cards)
{
for (auto& card : cards) {
hand.remove_first_matching([&card](auto& other_card) {
return other_card == card;
return other_card.ptr() == &card;
});
}
}