Skip to content

Commit

Permalink
Format if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusGuy committed Jul 20, 2023
1 parent 50b1522 commit 7f390c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/object/brick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ HitResponse
Brick::collision(GameObject& other, const CollisionHit& hit)
{
auto player = dynamic_cast<Player*> (&other);
if (player) {
if (player->m_does_buttjump) try_break(player);
}
if (player && player->m_does_buttjump) try_break(player);

auto badguy = dynamic_cast<BadGuy*> (&other);
if (badguy) {
Expand Down
9 changes: 3 additions & 6 deletions src/object/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,14 +751,12 @@ Player::update(float dt_sec)
downbox.set_bottom(get_bbox().get_bottom() + 16.f);
for (auto& brick : Sector::get().get_objects_by_type<Brick>()) {
// stoneform breaks through any kind of bricks
if (downbox.contains(brick.get_bbox()) && (m_stone || !dynamic_cast<HeavyBrick*>(&brick))) {
if (downbox.contains(brick.get_bbox()) && (m_stone || !dynamic_cast<HeavyBrick*>(&brick)))
brick.try_break(this, is_big());
}
}
for (auto& badguy : Sector::get().get_objects_by_type<BadGuy>()) {
if (downbox.contains(badguy.get_bbox()) && badguy.is_snipable()) {
if (downbox.contains(badguy.get_bbox()) && badguy.is_snipable())
badguy.kill_fall();
}
}
}

Expand All @@ -768,9 +766,8 @@ Player::update(float dt_sec)
Rectf topbox = get_bbox().grown(-1.f);
topbox.set_top(get_bbox().get_top() - 16.f);
for (auto& brick : Sector::get().get_objects_by_type<Brick>()) {
if (topbox.contains(brick.get_bbox())) {
if (topbox.contains(brick.get_bbox()))
brick.try_break(this, is_big());
}
}
}

Expand Down

0 comments on commit 7f390c9

Please sign in to comment.