Acabat amb cppcheck

Arreglades les herencies de les classes Sprite
This commit is contained in:
2024-10-13 21:00:33 +02:00
parent 809c10048e
commit 7c876e1d4d
21 changed files with 99 additions and 110 deletions

View File

@@ -3,7 +3,6 @@
#include "sprite.h" // for Sprite
#include <memory> // for std::unique_ptr
// Constantes evaluables en tiempo de compilación
constexpr int BULLET_WIDTH = 12;
constexpr int BULLET_HEIGHT = 12;
constexpr int BULLET_VELY = -3;
@@ -23,10 +22,9 @@ Bullet::Bullet(int x, int y, BulletType kind, bool powered_up, int owner, SDL_Re
owner_(owner),
play_area_(play_area)
{
vel_x_ = (kind_ == BulletType::LEFT) ? BULLET_VELX_LEFT
: (kind_ == BulletType::RIGHT) ? BULLET_VELX_RIGHT
: 0;
vel_x_ = (kind_ == BulletType::LEFT) ? BULLET_VELX_LEFT : (kind_ == BulletType::RIGHT) ? BULLET_VELX_RIGHT
: 0;
auto sprite_offset = powered_up ? 3 : 0;
auto kind_index = static_cast<int>(kind);
sprite_->setSpriteClip((kind_index + sprite_offset) * width_, 0, sprite_->getWidth(), sprite_->getHeight());
@@ -67,12 +65,12 @@ BulletMoveStatus Bullet::move()
bool Bullet::isEnabled() const
{
return kind_ != BulletType::NULL_TYPE;
return kind_ != BulletType::NONE;
}
void Bullet::disable()
{
kind_ = BulletType::NULL_TYPE;
kind_ = BulletType::NONE;
}
int Bullet::getPosX() const