From 3dbf3b68c484704aafcda9fd05ae88a0337956ef Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 19 Mar 2022 13:28:29 +0100 Subject: feat: add inserting cells --- src/engine/data/bounds.cpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src/engine/data/bounds.cpp') diff --git a/src/engine/data/bounds.cpp b/src/engine/data/bounds.cpp index fdf8c6b..1a8c4d0 100644 --- a/src/engine/data/bounds.cpp +++ b/src/engine/data/bounds.cpp @@ -50,26 +50,36 @@ CoordsValidation Bounds::validate_coords(const Vector2 &coords) const noexcept return CoordsValidation::VALID; } -const Bounds &Bounds::operator*=(const Bounds &bounds) noexcept +const Bounds &Bounds::operator*=(const Bounds &rhs) noexcept { - _width *= bounds._width; - _height *= bounds._height; + _width *= rhs._width; + _height *= rhs._height; return *this; } -const Bounds &Bounds::operator+=(const Bounds &bounds) noexcept +const Bounds &Bounds::operator+=(const Bounds &rhs) noexcept { - _width += bounds._width; - _height += bounds._height; + _width += rhs._width; + _height += rhs._height; return *this; } -const Bounds &Bounds::operator-=(const Bounds &bounds) noexcept +const Bounds &Bounds::operator-=(const Bounds &rhs) noexcept { - _width -= bounds._width; - _height -= bounds._height; + _width -= rhs._width; + _height -= rhs._height; return *this; } + +Bounds Bounds::operator-(const Bounds &rhs) const noexcept +{ + auto new_bounds = Bounds(*this); + + new_bounds._width -= rhs._width; + new_bounds._height -= rhs._height; + + return new_bounds; +} -- cgit v1.2.3-18-g5258