mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:47:34 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -24,9 +24,9 @@ ChessWidget::ChessWidget()
|
|||
|
||||
void ChessWidget::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
const int min_size = min(width(), height());
|
||||
const int widget_offset_x = (window()->width() - min_size) / 2;
|
||||
const int widget_offset_y = (window()->height() - min_size) / 2;
|
||||
int const min_size = min(width(), height());
|
||||
int const widget_offset_x = (window()->width() - min_size) / 2;
|
||||
int const widget_offset_y = (window()->height() - min_size) / 2;
|
||||
|
||||
GUI::Frame::paint_event(event);
|
||||
|
||||
|
@ -144,7 +144,7 @@ void ChessWidget::paint_event(GUI::PaintEvent& event)
|
|||
Gfx::IntPoint move_point;
|
||||
Gfx::IntPoint point_offset = { tile_width / 3, tile_height / 3 };
|
||||
Gfx::IntSize rect_size = { tile_width / 3, tile_height / 3 };
|
||||
for (const auto& square : m_available_moves) {
|
||||
for (auto const& square : m_available_moves) {
|
||||
if (side() == Chess::Color::White) {
|
||||
move_point = { square.file * tile_width, (7 - square.rank) * tile_height };
|
||||
} else {
|
||||
|
@ -165,9 +165,9 @@ void ChessWidget::paint_event(GUI::PaintEvent& event)
|
|||
|
||||
void ChessWidget::mousedown_event(GUI::MouseEvent& event)
|
||||
{
|
||||
const int min_size = min(width(), height());
|
||||
const int widget_offset_x = (window()->width() - min_size) / 2;
|
||||
const int widget_offset_y = (window()->height() - min_size) / 2;
|
||||
int const min_size = min(width(), height());
|
||||
int const widget_offset_x = (window()->width() - min_size) / 2;
|
||||
int const widget_offset_y = (window()->height() - min_size) / 2;
|
||||
|
||||
if (!frame_inner_rect().contains(event.position()))
|
||||
return;
|
||||
|
@ -306,9 +306,9 @@ void ChessWidget::mouseup_event(GUI::MouseEvent& event)
|
|||
|
||||
void ChessWidget::mousemove_event(GUI::MouseEvent& event)
|
||||
{
|
||||
const int min_size = min(width(), height());
|
||||
const int widget_offset_x = (window()->width() - min_size) / 2;
|
||||
const int widget_offset_y = (window()->height() - min_size) / 2;
|
||||
int const min_size = min(width(), height());
|
||||
int const widget_offset_x = (window()->width() - min_size) / 2;
|
||||
int const widget_offset_y = (window()->height() - min_size) / 2;
|
||||
|
||||
if (!frame_inner_rect().contains(event.position()))
|
||||
return;
|
||||
|
@ -391,9 +391,9 @@ void ChessWidget::set_piece_set(StringView set)
|
|||
|
||||
Chess::Square ChessWidget::mouse_to_square(GUI::MouseEvent& event) const
|
||||
{
|
||||
const int min_size = min(width(), height());
|
||||
const int widget_offset_x = (window()->width() - min_size) / 2;
|
||||
const int widget_offset_y = (window()->height() - min_size) / 2;
|
||||
int const min_size = min(width(), height());
|
||||
int const widget_offset_x = (window()->width() - min_size) / 2;
|
||||
int const widget_offset_y = (window()->height() - min_size) / 2;
|
||||
|
||||
int tile_width = min_size / 8;
|
||||
int tile_height = min_size / 8;
|
||||
|
@ -405,7 +405,7 @@ Chess::Square ChessWidget::mouse_to_square(GUI::MouseEvent& event) const
|
|||
}
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Bitmap> ChessWidget::get_piece_graphic(const Chess::Piece& piece) const
|
||||
RefPtr<Gfx::Bitmap> ChessWidget::get_piece_graphic(Chess::Piece const& piece) const
|
||||
{
|
||||
return m_pieces.get(piece).value();
|
||||
}
|
||||
|
|
|
@ -27,22 +27,22 @@ public:
|
|||
virtual void keydown_event(GUI::KeyEvent&) override;
|
||||
|
||||
Chess::Board& board() { return m_board; };
|
||||
const Chess::Board& board() const { return m_board; };
|
||||
Chess::Board const& board() const { return m_board; };
|
||||
|
||||
Chess::Board& board_playback() { return m_board_playback; };
|
||||
const Chess::Board& board_playback() const { return m_board_playback; };
|
||||
Chess::Board const& board_playback() const { return m_board_playback; };
|
||||
|
||||
Chess::Color side() const { return m_side; };
|
||||
void set_side(Chess::Color side) { m_side = side; };
|
||||
|
||||
void set_piece_set(StringView set);
|
||||
const String& piece_set() const { return m_piece_set; };
|
||||
String const& piece_set() const { return m_piece_set; };
|
||||
|
||||
Chess::Square mouse_to_square(GUI::MouseEvent& event) const;
|
||||
|
||||
bool drag_enabled() const { return m_drag_enabled; }
|
||||
void set_drag_enabled(bool e) { m_drag_enabled = e; }
|
||||
RefPtr<Gfx::Bitmap> get_piece_graphic(const Chess::Piece& piece) const;
|
||||
RefPtr<Gfx::Bitmap> 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; }
|
||||
|
@ -61,8 +61,8 @@ public:
|
|||
Color light_square_color;
|
||||
};
|
||||
|
||||
const BoardTheme& board_theme() const { return m_board_theme; }
|
||||
void set_board_theme(const BoardTheme& theme) { m_board_theme = theme; }
|
||||
BoardTheme const& board_theme() const { return m_board_theme; }
|
||||
void set_board_theme(BoardTheme const& theme) { m_board_theme = theme; }
|
||||
void set_board_theme(StringView name);
|
||||
|
||||
enum class PlaybackDirection {
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
|
||||
return Type::None;
|
||||
}
|
||||
bool operator==(const BoardMarking& other) const { return from == other.from && to == other.to; }
|
||||
bool operator==(BoardMarking const& other) const { return from == other.from && to == other.to; }
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -37,7 +37,7 @@ Engine::Engine(StringView command)
|
|||
posix_spawn_file_actions_adddup2(&file_actions, rpipefds[1], STDOUT_FILENO);
|
||||
|
||||
String cstr(command);
|
||||
const char* argv[] = { cstr.characters(), nullptr };
|
||||
char const* argv[] = { cstr.characters(), nullptr };
|
||||
if (posix_spawnp(&m_pid, cstr.characters(), &file_actions, nullptr, const_cast<char**>(argv), environ) < 0) {
|
||||
perror("posix_spawnp");
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -59,7 +59,7 @@ Engine::Engine(StringView command)
|
|||
send_command(Chess::UCI::UCICommand());
|
||||
}
|
||||
|
||||
void Engine::handle_bestmove(const Chess::UCI::BestMoveCommand& command)
|
||||
void Engine::handle_bestmove(Chess::UCI::BestMoveCommand const& command)
|
||||
{
|
||||
if (m_bestmove_callback)
|
||||
m_bestmove_callback(command.move());
|
||||
|
|
|
@ -17,13 +17,13 @@ public:
|
|||
|
||||
Engine(StringView command);
|
||||
|
||||
Engine(const Engine&) = delete;
|
||||
Engine& operator=(const Engine&) = delete;
|
||||
Engine(Engine const&) = delete;
|
||||
Engine& operator=(Engine const&) = delete;
|
||||
|
||||
virtual void handle_bestmove(const Chess::UCI::BestMoveCommand&) override;
|
||||
virtual void handle_bestmove(Chess::UCI::BestMoveCommand const&) override;
|
||||
|
||||
template<typename Callback>
|
||||
void get_best_move(const Chess::Board& board, int time_limit, Callback&& callback)
|
||||
void get_best_move(Chess::Board const& board, int time_limit, Callback&& callback)
|
||||
{
|
||||
send_command(Chess::UCI::PositionCommand({}, board.moves()));
|
||||
Chess::UCI::GoCommand go_command;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue