summaryrefslogtreecommitdiff
path: root/Userland/Games
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-23 20:42:32 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-23 20:56:54 +0100
commit5d180d1f996ead27f9c5cb3db7f91e293de34d9d (patch)
treee881854dac5d749518562970d6194a0ef65736ec /Userland/Games
parentb33a6a443e700cd80325d312f21c985b0687bb97 (diff)
downloadserenity-5d180d1f996ead27f9c5cb3db7f91e293de34d9d.zip
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
Diffstat (limited to 'Userland/Games')
-rw-r--r--Userland/Games/2048/BoardView.cpp2
-rw-r--r--Userland/Games/Chess/ChessWidget.cpp6
-rw-r--r--Userland/Games/Chess/Engine.cpp6
-rw-r--r--Userland/Games/Conway/Game.cpp2
-rw-r--r--Userland/Games/Minesweeper/Field.cpp4
-rw-r--r--Userland/Games/Solitaire/Card.cpp8
-rw-r--r--Userland/Games/Solitaire/CardStack.cpp10
-rw-r--r--Userland/Games/Solitaire/SolitaireWidget.cpp2
-rw-r--r--Userland/Games/Solitaire/SolitaireWidget.h2
9 files changed, 21 insertions, 21 deletions
diff --git a/Userland/Games/2048/BoardView.cpp b/Userland/Games/2048/BoardView.cpp
index 230c1eedc5..5730c494d6 100644
--- a/Userland/Games/2048/BoardView.cpp
+++ b/Userland/Games/2048/BoardView.cpp
@@ -165,7 +165,7 @@ Gfx::Color BoardView::background_color_for_cell(u32 value)
case 2048:
return Color::from_rgb(0xedc22e);
default:
- ASSERT(value > 2048);
+ VERIFY(value > 2048);
return Color::from_rgb(0x3c3a32);
}
}
diff --git a/Userland/Games/Chess/ChessWidget.cpp b/Userland/Games/Chess/ChessWidget.cpp
index c3c083f8d0..ec622f012f 100644
--- a/Userland/Games/Chess/ChessWidget.cpp
+++ b/Userland/Games/Chess/ChessWidget.cpp
@@ -270,7 +270,7 @@ void ChessWidget::mouseup_event(GUI::MouseEvent& event)
msg = "Draw by insufficient material.";
break;
default:
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
}
if (over) {
set_drag_enabled(false);
@@ -420,7 +420,7 @@ void ChessWidget::input_engine_move()
if (!want_engine_move())
return;
set_drag_enabled(drag_was_enabled);
- ASSERT(board().apply_move(move));
+ VERIFY(board().apply_move(move));
m_playback_move_number = m_board.moves().size();
m_playback = false;
m_board_markings.clear();
@@ -464,7 +464,7 @@ void ChessWidget::playback_move(PlaybackDirection direction)
}
break;
default:
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
}
update();
}
diff --git a/Userland/Games/Chess/Engine.cpp b/Userland/Games/Chess/Engine.cpp
index f02a4a5f5b..a0ccc72ba7 100644
--- a/Userland/Games/Chess/Engine.cpp
+++ b/Userland/Games/Chess/Engine.cpp
@@ -43,12 +43,12 @@ Engine::Engine(const StringView& command)
int rpipefds[2];
if (pipe2(wpipefds, O_CLOEXEC) < 0) {
perror("pipe2");
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
}
if (pipe2(rpipefds, O_CLOEXEC) < 0) {
perror("pipe2");
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
}
posix_spawn_file_actions_t file_actions;
@@ -60,7 +60,7 @@ Engine::Engine(const StringView& command)
const char* argv[] = { cstr.characters(), nullptr };
if (posix_spawnp(&m_pid, cstr.characters(), &file_actions, nullptr, const_cast<char**>(argv), environ) < 0) {
perror("posix_spawnp");
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
}
posix_spawn_file_actions_destroy(&file_actions);
diff --git a/Userland/Games/Conway/Game.cpp b/Userland/Games/Conway/Game.cpp
index 83823eca92..52105fe447 100644
--- a/Userland/Games/Conway/Game.cpp
+++ b/Userland/Games/Conway/Game.cpp
@@ -177,6 +177,6 @@ void Game::interact_at(const Gfx::IntPoint& point)
m_universe[cell_y][cell_x] = false;
break;
default:
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
}
}
diff --git a/Userland/Games/Minesweeper/Field.cpp b/Userland/Games/Minesweeper/Field.cpp
index 2bec8dcc27..a859486884 100644
--- a/Userland/Games/Minesweeper/Field.cpp
+++ b/Userland/Games/Minesweeper/Field.cpp
@@ -416,7 +416,7 @@ void Field::on_square_right_clicked(Square& square)
void Field::set_flag(Square& square, bool flag)
{
- ASSERT(!square.is_swept);
+ VERIFY(!square.is_swept);
if (square.has_flag == flag)
return;
square.is_considering = false;
@@ -425,7 +425,7 @@ void Field::set_flag(Square& square, bool flag)
++m_flags_left;
} else {
- ASSERT(m_flags_left);
+ VERIFY(m_flags_left);
--m_flags_left;
}
square.has_flag = flag;
diff --git a/Userland/Games/Solitaire/Card.cpp b/Userland/Games/Solitaire/Card.cpp
index 23c3473632..1887393bb0 100644
--- a/Userland/Games/Solitaire/Card.cpp
+++ b/Userland/Games/Solitaire/Card.cpp
@@ -85,7 +85,7 @@ Card::Card(Type type, uint8_t value)
, m_type(type)
, m_value(value)
{
- ASSERT(value < card_count);
+ VERIFY(value < card_count);
Gfx::IntRect paint_rect({ 0, 0 }, { width, height });
if (s_background.is_null()) {
@@ -94,7 +94,7 @@ Card::Card(Type type, uint8_t value)
s_background->fill(Color::White);
auto image = Gfx::Bitmap::load_from_file("/res/icons/solitaire/buggie-deck.png");
- ASSERT(!image.is_null());
+ VERIFY(!image.is_null());
float aspect_ratio = image->width() / static_cast<float>(image->height());
auto target_size = Gfx::IntSize(static_cast<int>(aspect_ratio * (height - 5)), height - 5);
@@ -132,7 +132,7 @@ Card::Card(Type type, uint8_t value)
symbol = s_heart;
break;
default:
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
}
painter.draw_bitmap(
@@ -152,7 +152,7 @@ Card::~Card()
void Card::draw(GUI::Painter& painter) const
{
- ASSERT(!s_background.is_null());
+ VERIFY(!s_background.is_null());
painter.blit(position(), m_upside_down ? *s_background : *m_front, m_front->rect());
}
diff --git a/Userland/Games/Solitaire/CardStack.cpp b/Userland/Games/Solitaire/CardStack.cpp
index bb2b1bade5..4e5953420b 100644
--- a/Userland/Games/Solitaire/CardStack.cpp
+++ b/Userland/Games/Solitaire/CardStack.cpp
@@ -39,7 +39,7 @@ CardStack::CardStack(const Gfx::IntPoint& position, Type type)
, m_rules(rules_for_type(type))
, m_base(m_position, { Card::width, Card::height })
{
- ASSERT(type != Invalid);
+ VERIFY(type != Invalid);
calculate_bounding_box();
}
@@ -77,7 +77,7 @@ void CardStack::draw(GUI::Painter& painter, const Gfx::Color& background_color)
painter.draw_rect(m_base, background_color.darkened(0.5));
break;
default:
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
}
if (is_empty())
@@ -99,7 +99,7 @@ void CardStack::draw(GUI::Painter& painter, const Gfx::Color& background_color)
void CardStack::rebound_cards()
{
- ASSERT(m_stack_positions.size() == m_stack.size());
+ VERIFY(m_stack_positions.size() == m_stack.size());
size_t card_index = 0;
for (auto& card : m_stack)
@@ -108,7 +108,7 @@ void CardStack::rebound_cards()
void CardStack::add_all_grabbed_cards(const Gfx::IntPoint& click_location, NonnullRefPtrVector<Card>& grabbed)
{
- ASSERT(grabbed.is_empty());
+ VERIFY(grabbed.is_empty());
if (m_type != Normal) {
auto& top_card = peek();
@@ -171,7 +171,7 @@ bool CardStack::is_allowed_to_push(const Card& card) const
return top_card.color() != card.color() && top_card.value() == card.value() + 1;
}
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
}
return true;
diff --git a/Userland/Games/Solitaire/SolitaireWidget.cpp b/Userland/Games/Solitaire/SolitaireWidget.cpp
index d6497db677..fbf1cc7eb1 100644
--- a/Userland/Games/Solitaire/SolitaireWidget.cpp
+++ b/Userland/Games/Solitaire/SolitaireWidget.cpp
@@ -71,7 +71,7 @@ void SolitaireWidget::tick(GUI::Window& window)
return;
if (m_game_over_animation) {
- ASSERT(!m_animation.card().is_null());
+ VERIFY(!m_animation.card().is_null());
if (m_animation.card()->position().x() > SolitaireWidget::width || m_animation.card()->rect().right() < 0)
create_new_animation_card();
diff --git a/Userland/Games/Solitaire/SolitaireWidget.h b/Userland/Games/Solitaire/SolitaireWidget.h
index 213251715d..e32cf05a24 100644
--- a/Userland/Games/Solitaire/SolitaireWidget.h
+++ b/Userland/Games/Solitaire/SolitaireWidget.h
@@ -60,7 +60,7 @@ private:
void tick()
{
- ASSERT(!m_animation_card.is_null());
+ VERIFY(!m_animation_card.is_null());
m_y_velocity += m_gravity;
if (m_animation_card->position().y() + Card::height + m_y_velocity > SolitaireWidget::height + 1 && m_y_velocity > 0) {